pull_resid.lmerMod function

Computationally Efficient HLM Residuals

Computationally Efficient HLM Residuals

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.

## 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

  • Maintainer: Adam Loy
  • License: GPL-2
  • Last published: 2021-05-02