Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Random Number generator


From   rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp.)
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: Random Number generator
Date   Fri, 11 Oct 2002 17:11:29 -0500

Anirban Basu <abasu@midway.uchicago.edu> asks:

> The macro written by Joe Hilbe on generating random variates of a negative
> binomial distribution has the sytax of :  rndnblx mu, k(#)

> However, I did not find any documentation about the parametrization of 'k'.
> Generally the variance of NB is given by mu*(1+ alpha*mu). Here 'k' does not
> seem to be equal or even inverse of alpha.

> I ran nbreg on the data generated by the rndnblx. The value of alpha
> estimated is quite different than that of the 'k' I specified. For example,

> if I specify k= 0.5, alpha is estimated as around 0.06
> if I specyfy k=1, alpha is estimated to be around 0.30...

> Does anyone know the parametrization of k in terms of the variance function
> of the negative binomial distribution.

Have a look at 

  . findit gendist

which will point you to some utilities I wrote for generating data for use
with particular Stata estimations commands, -nbreg- begin one of them.

If you want to generate data for use with -nbreg-, then -gennbreg- from that
package is all you need.  If you really want the details of the
parameterization, then you can inspect the code in gennbreg.ado and email me
privately if you have any questions.

--Bobby
rgutierrez@stata.com
*
*   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/



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