# glmmADMB: Mixed models for discrete data in R -- powered by AD Model Builder
Installing and using glmmADMB in R
Under windows: Download glmmADMB.zip. On the "Packages" menu in R, choose "Install package(s) from local zip file..." Under linux: Download glmmADMB_0.3.tar.gz. Consult the R Installation and Administration manual on how to install the package. Using the package in R: library("glmmADMB") to load the package into R help("glmm.admb") and see example at the bottom of the help page. Note that the ADMB-RE executables create temporary files (sometimes large), so you should start R in a specially dedicated directory.

Source code
Source code: glmmADMB includes two binaries ("nbmm" and "bvprobit"). On request from R-users we make the (AD Model Builder) source code for these available here: nbmm.tpl and bvprobit.tpl. (In order to compile the tpl-files you need to buy AD Model Builder.)

ADMB User Forum
Questions relating to the R-package should be posted to the ADMB user forum under the topic "ADMB NBMM for R"

Navigation
ADMB-RE home Otter Research

Zero-inflation and overdispersion currently receive much attention in the statistical literature, e.g:
For count responses, the situation of excess zeros (relative to what standard models allow) often occurs in biomedical and sociological applications. Modeling repeated measures of zero-inflated count data presents special challenges. This is because in addition to the problem of extra zeros, the correlation between measurements upon the same subject at different occasions needs to be taken into account.

Min and Agresti (2005), Statistical modelling

The R-package `glmmADMB` provides a GLMM framework (in the spirit of `glmmPQL` and `GLMM`) with:

- Negative binomial or Poisson responses.
- Zero-inflation, e.g. a mixture of a Poisson or negative binomial distribution and a point mass at zero.

In addition it is possible to fit data with Bernoulli response (0 or 1):

- Logistic or probit link function

`glmmADMB` is developed using ADMB-RE, but the full unrestricted R-package is made freely available and does not require ADMB-RE to run with user supplied data.

## Likelihood approximation

By default `glmm.admb()` uses the Laplace approximation, which is beleived to be superior to the PQL method used by other mixed model routines in R. Hence, the likelihood values returned by `glmm.admb()` can be used construct the AIC criterion for model comparison, and to perform likelihood ratio tests. For situations where the Laplace approximation is not accurate enough, importance sampling is an option of `glmm.admb()`.

## Beyond the standard GLMM framework

ADMB-RE provides a full programming language for random effects modeling. The code for `glmmADMB` is nbmm.tpl. Using ADMB-RE it is easy to modify `nbmm.tpl` to non-standard situations, such as:

- zero-inflation with P(zero) depending on covariates.
- Distributions of different types: e.g. response (X,Y) with X Bernoulli and Y Poisson.
- Crossed random effects.

Details and examples of how to build ADMB-RE programs can be found here: user manual.