LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 16 Jun 2000 16:14:34 GMT
Reply-To:   Dale McLerran <dmclerra@FHCRC.ORG>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Dale McLerran <dmclerra@FHCRC.ORG>
Organization:   Fred Hutchinson Cancer Research Center
Subject:   Re: RANGAM(seed,a) problem

Barrere,

A two parameter gamma distribution with shape parameter r and scale parameter lambda is obtained from the rangam function by specifying

x = lambda*rangam(seed,r);

Now, the question is how do lambda and r relate to the mean and variance. The mean mu is r/lambda, while the variance is mu/lambda. Inverting these functions to solve for r and lambda as functions of the mean and variance, we get lambda=mu/var and r=(mu**2)/var. So, to generate a gamma distributed random variate with mean mu and variance var, you would specify

lambda = mu/var; r = mu*lambda; x = lambda*rangam(seed,r);

Hope this helps.

Dale

-------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center Seattle, WA 98109 mailto:dmclerra@fhcrc.org ph: (206) 667-2926 fax: (206) 667-5977 --------------------------------------

bendiabarre@ALTAVISTA.COM (barrere bendia) wrote in <20000616143543.7382.cpmta@c012.sfo.cp.net>:

>Hi > I wante to generate number according gamma distribution > with mean=mu and variance=mu(square) r. > > I tried the functin: RANGAM(seed,a) but what dos mean the > parameter a.,sinct the GAMMA distribution has two > parameters(: mu and nu). > > Can I do like this: > do i=1 to 100; > gama= mu + sqrt(var)*RANGAM(seed,mu); > output; > end; > drop i; > ? > Thank you all.


Back to: Top of message | Previous page | Main SAS-L page