Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Carlo Lazzaro" <carlo.lazzaro@tin.it> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: R: How to generate a random variable with PDF gamma(a,b,g,x) |

Date |
Tue, 14 Jun 2011 07:18:20 +0200 |

Dear Tiago, using Stata 9.s/SE, the following chunk of code may do what you want: ---------------------------------------------------------------------- set obs 100 g A= gammaden(3,0.04,0.80,uniform()) ---------------------------------------------------------------------- Kindest Regards, Carlo -----Messaggio originale----- Da: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Tiago V. Pereira Inviato: lunedì 13 giugno 2011 22.22 A: statalist@hsphsun2.harvard.edu Oggetto: st: How to generate a random variable with PDF gamma(a,b,g,x) Dear Statalisters, I would like to generate a gamma random variable with probability density function given by gamma(a,b,g,x) where a = 3 (shape), b = 0.04 (scale), g = 0.80 (location). I believe that the trick is to generate x correctly from a uniform distribution, since I am looking at x>g only. Any suggestions? All the best, Tiago * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: How to generate a random variable with PDF gamma(a,b,g,x)***From:*"Tiago V. Pereira" <tiago.pereira@mbe.bio.br>

- Prev by Date:
**Re: st: Merge by range of values** - Next by Date:
**st: Internal Rate of Return Calculation** - Previous by thread:
**st: How to generate a random variable with PDF gamma(a,b,g,x)** - Next by thread:
**st: marginal effects in biprobit** - Index(es):