List Members
Jon Deeks of the Centre for Statistics in Medicine has pointed out a problem
in my random number generators which you should be aware of. All of the
related commands begin with
-rnd-, such as -rndpoi-, which is the Poisson random number generator. If
the generators have been installed, type -hlp rnd- to see a listing of all the
files.
The problem occurs only when one is engaged in repeat uses of a rnd program,
which is set at a constant user defined seed number. This is common in
simulation studies. The problem is that the used defined seed is ignored after
the first use. This problem did not arise with older versions of Stata, but it
does with versions 8 and 9.
The simple fix is to change the line indicating version number to -version
4.0-. That is,
replace
version 3.1 with version 4.0
I will make the appropriate change on all of teh rnd files and repost them
to my Stata user Web site, which is -jhilbe/rnd-. I am also developing my own
web site and will have them posted there as well. I'll also have many other
programs posted. The site is tentatively to be called www.hilbestat.com, but
please wait until it is ready before accessing. I'll notify the list.
I apologize for any inconvenience that this problem may have caused. Thanks
to Jon for finding it, and determining, with the help of Stata technical
support, how to fix the problem.
FYI to newer users, I have developed random number generators for the
following distributions (taken from part of rnd.hlp).
Joe HiIbe
Student's t: ^rndt^ obs df
Example: rndt 10000 10
Chi-square: ^rndchi^ obs df
Example: rndchi 10000 4
F: ^rndf^ obs df_numer df_denom
Example: rndf 10000 4 15
log normal: ^rndlgn^ obs mean stddev
Example: rndlgn 10000 0 0.5
Poisson: ^rndpoi^ obs mean
^rndpoix^ [ mu ]
Example: rndpoi 10000 4
rndpoix mu
Poisson: ^rndpod^ obs mean dispersion
(ovedispersed) ^rndpodx^ [mu], s(#)
Example: rndpod 10000 4 1.2
rndpodx mu, s(1.2)
binomial: ^rndbin^ obs prob numb
^rndbinx^ [ prob ] den
Example: rndbin 10000 0.5 1
rndbinx mu den
Note: mu= varaiable with p values
den = case denominator (1=binary)
Use inverse links of logit, probit, cloglog, loglog to obtain
simulated logit, probit, etc data sets.
negative binomial: ^rndnbx^ [mu] , k(#)
Example: rndnblx mu, k(0.5)
Gamma: ^rndgam^ obs shape scale
^rndgamx^ [mu], s(#)
Example: rndgam 10000 4 2
rndgamx mu, s(1)
Note: s(1) specifies a shape parameter of 1;
the scale is calculated from mu*shape
inverse Gaussian: ^rndivg^ obs mean sigma
^rndivgx^ [mu], s(#)
Example: rndivg 10000 10 0.05
rndivgx mu, s(0.05)
Note: mu = 1/sqrt(eta)
variance = sigma^2*mu*3
exponential: ^rndexp^ obs shape
Example: rndexp 10000 3
Weibull: ^rndwei^ obs shape scale
Example: rndwei 10000 3 2
Beta binomial: ^rndbb^ obs denom prob k
Example: 10000 200 0.2 0.05
Note: prob= p = a1/(a1+a2)
k = dispersion = 1/(a1+a2+1)
This generator will return beta-binomial random
deviates within the following constraints. Although
k can take any value from 0 to 1, in this program
k is limited because of the volotility of the
distribution outside this range of k. k must be as
follows: k< the lessor of p' and (1-p')/2 where p'=p
if p<0.5, else p'=1-p. This should work well within
the physical representation of an overdispersed binomial.
Generalized logistic: ^rndglog^ obs L A T
(3 parameter) Example: rndglog 10000 3.0 0.7 4.5
Note: L = (long) right hand tail
A = (alpha) left hand tail
T = (time) position parameter
Based on Fit-Meister (W. Linde-Zwirble)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/