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

Re: st: RE: Generating random variates


From   [email protected] (Roberto G. Gutierrez, StataCorp.)
To   [email protected]
Subject   Re: st: RE: Generating random variates
Date   Fri, 23 Aug 2002 14:57:57 -0500

Anirban Basu <[email protected]> adds to the continuing thread:

> Thanks to Thomas for pointing out to the sg44.1 package. I did update the
> package from the proper website. Though I ws looking to use my own random
> numbers, these ado files are useful because I can modify them to use my own
> rnd #s quite easily.

> However, out of the many distributions covered by this package, I did not
> find one for negative binomial. I was wondering if anyone has any code to
> generate this distribution. 

A while back I wrote two utilities, -genpoisson- and -gennbreg-, to 
act as a bridge between Hilbe et al. (STB-41) and Stata's estimation 
commands.  These can now be found via

   . net from http://www.stata.com/users/rgutierrez
   . net describe gendist

or soon via -findit genpoisson-, for instance.

For example, if using -rndnbx- to generate random deviates from a negative
binomial distribution, you might type

    . rndnblx mu, k(0.5)

With -gennbreg- the terminology would be similar to what you would 
see in [R] nbreg, 

    . gennbreg y, delta(0.5) dispersion(constant) mu(mean_var)

Both -genpoisson- and -gennbreg- are basically wrappers around Hilbe's
-rndpois-, and -gennbreg- makes use of my -gengamma- also included in the
-gendist- package.  Also included is -geninvgauss- for generating from an
inverse Gaussian distribution.

Again, this is not to duplicate the work of Hilbe, merely to put things into
my own pet parameterizations.  However, those wishing to generate data
specifically for use with -nbreg- or -poisson- may find the above helpful.

--Bobby
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index