Part VIII

Tests on Randomness

To test if a sequence of numbers, occurrences of diseased cases, or other data are randomly drawn from an underlying distribution or not is the topic of this part. Even though this might not sound difficult, it is. Let us assume a coin is tossed 10 times with five times heads and five times tails. This is a result we would expect, at least in the long run. However, if the sequence of (H)eads and (T)ails is HHHHHTTTTT you would argue against the hypothesis that the sample is random. The sequence HTHTHTHTHT looks ‘more’ random, but a little bit artificial. A sequence such as HHTHTHTTTH seems to be ‘more’ random than the two sequences before. So the question remains how to decide on randomness. Computer programs can only produce pseudo-random numbers due to algorithms generating such numbers. Nevertheless, if the cycle is long enough these numbers should appear to be random. A test on randomness can be used to detect if a random number generator works well (do not reject the hypothesis of randomness) or not (reject the hypothesis of randomness).

Get Statistical Hypothesis Testing with SAS and R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.