residuals.merMod: residuals of merMod objects

residuals.merModR Documentation

residuals of merMod objects

Description

residuals of merMod objects

Usage

  ## S3 method for class 'merMod'
 residuals(object,
    type = if (isGLMM(object)) "deviance" else "response",
    scaled = FALSE, ...)

  ## S3 method for class 'lmResp'
 residuals(object,
    type = c("working", "response", "deviance", "pearson", "partial"),
    ...)

  ## S3 method for class 'glmResp'
 residuals(object,
    type = c("deviance", "pearson", "working", "response", "partial"),
    ...)

Arguments

object

a fitted [g]lmer (merMod) object

type

type of residuals

scaled

scale residuals by residual standard deviation (=scale parameter)?

...

additional arguments (ignored: for method compatibility)

Details

  • The default residual type varies between lmerMod and glmerMod objects: they try to mimic residuals.lm and residuals.glm respectively. In particular, the default type is "response", i.e. (observed-fitted) for lmerMod objects vs. "deviance" for glmerMod objects. type="partial" is not yet implemented for either type.

  • Note that the meaning of "pearson" residuals differs between residuals.lm and residuals.lme. The former returns values scaled by the square root of user-specified weights (if any), but not by the residual standard deviation, while the latter returns values scaled by the estimated standard deviation (which will include the effects of any variance structure specified in the weights argument). To replicate lme behaviour, use type="pearson", scaled=TRUE.


lme4 documentation built on July 3, 2024, 5:11 p.m.