Gamma distributed random effects



ADMB Files
Code: liver_gamma.tpl
Data: liver_gamma.dat
Initial values: liver_gamma.pin
All required files (DOS): liver_gamma.zip
All required files (linux): liver_gamma.tar.gz
Results: liver_gamma.par

Running ADMB-executables
In a DOS window
Under linux


Navigation
ADMB-RE home
Otter Research

Model description

It is customary to use normally distributed random effects, but in some situations other distributions than the normal are required. We shall here illustrate the use of gamma distributed random effects in ADMB-RE.

The problem with non-Gaussian random effects is that the Laplace approximation underlying ADMB-RE may be inaccurate. To avoid this we start out with N(0,1) distributed random variables (r.v.), which are transformed into gamma distributed r.v., via the inverse cumulative distribution function for the gamma distribution. The steps are:

u ~ N(0,1) is the underlying random effect.
z = F(u), is uniformly distributed, where F() is cumulative distribution function of u.
g = G_inv(z), where G_inv() is the inverse cumulative distribution function of the target gamma distribution.

As a result, g will be a variable, with a gamma distribution, that can be used in the model.

As an example, and to test the accuracy of the Laplace approximation, we use the negative binomial distribution. It is well known that the following mixture model :

Y | lambda ~ Poisson(lambda)
lambda = mu*g
g ~ gamma(a,a)

induces a negative binomial distribution on Y, with expectation E(Y) = mu and variance var(Y) = mu(1 + mu/a). The tpl-file in the box to the left implements this model using the above trick for generating g. Since we know exactly the distribution of Y in this case we can check the accuracy of the Laplace approximation. For the epilepsy data from Venables and Ripley Modern applied statics with S 4th edition, we got
gamma r.e.'s Exact (neg. binom)
mu 8.23 0.910
a 8.25 0.900

This shows that the Laplace approximation is very accurate in this case.

Beta distribution

It is possible to generate beta-distributed random effects in a similar fashion.