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 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=gaussian, 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, including cbind for binomial 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 A dataframe containing the variables in the model, that is optional in simple cases, but required in certain situations as specified elsewhere in this help page.
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, fmr, glm, glm.control, gnlmix, gnlmm, gnlr, gnlr3, hnlmix, nls.

Examples

# Poisson counts
nest <- gl(5,4)
y <- rpois(20,5+2*as.integer(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)
#
# binomial data with model for overdispersion
df <- data.frame(r=rbinom(10,10,0.5), n=rep(10,10), x=c(rep(0,5),
        rep(1,5)), nest=1:10)
glmm(cbind(r,n-r)~x, family=binomial, nest=nest, data=df)

[Package repeated version 1.0 Index]