Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -nruns- available on SSC

From   "Nick Cox" <>
To   <>
Subject   st: -nruns- available on SSC
Date   Wed, 11 Oct 2006 17:17:43 +0100

Thanks to Kit Baum, a new -nruns- package is now 
available from SSC. 

This is a sequel to 

Smeeton, N. and Cox, N.J. 2003. 
Do-it-yourself shuffling and the number of runs under randomness. 
Stata Journal 3(3): 270--277. 

and will be published formally as a Software Update in Stata Journal 6(4) 2006. 

That paper outlined a simple Stata method to get at run probabilities 
using repeated shuffling of the data. My co-author suggested that
some users would prefer canned commands to the exhilaration of
working out how to do it from first principles, so I have written

-nruns- and -nrunsi- count runs in a sequence of values
showing the successive occurrence of categories, -nruns-
for a given variable and -nrunsi- for values specified in 
the command line. (-nrunsi- is thus an immediate command.) 
Each command shuffles the sequence randomly a given number 
of times and displays the simulated frequency and probability 
distributions under randomness of the number of runs possible
with the same values and the probabilities of less
than, the same number as, or more than that observed.

I had some fun implementing the shuffling in Mata, with
resulting speed-ups. Consequently, Stata 9 is required.

You can install both -nruns- and -nrunsi- from within 
Stata by using

. ssc inst nruns 


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index