| deviance | R Documentation |
Calculates the deviance of a model of class merMod. Some important details regarding the calculation of the deviance is found below.
## S3 method for class 'merMod'
deviance(object, REML = NULL, ...)
object |
an R object of class |
REML |
Logical. If |
... |
Optional additional arguments. |
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:
| conditional | unconditional | |
| relative | deviance(object) | NA in lme4 |
| absolute | object@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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.