returns
the residuals from the linear mixed-effects model `R`

= residuals(`lme`

,`Name,Value`

)`lme`

with
additional options specified by one or more `Name,Value`

pair
arguments.

For example, you can specify Pearson or standardized residuals, or residuals with contributions from only fixed effects.

Conditional residuals include contributions from both fixed and random effects, whereas marginal residuals include contribution from only fixed effects.

Suppose the linear mixed-effects model `lme`

has
an *n*-by-*p* fixed-effects design
matrix *X* and an *n*-by-*q* random-effects
design matrix *Z*. Also, suppose the *p*-by-1
estimated fixed-effects vector is $$\widehat{\beta}$$, and the *q*-by-1
estimated best linear unbiased predictor (BLUP) vector of random effects
is $$\widehat{b}$$. The fitted conditional response
is

$${\widehat{y}}_{Cond}=X\widehat{\beta}+Z\widehat{b},$$

and the fitted marginal response is

$${\widehat{y}}_{Mar}=X\widehat{\beta},$$

`residuals`

can return three types of residuals:
raw, Pearson, and standardized. For any type, you can compute the
conditional or the marginal residuals. For example, the conditional
raw residual is

$${r}_{Cond}=y-X\widehat{\beta}-Z\widehat{b},$$

and the marginal raw residual is

$${r}_{Mar}=y-X\widehat{\beta}.$$

For more information on other types of residuals, see the `ResidualType`

name-value
pair argument.

Was this topic helpful?