Re: [R] transform normally distributed random terms to gamma distributed random terms

From: Spencer Graves <>
Date: Tue 24 May 2005 - 05:23:47 EST

  1. The help page for ?rgamma says E(g) = shape*scale = shape/rate and var(g) = shape*scale^2 = shape/rate^2. These are different from what I read in your email. Could you please check the help page more carefully?
  2. If this does not solve your problem, PLEASE do read the posting guide! "". Many people answer their own questions in the process of preparing a posting. If they don't find the answer, their question is more likely to elicit useful replies. In particular, please include a brief example explaining why you think "rgamma" won't work for you, nor why something like qgamma(runif(...)) nor qgamma(pnorm(rnorm(...)))?
	  hope this helps.
	  spencer graves

Stefan Pohl wrote:
> Hi,
> I have normally distributed random terms u~N(0,1). I want to get gamma distributed random terms g~(scale,shape) with
> E(g)=1=shape/scale and var(g)=theta=1/scale=1/shape.
> How can I reach my goal? The following way doesn't work: use the distribution function of u to get U(0,1)- distributed random
> terms, then take the quantile function of the gamma distribution with shape and scale.
> The resulting random terms must be ~gamma(shape, scale).
> But it doesn't work.
> Is there a mistake or do you know another way?
> Thanks, Stefan.
> [[alternative HTML version deleted]]
> ______________________________________________
> mailing list
> PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Tue May 24 05:29:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:00 EST