residuals.glmmTMB: Compute residuals for a glmmTMB object

View source: R/methods.R

residuals.glmmTMBR Documentation

Compute residuals for a glmmTMB object

Description

Compute residuals for a glmmTMB object

Usage

## S3 method for class 'glmmTMB'
residuals(
  object,
  type = c("response", "pearson", "working", "deviance", "dunn-smyth"),
  re.form = NULL,
  ...
)

## S3 method for class 'glmmTMB'
deviance(object, ...)

Arguments

object

a “glmmTMB” object

type

(character) residual type

re.form

NULL to specify individual-level predictions; ~0 or NA to specify population-level predictions (i.e., setting all random effects to zero)

...

for method compatibility (unused arguments will throw an error)

Details

  • Residuals are computed based on predictions of type "response", i.e. equal to the conditional mean for non-zero-inflated models and to mu*(1-p) for zero-inflated models

  • Computing deviance residuals depends on the implementation of the dev.resids function from the object's family component; at present this returns NA for most "exotic" families (i.e. deviance residuals are currently only implemented for families built into base R plus nbinom1, nbinom2). Deviance residuals are based on the conditional distributions only, i.e. ignoring zero-inflation components.

  • Deviance is computed as the sum of squared deviance residuals, so is available only for the families listed in the bullet point above. See deviance.merMod for more details on the definition of the deviance for GLMMs.


glmmTMB documentation built on Sept. 30, 2024, 9:34 a.m.