residuals: Extract model residuals from smn.lmm and smsn.lmm objects

residualsR Documentation

Extract model residuals from smn.lmm and smsn.lmm objects

Description

The conditional residuals are obtained by subtracting the fitted values from the response vector, while the marginal residuals are obtained by subtracting only the fixed effects from the response vector.

Usage

## S3 method for class 'SMN'
residuals(object, level = "conditional", type = "response", ...)

## S3 method for class 'SMSN'
residuals(object, level = "conditional", type = "response", ...)

Arguments

object

An object inheriting from class SMN or SMSN, representing a fitted scale mixture of (skew) normal linear mixed model.

level

Either "conditional", for obtaining conditional residuals, or "marginal", for marginal residuals.

type

An optional character string specifying the type of residuals to be used. If "response", as by default, the "raw" residuals (observed - fitted) are used; if "normalized", the standardized residuals (residuals pre-multiplied by the inverse square-root of the estimated variance matrix) are used; else, if "modified", modified residuals (residuals pre-multiplied by the inverse square-root of the estimated scale matrix) are used.

...

Additional arguments.

Details

Modified residuals are useful when the variance is not finite, such as when \nu \le 2 for t or ST distributions, or when \nu \le 1 for SL or SSL distributions.

Value

Vector with the residuals of length equal to nrow(data).

Author(s)

Fernanda L. Schumacher, Larissa A. Matos and Victor H. Lachos

See Also

smn.lmm, smsn.lmm, acfresid, mahalDist, healy.plot

Examples

fm1 = smn.lmm(distance ~ age+Sex, data=nlme::Orthodont, groupVar="Subject")
residuals(fm1)
plot(fm1, useweight=FALSE)

skewlmm documentation built on July 9, 2023, 7:29 p.m.