Re: [R] Inverse gamma

From: Alberto Monteiro <albmont_at_centroin.com.br>
Date: Fri, 18 May 2007 09:31:19 -0200

Patrick Wang wrote:
>
> assume I need to generate X from inverse gamma with parameter (k,
> beta).
>
> should I generate from Y from gamma(-k, beta),
>
> then take X=1/Y?
>
Check the Borg of All Wisdom...
http://en.wikipedia.org/wiki/Inverse-gamma_distribution

Generate Y from gamma(k, 1/beta) (using...   rgamma(n = number.of.points, shape = k, scale = 1/beta) ... or ...
  rgamma(n = number.of.points, shape = k, rate = beta) ) and take X = 1/Y

(unless your beta is not the rate parameter...)

Alberto Monteiro



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 May 2007 - 11:37:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 May 2007 - 12:31:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.