pull_resid.lmerMod: Computationally Efficient HLM Residuals

Description Usage Arguments Details See Also

View source: R/pull_resid.R

Description

pull_resid takes a hierarchical linear model fit as a lmerMod or lme object and returns various types of level-1 residuals as a vector. Because the pull_resid only calculates one type of residual, it is more efficient than using hlm_resid and indexing the resulting tibble. pull_resid is designed to be used with methods that take a long time to run, such as the resampling methods found in the lmeresampler package.

Usage

1
2
3
4
5
6
7
8
## Default S3 method:
pull_resid(object, ...)

## S3 method for class 'lmerMod'
pull_resid(object, type = "ls", standardize = FALSE, ...)

## S3 method for class 'lme'
pull_resid(object, type = "ls", standardize = FALSE, ...)

Arguments

object

an object of class lmerMod or lme.

...

not in use

type

which residuals should be returned. Can be either 'ls', 'eb', or 'marginal'

standardize

a logical indicating if residuals should be standardized

Details

type = "ls"

Residuals calculated by fitting separate LS regression models for each group. LS residuals are unconfounded by higher level residuals, but unreliable for small within-group sample sizes. When standardize = TRUE, residuals are standardized by sigma components of the model object.

type = "eb"

Residuals calculated using the empirical Bayes (EB) method using maximum likelihood. EB residuals are interrelated with higher level residuals. When standardize = TRUE, residuals are standardized by sigma components of the model object.

type = "marginal"

Marginal residuals only consider the fixed effect portion of the estimates. When standardize = TRUE, Cholesky residuals are returned.

See Also

hlm_resid


HLMdiag documentation built on May 2, 2021, 9:06 a.m.