Description Usage Arguments Details Value Note References See Also Examples
Fits (extended) generalized linear mixed-effects models to data using a variety of distributions and link functions, including zero-inflated models.
1 2 3 4 5 6 7 8 |
formula |
a two-sided linear formula describing the
part of the model. The response, which may be a numeric vector
(for most models) or a matrix (for binomial models)
is on the left of a |
data |
a data frame containing the variables named in |
family |
a string determining the response distribution: currently implemented options (and default link functions) are
|
link |
a string specifying the link function:
currently implemented options are
|
start |
an (optional) named list specifying starting values, with (optional) components
|
random |
a formula specifying the random effects.
A single random effect may be specified as |
corStruct |
a string specifying the covariance structure of the
random effects vector. Two types of covariance matrices are
currently implemented: |
easyFlag |
(currently inactive: whether a faster but less robust optimization
algorithm should be employed (only |
zeroInflation |
whether a zero-inflated model should be fitted
(only |
admb.opts |
options for AD Model Builder: see |
mcmc |
(logical) run MCMC after fitting, based on estimated mode and parameter variance-covariance matrix |
mcmc.opts |
list of options for MCMC run: see |
save.dir |
Optionally, a directory name where all ADMB output
files are saved. If |
verbose |
(logical) Print interim output from AD Model Builder run? |
extra.args |
(character) extra arguments to AD Model Builder (see ADMB manual) |
bin_loc |
location of |
debug |
(logical) print debugging statements? |
... |
arguments to pass through to |
For advice on troubleshooting, see admbControl
.
Parameterization of the negative binomial distribution:
for family=="nbinom"
:
Var(Y) = E(Y) * (1 + E(Y)/alpha)
(i.e. Hardin and Hilbe NB2; alpha
corresponds to the size
parameter in
dnbinom
)
for family=="nbinom1"
:
Var(Y) = E(Y) * alpha
(i.e. Hardin and Hilbe NB1: alpha
corresponds to the scale
parameter in a quasi-Poisson model)
Parameterization of the beta-binomial distribution: as in Morris (1997), in terms of N (number of trials), p (per-trial probability, determined by the inverse-link function applied to the linear predictor), alpha (overdispersion parameter: as alpha becomes large, the distribution converges to binomial). The density function is
p(x) = (C(N,x)*Beta(N-x+theta*(1-p),x+theta*p))/Beta(theta*(1-p),theta*p)
.
Zero-inflation: With probability 1-pz, Y comes from a Poisson (or negative binomial) distribution, and with probability pz, Y is zero (Bohning et al. 1999).
Parameters are estimated by maximum likelihood, using the Laplace
approximation to evaluate the marginal likelihood.
When impSamp >0
,
importance sampling is used to improve the Laplace approximation
(Skaug and Fournier 2006).
Due to technical limitations, offset expressions can
contain at most one internal set of parentheses; i.e.
offset(log(x))
works, but offset((log(x)))
will not.
If necessary, define a new variable in the data frame, e.g.
mydata$myoffset <- with(mydata,log(3*exp(x)))
.
Internally, glmmADMB works with an orthogonalized version of
the fixed-effect design matrix. The phi
matrix returned in the results can
be used to convert from orthogonalized to 'real' fixed parameters,
i.e. b_real == b_orth %*% phi
or b_orth = b_real
%*% solve(phi).
Fixed effects specified in the starting values
are automatically orthogonalized.
If you are specifying starting values from a different GLMM
fit for more than the fixed-effect parameters, you may want to use
extra.args="-phase 5"
to skip over the estimation phase where
ADMB fits the model without random effects.
An object of class "glmmadmb"
representing the model fit,
including (among others) components:
b |
vector of fixed effects |
S |
covariance matrix of random effects |
alpha |
scale/overdispersion parameter (negative binomial, Gamma, beta) |
pz |
Zero-inflation parameter (only when
|
phi |
Matrix for converting from 'orthogonalized' to 'real' parameters: see Details |
glmm.admb
is defined for backward compatibility; it will be removed in a future version.
Tools for working with MCMC output are preliminary; see mcmcControl
or the vignette for more information.
Bohning, D., E. Dietz, and P. Schlattmann. 1999. The zero-inflated Poisson model and the decayed, missing and filled teeth index in dental epidemiology. Journal of the Royal Statistical Society. Series A (Statistics in Society) 162:195–209.
Skaug, H.J. and D.A. Fournier. 2006. Automatic approximation of the marginal likelihood in non-Gaussian hierarchical models. Computational Statistics & Data Analysis 51:699–709.
Morris, W. 1997. American Naturalist 150:299-327
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Australian H. influenzae data from MASS
data(bacteria,package="MASS")
bacteria$present <- as.numeric(bacteria$y)-1
if (!check_rforge())
(bfit <- glmmadmb(present ~ trt + I(week > 2), random = ~ 1 | ID,
family = "binomial", data = bacteria))
## simple simulated zero-inflated Poisson example
### simulate values
set.seed(101)
d <- data.frame(f=factor(rep(LETTERS[1:10],each=10)),x=runif(100))
u <- rnorm(10,sd=2)
d$eta <- with(d,u[f]+1+4*x)
pz <- 0.3
zi <- rbinom(100,size=1,prob=pz)
d$y <- ifelse(zi,0,rpois(100,lambda=exp(d$eta)))
## fit
## Not run:
zipmodel <- glmmadmb(y~x+(1|f),data=d,family="poisson",zeroInflation=TRUE)
## End(Not run)
## Not run:
## Epilepsy data
## all grouping variables must be factors:
epil2$subject <- factor(epil2$subject)
(fm <- glmmadmb(y~Base*trt+Age+Visit+(Visit|subject),
data=epil2, family="nbinom"))
## Owls data
om <- glmmadmb(SiblingNegotiation~FoodTreatment*SexParent+
(1|Nest)+offset(log(BroodSize)),
zeroInflation=TRUE,family="nbinom",data=Owls)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.