FAQ/rtest - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the odd letters out: ONlY twO thinGs aRE infiNite

location: FAQ / rtest

Some thoughts on testing for randomness

It is sometimes desired to test whether a set of generated numbers are random. There are three aspects that we can think about:

  1. Whether the numbers have a uniform distribution so are evenly distributed, perhaps after grouping into intervals. Histograms or stem-and-leaf displays could be sued and a formal test for uniformity via the Kolmogorov-Smirnov test (see EDA Graduate Statistics talk) and is available using the EXPLORE command in SPSS under analyze>descriptive statistics.

  2. A runs test could also be used to check for the absence of correlations between successive observations. This test counts the number of changes of direction in the series e.g. the sequence 3 5 2 has two runs (3 to 5 and 5 to 2) and compares this number to that expected by chance. This is available using the nonparametric one sample procedure in SPSS. In fact in SPSS 19 the new dialogue box calls the runs test 'Tes of sequence of randomness'
  3. To guard against a random permutation being repeated (e.g. 132 132) we could also plot the difference in sequence positions between successive observations from the same interval occurring. If the sequence is not being repeated then the difference in sequence positions should be evenly (uniformly) distributed.