Fits GLMMs with simple random effects structure via Breslow and Clayton's PQL algorithm. The GLMM is assumed to be of the form where \(g\) is the link function, is the vector of means and are design matrices for the fixed effects and random effects respectively. Furthermore the random effects are assumed to be i.i.d. .
glmmPQL(
fixed,
random = NULL,
family = "binomial",
data = NULL,
subset = NULL,
weights = NULL,
offset = NULL,
na.action = NULL,
start = NULL,
etastart = NULL,
mustart = NULL,
control = glmmPQL.control(...),
sigma = 0.1,
sigma.fixed = FALSE,
model = TRUE,
x = FALSE,
contrasts = NULL,
...
)
a formula for the fixed effects.
a design matrix for the random effects, with number of rows
equal to the length of variables in formula
.
a description of the error distribution and link function to
be used in the model. This can be a character string naming a family
function, a family function or the result of a call to a family function.
(See family()
for details of family functions.)
an optional data frame, list or environment (or object coercible
by as.data.frame()
to a data frame) containing the variables in
the model. If not found in data
, the variables are taken from
environment(formula)
, typically the environment from which
glmmPQL
called.
an optional logical or numeric vector specifying a subset of observations to be used in the fitting process.
an optional vector of ‘prior weights’ to be used in the fitting process.
an optional numeric vector to be added to the linear predictor
during fitting. One or more offset
terms can be included in the
formula instead or as well, and if more than one is specified their sum is
used. See model.offset()
.
starting values for the parameters in the linear predictor.
starting values for the linear predictor.
starting values for the vector of means.
a list of parameters for controlling the fitting process.
See the glmmPQL.control()
for details.
a starting value for the standard deviation of the random effects.
logical: whether or not the standard deviation of the random effects should be fixed at its starting value.
logical: whether or not the model frame should be returned.
logical: whether or not the design matrix for the fixed effects should be returned.
an optional list. See the contrasts.arg
argument of
model.matrix()
.
arguments to be passed to glmmPQL.control()
.
An object of class "BTglmmPQL"
which inherits from
"glm"
and "lm"
:
a named vector of
coefficients, with a "random"
attribute giving the estimated random
effects.
the working residuals from the final iteration of the IWLS loop.
the design matrix for the random effects.
the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.
the numeric rank of the fitted linear model.
the family
object used.
the linear fit on link scale.
up to a constant, minus twice the maximized log-likelihood.
a version of Akaike's An Information Criterion, minus
twice the maximized log-likelihood plus twice the number of parameters,
computed by the aic
component of the family.
the deviance for the null model, comparable with
deviance
.
the numer of iterations of the PQL algorithm.
the working weights, that is the weights in the final iteration of the IWLS loop.
the weights initially
supplied, a vector of 1
's if none were.
the residual degrees of freedom.
the residual degrees of freedom for the null model.
if requested (the default) the y
vector
used. (It is a vector even for a binomial model.)
if requested, the model matrix.
if requested (the default), the model frame.
logical. Was the PQL algorithm judged to have converged?
the matched call.
the formula supplied.
the terms
object used.
the
data
argument used.
the offset vector used.
the value of the control
argument used.
(where relevant) the contrasts used.
(where relevant) a record of the levels of the factors used in fitting.
(where relevant) information returned by model.frame
on the special handling of NA
s.
the estimated standard deviation of the random effects
logical: whether or not
sigma
was fixed
the variance-covariance matrix of the fixed effects
the variance of sigma
Breslow, N. E. and Clayton, D. G. (1993) Approximate inference in Generalized Linear Mixed Models. Journal of the American Statistical Association 88(421), 9--25.
Harville, D. A. (1977) Maximum likelihood approaches to variance component estimation and to related problems. Journal of the American Statistical Association 72(358), 320--338.
# NOT RUN {
###############################################
## Crowder seeds example from Breslow & Clayton
###############################################
summary(glmmPQL(cbind(r, n - r) ~ seed + extract,
random = diag(nrow(seeds)),
family = "binomial", data = seeds))
summary(glmmPQL(cbind(r, n - r) ~ seed*extract,
random = diag(nrow(seeds)),
family = "binomial", data = seeds))
# }
Run the code above in your browser using DataLab