Calculates conditional residuals of lmerMod
and lme
model objects.
# S3 method for default
resid_conditional(object, type)# S3 method for lmerMod
resid_conditional(
object,
type = c("raw", "pearson", "studentized", "cholesky")
)
# S3 method for lme
resid_conditional(
object,
type = c("raw", "pearson", "studentized", "cholesky")
)
an object of class lmerMod
or lme
.
a character string specifying what type of residuals should be calculated.
It is set to "raw"
(observed - fitted) by default. Other options include
"pearson"
, "studentized"
, and "cholesky"
.
Partial matching of arguments is used, so only the first character needs to be provided.
A vector of conditional residuals.
For a model of the form \(Y = X \beta + Z b + \epsilon\), four types of marginal residuals can be calculated:
raw
\(e = Y - X \hat{beta} - Z \hat{b}\)
pearson
\(e / \sqrt{diag(\hat{Var}(Y|b)})\)
studentized
\(e / \sqrt{diag(\hat{Var}(e))}\)
cholesky
\(\hat{C}^{-1} e\) where \(\hat{C}\hat{C}^\prime = \hat{Var}(e)\)
Singer, J. M., Rocha, F. M. M., & Nobre, J. S. (2017). Graphical Tools for Detecting Departures from Linear Mixed Model Assumptions and Some Remedial Measures. International Statistical Review, 85, 290--324.
Schabenberger, O. (2004) Mixed Model Influence Diagnostics, in Proceedings of the Twenty-Ninth SAS Users Group International Conference, SAS Users Group International.