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

st: RE: generate a positive-valued random variable


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: generate a positive-valued random variable
Date   Sat, 30 Apr 2005 16:01:29 -0400

I understand an inverse gamma distribution to 
be defined by taking the reciprocals of 
a gamma distribution. It would normally have
either two or three parameters. 

For two parameters, the Hilbe-Linde-Zwirble 
program -rndgamma- offers one solution. Bobby 
Gutierrez's program -gengamma- is more general 
yet, covering both two and three parameter cases. 

Naturally I can't tell you whether this 
particular distribution, out of many defined
to be entirely positive, will do what you 
want. 

Nick 
n.j.cox@durham.ac.uk 

Jun Xu
 
> I am still using Stata 8. I am trying to generate a 
> positive-valued random 
> variable, and I think I should turn to inverse gamma 
> distribution. I am not 
> sure if this is right (with its shape parameter equal to 6):
> 
> gen positivevar = invgamma(6, uniform())
> 
> I tried searching Stata listserv and FAQ and I might have 
> missed it. But I 
> suggest Stata could post some codes for creating commonly used random 
> variables in its online FAQ section. I think that will be 
> great for a lot of intermediate users.

*
*   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/

*
*   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