cresiduals: Extract Conditional Residuals from Multivariate Linear Model Fits
Description
Residuals from full conditionals of a Multivariate
Linear Model (mlm) object. The full conditional for each response is a
linear model with all other responses used as predictors in addition to the
regressors specified in the formula of the mlm object. This is used to
diagnose the multivariate normality assumption in plotenvelope.
Usage
cresiduals(object, standardize = TRUE, ...)
Value
A matrix of residuals
Arguments
object
a mlm object, typically the result of calling lm with a matrix response.
standardize
logical defaults to TRUE, to return studentized residuals
using rstandard so they are comparable across responses.
A residuals function for mlm objects, which returns residuals from a full
conditional model, that is, a linear model of each response against all responses
as well as predictors, which can be used to diagnose the multivariate normality assumption.
These can be standardized (standardize=TRUE) to facilitate overlay plots of multiple
responses, as in plotenvelope.
References
Warton DI (2022) Eco-Stats - Data Analysis in Ecology, from t-tests to multivariate abundances. Springer, ISBN 978-3-030-88442-0
data(iris)
# fit a mlm:iris.mlm=lm(cbind(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width)~Species,data=iris)
# construct full conditional residuals:cresiduals(iris.mlm)