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

RE: st: RE: generate a positive-valued random variable

From   "Jun Xu" <>
Subject   RE: st: RE: generate a positive-valued random variable
Date   Sat, 30 Apr 2005 07:10:05 -0500


Thanks a lot!


From: "Nick Cox" <>
To: <>
Subject: st: RE: generate a positive-valued random variable
Date: Sat, 30 Apr 2005 12:53:11 +0100

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


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:
Express yourself instantly with MSN Messenger! Download today - it's FREE!

* For searches and help try:

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