



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




The runs up and down test is a statistical test that checks a randomness hypothesis for a data sequence. More specifically, it tests the null hypothesis that the data are random, i.e., that each data point is independent of others.
A "run" in this context is a series of increasing or decreasing values. For instance, in a sequence of coin tosses, a run might be a series of heads (H) or tails (T). If the coin is fair and tosses are independent, we should see both heads and tails occurring in a random pattern, with roughly equal numbers of runs of each type and of varying lengths.
On the other hand, sequences with an unusually large or small number of runs might suggest non-randomness. For example, alternating perfectly between heads and tails (as in example A) might suggest negative correlation, while long runs of just heads or just tails (as in example B) might suggest positive correlation. A more random sequence (like example C) would have a mix of run lengths and types.
The number of runs is asymptotically Normally distributed as follows:
It's important to note that these are approximations, and they are more accurate for larger n. The central limit theorem plays a role here: as n grows large, the distribution of the number of runs becomes increasingly close to a normal distribution.
The normal approximation for the number of runs is convenient because it allows us to use the powerful techniques of parametric statistics (like Z-tests) to test hypotheses about the randomness of the data, even though the raw data are nonparametric. It's a good example of how we often use approximations in statistics when the exact distribution is either unknown or inconvenient to work with.
The "runs above and below the mean" test is a test that is used to determine if a data set is from a random process. It's a type of runs test, similar to the "runs up and down" test, but it considers runs of values above and below a fixed level – in this case, the mean of a uniform distribution (0.5).
The number of runs is asymptotically Normally distributed as follows:
The approximate normal distribution of the number of runs, B, is a result of the Central Limit Theorem (CLT). The Central Limit Theorem states that the sum of a large number of independent and identically distributed random variables will be approximately normally distributed, regardless of the original distribution of the variables.
In the context of the "runs above and below the mean" test, each "run" can be considered a random variable that takes a value of 1 when a run is present and a value of 0 otherwise. When we have a large number of these variables (i.e., a large number of observations), the sum of these variables (which gives us the total number of runs, B) will follow an approximate normal distribution, as stated by the CLT.
The parameters of this normal distribution (mean and variance) are calculated based on the properties of a binomial distribution because each run can be considered a "success" in a series of Bernoulli trials (each trial results in either a "+" or a "-"). The formulas given provide the expected number and variance of runs given the number of "+" and "-" symbols, if these symbols are randomly ordered.
The sequence is:
The runs are
Also see Knuth (1998). Section 3.3.2 in Seminumerical Algorithms.
k-Dimensional Uniformity: This test extends the concept of uniformity to multiple dimensions. In this test, the sequences of random numbers are grouped into vectors, and the goal is to check if these vectors are uniformly distributed over the k-dimensional unit cube. The Chi-square test is typically used for this purpose.
Runs above and below the median: This test is similar to the runs above and below the mean test, but it uses the median instead of the mean. It counts the number of runs above and below the median value and uses this to test the hypothesis of independence.
Permutation Test: In this test, we examine all possible permutations of a sequence of k numbers. We then determine the empirical distribution of these permutations from the sequence of random numbers generated and compare this to the expected distribution for true random numbers.
Kolmogorov-Smirnov Test Applied to Extreme Values: This is a variation of the Kolmogorov-Smirnov test where we compare the empirical distribution function of the extreme values (e.g., maximums) in groups of a random sequence to their expected distribution under randomness.
Correlation Tests: These tests examine the linear or non-linear association between subsequent numbers or numbers separated by a certain lag. If the numbers are independent, there should be no significant correlation.
Gap Test: This test analyzes the gaps between the occurrences of numbers in a certain range. The idea is that in a truly random sequence, the gaps between occurrences should follow a certain distribution (usually exponential).
Poker Test: This test is based on the frequency of different poker hands in a sequence of numbers. The idea is that a truly random sequence will generate all possible poker hands with frequencies that match their probabilities.
Birthday Test: This test is based on the birthday paradox, which states that the probability of two or more people having the same birthday is higher than intuition might suggest. The birthday test checks the randomness of a generator by determining the number of random integers needed before a repeat occurs. If the generator is truly random, this should correspond to the known probabilities derived from the birthday paradox.
Remember that no single test can conclusively prove that a sequence is truly random and independent. Each test can only disprove randomness or suggest evidence for it. Therefore,
multiple tests are often used in conjunction to assess the randomness and independence of a sequence of numbers.