glmmPQL: PQL Estimation of Generalized Linear Mixed Models

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/glmmPQL.R

Description

Fits GLMMs with simple random effects structure via Breslow and Clayton's PQL algorithm. The GLMM is assumed to be of the form g(μ) = + Ze where g is the link function, μ is the vector of means and X, Z are design matrices for the fixed effects β and random effects e respectively. Furthermore the random effects are assumed to be i.i.d. N(0, σ2).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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,
  ...
)

Arguments

fixed

a formula for the fixed effects.

random

a design matrix for the random effects, with number of rows equal to the length of variables in formula.

family

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.)

data

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.

subset

an optional logical or numeric vector specifying a subset of observations to be used in the fitting process.

weights

an optional vector of ‘prior weights’ to be used in the fitting process.

offset

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().

na.action

a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options(), and is na.fail() if that is unset.

start

starting values for the parameters in the linear predictor.

etastart

starting values for the linear predictor.

mustart

starting values for the vector of means.

control

a list of parameters for controlling the fitting process. See the glmmPQL.control() for details.

sigma

a starting value for the standard deviation of the random effects.

sigma.fixed

logical: whether or not the standard deviation of the random effects should be fixed at its starting value.

model

logical: whether or not the model frame should be returned.

x

logical: whether or not the design matrix for the fixed effects should be returned.

contrasts

an optional list. See the contrasts.arg argument of model.matrix().

...

arguments to be passed to glmmPQL.control().

Value

An object of class "BTglmmPQL" which inherits from "glm" and "lm":

coefficients

a named vector of coefficients, with a "random" attribute giving the estimated random effects.

residuals

the working residuals from the final iteration of the IWLS loop.

random

the design matrix for the random effects.

fitted.values

the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.

rank

the numeric rank of the fitted linear model.

family

the family object used.

linear.predictors

the linear fit on link scale.

deviance

up to a constant, minus twice the maximized log-likelihood.

aic

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.

null.deviance

the deviance for the null model, comparable with deviance.

iter

the numer of iterations of the PQL algorithm.

weights

the working weights, that is the weights in the final iteration of the IWLS loop.

prior.weights

the weights initially supplied, a vector of 1's if none were.

df.residual

the residual degrees of freedom.

df.null

the residual degrees of freedom for the null model.

y

if requested (the default) the y vector used. (It is a vector even for a binomial model.)

x

if requested, the model matrix.

model

if requested (the default), the model frame.

converged

logical. Was the PQL algorithm judged to have converged?

call

the matched call.

formula

the formula supplied.

terms

the terms object used.

data

the data argument used.

offset

the offset vector used.

control

the value of the control argument used.

contrasts

(where relevant) the contrasts used.

xlevels

(where relevant) a record of the levels of the factors used in fitting.

na.action

(where relevant) information returned by model.frame on the special handling of NAs.

sigma

the estimated standard deviation of the random effects

sigma.fixed

logical: whether or not sigma was fixed

varFix

the variance-covariance matrix of the fixed effects

varSigma

the variance of sigma

Author(s)

Heather Turner

References

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.

See Also

predict.BTglmmPQL(),glmmPQL.control(),BTm()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
###############################################
## 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))

BradleyTerry2 documentation built on Feb. 3, 2020, 5:08 p.m.