Skip to content

ADMB examples including datafiles and explanations.

Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation


All examples — ADMB Project

All examples currently available in the website

"Maximum likelihood estimation and inference" by Russell Millar

A discrete valued time series model; Polio data : Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response

A discrete valued time series model; Polio data : Illustrate how a time series of count data can be modelled as a GLMM with a Poisson response

A fisheries model with random effects : Catch-age model from Schnute and Richards (1995) with annual recruitments as random effects.

A standard CJS model : Fitting Cormack-Jolly-Seber (CJS) Models to Capture-Recapture Data using R2admb

Adjoint code : Why to write adjoint code and alternative approaches to do it.

Baranov catch equation : Example by Steven Martell of writing adjoint code in ADMB to numerically solve the Baranov catch equation. A simple simulation model is used to generate simulated catch and relative abundance data with observation error only. The assessment model is then conditioned on the simulated catch data.

BCB bowheads : Abundance estimation of BCB bowhead whales

Beta-binomial model : Binomial response with random effects having beta distribution. Comparison to Winbugs and h-GLM

By field of application

Categorical data

CJS Individual Heterogeneity : Mixed Effects Cormack-Jolly-Seber Models for Analysis of Capture-Recapture Data

CJS Models : Cormack-Jolly-Seber (CJS) models in different variations

Comparison of approaches : Three different implementations of the same model with separable spatial covariance function in a fully Gaussian situation: i) Plain ADMB (non-random effect) ii) Geostatistical formulation iii) Hybrid approach.

Count data : Poisson, negative binomial counts in various variants

Covariance Calculations : A short document with accompanying R code that details (1) the functions used to bound parameters, (2) the method for calculating a bounded covariance matrix, and (3) what is stored in the binary admodel.hes and admodel.cov files and how the user can utilize this information to gain more control over an MCMC chain.

Covariance in RE models

Covariance matrices : How to parameterize a covariance matrix

Delta smelt life cycle model : A state-space multistage model to evaluate population impacts in the presence of density dependence.

Diet and heart disease : Continuous and discrete observation sharing being influenced by a latent random variable

Differential equations

Eilers & Marx parameterization : Parameterization of the spline from Eilers & Marx (1996)

Estimation of detection function : Illustrates the likelihood based estimation of the detection function (perpendicular distance)

Extension: correlated RE's : Add random effects to all 3 phi's, and attempt to estimate correlations

Extension: crossed RE's : Adds a "day effect" following Millar (2004, Aust NZ J. Stat, 46, p. 543-554)

Fisheries : Different uses of ADMB in fisheries stock assessments or other fisheries work

Flexible negative binomial : Explores non-standard relationships between mean and variance in the NB model

Function minimizer : Various tricks and techniques related to the function minimizer to improve convergence

Gamma distributed myxomatosis using R2admb

GAMs as mixed models : Generalized Additive Models

Gaussian models : Models where both the response and latent random variable are Gaussian. For such models the covariance matrix of the observations can be worked out analytically, but still the latent variable (random effect) formulation can be beneficial.

Geostatistical approach : The approach to spatial modeling where you explicitly model the covariance function/matrix. First used in geology/mining (hence the name). Can be used with both Gaussian and non-Gaussian response for data.



Growth models

Item response theory : The multilevel Rasch model can be implented using random effects in ADMB. As an example we use data on the responses of 2042 soldiers to a total of 19 items (questions), taken from Doran et al (2007). This illustrates the use of crossed random effects in ADMB. Further, it is shown how the model easily can be generalized in ADMB. These more general models cannot be fitted with standard GLMM software such as "lmer" in R.

Line transect methods : Line transect methods are commonly used to estimate animal abundance, and is a special case of distance sampling.

lmer() comparison : Application of ADMB to the simulated datasets in Zhang et al. (2011) with emphasis on comparison to the R function lmer()


Math : Various undocumented techniques and tricks useful for developing ADMB programs

MCMCMC : This presents generalized code for conducting Metropolis Coupled MCMC using ADMB called within R

Mean and variance : Both mean and variance vary smoothly as functions of a covariate

MGRF: simple CAR model : CAR model for the Scottish Lip Cancer Data

Mineralization of terbuthylazine : A simple nonlinear least-squares problem, with normally distributed residuals and no random effects or latent variables. Example from the NCEAS non-linear modelling working group.

Miscellaneous : Stuff that is hard to categorize, but still is useful

Mixed response : Models with responses of different types

Negative Binomial Fir Fecundity :

Negative binomial serially correlated counts : Compares a negative binomial response to Poisson responses for the polio data

Non Gaussian random effects : ADMB allows non-Gaussian random effects via transformation of a normal variate

Occupancy model : Comparison of ADMB and WinBUGS modelling approach for simple occupancy model. This is also a comparison of Bayesian and frequentist modelling.

One-compartment open model : Fit mixed effects model to the classical "phenopharbital" model

Orange trees

Ordered categorical responses : Ordered categorical responses with application to SOCATT data

Owl nestling negotiation : Zero-inflated generalized linear mixed model example from the NCEAS non-linear modelling working group.

Parameter scaling : Shows how to scale parameters so that they become of the same magnitude

Parameterization : Examples of how to (and not to) parameterize mathematical functions and statistical models

Pella-Tomlinson basic model : Pella-Tomlinson by Arni Magnusson with user interface and formatted MCMC output. Repeats and extends the analysis of Polacheck et al. (1993).

Pella-Tomlinson from ADMB manual : Pella-Tomlinson example by Dave Fournier from the ADMB manual. Demonstrates several innovative modelling approaches: 6 month time step, time-varying K and q.

PK/DK : Pharmacokinetics (PK) & Pharmacodynamics(DK)

Poisson GLMM : An example of the geostatistical approach to spatial modelling. The response distribution is Poisson with an isotropic correlation function r(d), where "d" is the distiance between two locations.

R - ADMB interface for mixed models : Explains how to set up a general mixed model interface between R and ADMB used for instance in glmmADMB

R stuff

Random scale : Distance Sampling with Random Scale Detection Function

Sampling : Survey sampling related examples

Separable: Method explanation : It has for a long time been possible to fit GLMMs (Generalized Linear Mixed Models) in ADMB-RE. A typical example is correlated count data with Poisson distribution. However, when the observation are located on a spatial grid the number of latent variables (random effects in the ADMB-RE terminology) grows quadratically in the number of grid points in each geographical direction. The large number of random effects causes a computational challenge.

Simple examples

Skate mortality: Bayesian state-space model : Bayesian state-space model example from the NCEAS non-linear modelling working group

Spatial models : ADMB supports both the geostatistical approach and Gaussian Markov random field approach to spatial modelling

Splines : Different aspects of spline models

Splines I : notes and examples related to cubic splines

State-space models

Stochastic volatility collection

Stochastic volatility models for financial time series : Stochastic volatility models are used in mathematical finance to describe the evolution of asset returns, which typically exhibit changing variances over time.

Survival analysis : Lifetime data and survival analysis

SV models with leverage effect

Tadpole mortality as a function of size : A maximum likelihood estimation problem with a binomial response variable, example from the NCEAS non-linear modelling working group.

Text books : Collections of examples taken from text books

The basic SV model and simple extensions : Beskrivelse av innhold. Kan droppes?

Theta-logistic population growth model : State-space model from the NCEAS non-linear modelling working group

Variance calculations : How variance is calculated in ADMB

Weibull regression with censoring

Wildflowers : A binomial generalized linear mixed model example from the NCEAS non-linear modelling working group.

WinBUGS : Comparison with the software package WinBUGS

Wood (2006) parameterization : Parameterization via the eigen vectors of the penalty matrix (Wood 2006, Section 6.6.1).


ADMB examples including datafiles and explanations.






No releases published


No packages published