RATS 11.1
RATS 11.1

Procedures /

INVGAMMAPARMS Function

Home Page

← Previous Next →

%InvGammaParms(mean,sd) returns a 2-vector (shape and scale in that order) with the two parameters for an inverse Gamma distribution with the given mean and standard deviation.


 

If the s.d. is %NA (infinite), a is 2, which is the largest value of a for which the variance is undefined. Parameters for the closely-related inverse chi-squared can be done with the %INVCHISQRPARMS function.

Example

 

(The SOURCE needs to be done once)

 

source invgammaparms.src

compute igparms=%invgammaparms(2.0,1.0)

set test 1 1000 = igparms(2)/%rangamma(igparms(1))

set logg 1 1000 = -2.0*log(test)+$

 %loggammadensity(1.0/test,igparms(1),1.0/igparms(2))

 

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


 


Copyright © 2026 Thomas A. Doan