Test for random order [STB-14: snp5] --------------------- ^runtest^ varname [^in^] [, ^c^ontinuity ^d^rop ^m^ean ^s^plit ^t^hreshold(#) ] tests whether the observations of varname are serially independent--that is, whether they occur in a random order--by counting how many runs there are above and below a threshold. By default, the median is used as the threshold. A very small number of runs indicates positive serial correlation. A very large number of runs indicates negative serial correlation. Options ------- ^c^ontinuity specifies a continuity correction that may be helpful in small samples. However, if there are fewer than ten observations either above or below the threshold, the tables in Swed and Eisenhart provide more reliable critical values. By default, no continuity correction is used. ^d^rop directs the program to ignore any values of varname that are equal to the threshold value when counting runs and tabulating observations. By default, ^runtest^ counts a value as above the threshold when it is strictly above the threshold and as below the threshold when it is less than or equal to the threshold. ^m^ean directs the program to tabulate runs above and below the mean rather than the median. ^s^plit directs the program to randomly split values of varname that are equal to the threshold. In other words, when varname is equal to threshold, a "coin" is flipped. If it comes up heads, the value is counted as being above the threshhold. If it comes up tails, the value is counted as being below the threshold. ^t^hreshold(#) specifies an arbitrary threshold to use in counting runs. For example, if varname has already been coded as a 0|1 variable, the median will not generally be meaningful separating value. Author ------ Sean Becketti Stata Technical Bulletin FAX: 913-888-6708 Reference --------- Swed, Frieda S. and C. Eisenhart. 1943. Tables for testing randomness of grouping in a sequence of alternatives. Annals of Mathematical Statistics. 14: 83-86. Also see -------- STB: snp5 (STB-14)