RATS 11
RATS 11

Procedures /

GAMMAPARMS Function

Home Page

← Previous Next →

%GammaParms(mean,sd) returns a 2-vector (shape and scale in that order) with the two parameters for a Gamma distribution with the given mean and standard deviation. Note that the RATS functions %loggammadensity(x,a,b) and %rangamma(a) use a parameterization in terms of shape and scale, not degrees of freedom and mean. This returns the a and b appropriate for use with those functions.


Example


(The SOURCE needs to be done only once)

 

source gammaparms.src

compute gparms=%gammaparms(2.5,1.0)

set test 1 1000 = gparms(2)*%rangamma(gparms(1))

set logg 1 1000 = %loggammadensity(test,gparms(1),gparms(2))
 

will create a series named TEST with gammas with (population) mean 2.5 and standard deviation 1.0 and the log density (in LOGG) at each drawn value.


Copyright © 2025 Thomas A. Doan