Learn R Programming

HLMdiag (version 0.5.1)

hlm_augment: Calculating residuals and influence diagnostics for HLMs

Description

This function is used to compute residuals, fitted values, and influence diagnostics for a hierarchical linear model. The residuals and fitted values are computed using Least Squares(LS) and Empirical Bayes (EB) methods. The influence diagnostics are computed through one step approximations.

Usage

hlm_augment(object, ...)

# S3 method for default hlm_augment(object, ...)

# S3 method for lmerMod hlm_augment(object, level = 1, include.ls = TRUE, data = NULL, ...)

# S3 method for lme hlm_augment(object, level = 1, include.ls = TRUE, ...)

Arguments

object

an object of class lmerMod or lme.

...

currently not used

level

which residuals should be extracted and what cases should be deleted for influence diagnostics. If level = 1 (default), then within-group (case-level) residuals are returned and influence diagnostics are calculated for individual observations. Otherwise, level should be the name of a grouping factor as defined in flist for a lmerMod object or as in groups for a lme object. This will return between-group residuals and influence diagnostics calculated for each group.

include.ls

a logical indicating if LS residuals should be included in the return tibble. include.ls = FALSE decreases runtime substantially.

data

the original data frame passed to `lmer`. This is only necessary for `lmerMod` models where `na.action = "na.exclude"`

Details

The hlm_augment function combines functionality from hlm_resid and hlm_influence for a simpler way of obtaining residuals and influence diagnostics. Please see ?hlm_resid and ?hlm_influence for additional information about the returned values.