Re: [R] Inverse gamma

From: Alberto Monteiro <>
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...

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 mailing list PLEASE do read the posting guide 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 Please read the posting guide before posting to the list.