Learn R Programming

skewlmm (version 1.1.3)

residuals: 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 SMN
residuals(object, level = "conditional", type = "response", ...)

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

Value

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

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.

Author

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

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.

See Also

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

Examples

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

Run the code above in your browser using DataLab