pull_resid.default {HLMdiag} | R Documentation |
Computationally Efficient HLM Residuals
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
## 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 |
... |
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.