resid_marginal function

Marginal residuals

Marginal residuals

Calculates marginal residuals of lmerMod and lme model objects.

## Default S3 method: resid_marginal(object, type) ## S3 method for class 'lmerMod' resid_marginal(object, type = c("raw", "pearson", "studentized", "cholesky")) ## S3 method for class 'lme' resid_marginal(object, type = c("raw", "pearson", "studentized", "cholesky"))

Arguments

  • object: an object of class lmerMod or lme.
  • type: 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.

Returns

A vector of marginal residuals.

Details

For a model of the form Y=Xβ+Zb+ϵY = X \beta + Z b + \epsilon, four types of marginal residuals can be calculated:

  • raw: r=YXbeta^r = Y - X \hat{beta}
  • pearson: r/diag(Var^(Y))r / \sqrt{ diag(\hat{Var}(Y)})
  • studentized: r/diag(Var^(r))r / \sqrt{ diag(\hat{Var}(r)})
  • cholesky: C^1r\hat{C}^{-1} r where C^C^=Var^(Y)\hat{C}\hat{C}^\prime = \hat{Var}(Y)

References

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.

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