Learn R Programming

lme4 (version 2.0-6)

deviance: Deviance of Fitted Mixed-Effect Models

Description

Calculates the deviance of a model of class merMod. Some important details regarding the calculation of the deviance is found below.

Usage

# S3 method for merMod
deviance(object, REML = NULL, ...)

Arguments

object

an R object of class merMod, i.e., as resulting from lmer(), or glmer(), etc.

REML

Logical. If TRUE, return the restricted log-likelihood rather than the log-likelihood. If NULL (the default), set REML to isREML(object) (see isREML).

...

Optional additional arguments.

Deviance and log-likelihood of GLMMs

One must be careful when defining the deviance of a GLM. For example, should the deviance be defined as minus twice the log-likelihood or does it involve subtracting the deviance for a saturated model? To distinguish these two possibilities we refer to absolute deviance (minus twice the log-likelihood) and relative deviance (relative to a saturated model, e.g. Section 2.3.1 in McCullagh and Nelder 1989).

With GLMMs however, there is an additional complication involving the distinction between the likelihood and the conditional likelihood. The latter is the likelihood obtained by conditioning on the estimates of the conditional modes of the spherical random effects coefficients, whereas the likelihood itself (i.e. the unconditional likelihood) involves integrating out these coefficients. The following table summarizes how to extract the various types of deviance for a glmerMod object:

conditionalunconditional
relativedeviance(object)NA in lme4
absoluteobject@resp$aic()-2*logLik(object)

This table requires two caveats:

  • If the link function involves a scale parameter (e.g. Gamma) then object@resp$aic() - 2 * getME(object, "devcomp")$dims["useSc"] is required for the absolute-conditional case.

  • If adaptive Gauss-Hermite quadrature is used, then logLik(object) is currently only proportional to the absolute-unconditional log-likelihood.

Note that summary() reports the unconditional absolute deviance, -2*logLik(object).

For more information about this topic see the misc/logLikGLMM directory in the package source.