compute_redres: Compute residuals for a linear mixed model

Description Usage Arguments Details Value Examples

View source: R/compute_redres.R

Description

Computes residuals for a given linear mixed model.

Usage

1
compute_redres(model, type = "raw_cond")

Arguments

model

Model fit using lmer from lme4.

type

String identifying type of residual. Default is "raw_cond". See details for the options available.

Details

Residual types available:

See the vignette for details on how residual types are computed.

Value

Returns a vector of residuals according to type specified. Residuals appear in the same order as the observations used to fit the model.

Examples

1
2
3
4
5
6
7
8
9
# fits a linear mixed effects model
library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)

# computes the default residuals (raw conditional)
compute_redres(fm1)

# changes the residual type to studentized marginal
compute_redres(fm1, type = "std_mar")

goodekat/redres documentation built on March 3, 2021, 10:15 a.m.