Parameters |
shape (\(a\)) and scale (\(b\)), alternatively, degrees of freedom (\(\nu \)) and mean (\(\mu \)). The RATS functions use the first of these. The relationship between them is \(a=\nu /2\) and \(b=\dfrac{2\mu {\nu }}\). The chi-squared distribution with \(\nu \) degrees of freedom is a special case with \(\mu =\nu \) |
Kernel |
\(x^{a-1}\exp \left( -\dfrac{x}{b}\right) \) or \(x^{\left(v/2\right) -1}\exp \left( -\dfrac{x\nu }{2\mu }\right) \) |
Support |
\(\left[ 0,\infty \right) \) |
Mean |
\(ba\) or \(\mu \) |
Variance |
\(b^{2}a\) or \(\dfrac{2\mu ^{2}}{\nu }\) |
Main Uses |
Prior, exact and approximate posterior for the precision (reciprocal of variance) of residuals or other shocks in a model. |
Density Function |
%LOGGAMMADENSITY(x,a,b). For the \(\left\{\nu,\mu \right\}\) parameterization, use %LOGGAMMADENSITY(x,.5*nu,2.0*mu/nu) |
Random Draws |
%RANGAMMA(a) draws one or more (depending upon the target) independent Gammas with unit scale factor. Use b*%RANGAMMA(a) to get a draw from \(Gamma(a,b)\). If you are using the \(\left\{\nu ,\mu \right\}\) parameterization, use 2.0*mu*%RANGAMMA(.5*nu)/nu. You can also use mu*%RANCHISQR(nu)/nu. |
Moment Matching |
%GammaParms(mean,sd) (external function) returns the 2-vector of parameters ((a,b) parameterization) for a gamma with the given mean and standard deviation. |
Copyright © 2025 Thomas A. Doan