glmm {repeated}R Documentation

Generalized Linear Mixed Models

Description

glmm fits a generalized linear mixed model with a random intercept using a normal mixing distribution computed by Gauss-Hermite integration. For the normal, gamma, and inverse Gaussian distributions, the deviances supplied are -2 log likelihood, not the usual glm deviance; the degrees of freedom take into account estimation of the dispersion parameter.

If weights and/or offset are to be used or the formula transforms the some variables, all of the data must be supplied in a dataframe. Because the glm function is such a hack, if this is not done, weird error messages will result.

na.omit is not allowed.

Usage

glmm(formula, family=family, data=list(), weights=NULL, offset=NULL,
        nest, delta=1, maxiter=20, points=10, print.level=0,
        control=glm.control(epsilon=0.0001,maxit=10,trace=FALSE))

Arguments

formula A symbolic description of the model to be fitted. If it contains transformations of the data, a dataframe must be supplied.
family A description of the error distribution and link function to be used in the model; see family for details.
data An optional dataframe containing the variables in the model.
weights An optional weight vector. If this is used, data must be supplied in a data.frame.
offset The known component in the linear predictor. If this is used, data must be supplied in a data.frame. An offset cannot be specified in the model formula.
nest The variable classifying observations by the unit (cluster) upon which they were observed.
delta If the response variable has been transformed, this is the Jacobian of that transformation, so that AICs are comparable.
maxiter The maximum number of iterations of the outer loop for numerical integration.
points The number of points for Gauss-Hermite integration of the random effect.
print.level If set equal to 2, the log probabilities are printed out when the underflow error is given.
control A list of parameters for controlling the fitting process.

Value

glmm returns a list of class glmm

Author(s)

J.K. Lindsey

See Also

family, glm, glm.control, gnlmm, gnlr, gnlr3, fmr

Examples

nest <- gl(5,4)
y <- rpois(20,5+2*codes(nest))
# overdispersion model
glmm(y~1, family=poisson, nest=gl(20,1), points=3)
# clustered model
glmm(y~1, family=poisson, nest=nest, points=3)

[Package Contents]