cpredict {ecostats}R Documentation

Conditional Predictions for Multivariate Linear Model Fits

Description

Predicted values using full conditional models derived from a multivariate linear model (mlm) object. The full conditionals model each response as a linear model with all other responses used as predictors in addition to the regressors specified in the formula of the mlm object.

Usage

cpredict(object, standardize = TRUE, ...)

Arguments

object

a mlm object, typically the result of calling lm with a matrix response.

standardize

logical defaults to TRUE, standardising responses so they are comparable across responses.

...

further arguments passed to predict.lm, in particular, newdata. However, this function was not written to accept non-default values for se.fit, interval or terms.

Details

Predictions using an mlm object but based on the full conditional model, that is, from a linear model for each response as a function of all responses as well as predictors. This can be used in plots to diagnose the multivariate normality assumption.

By default predictions are standardised to facilitate overlay plots of multiple responses, as in plotenvelope.

This function behaves much like predict.lm, but currently, standard errors and confidence intervals around predictions are not available.

Value

A matrix of predicted values from full conditional models.

Author(s)

David Warton <david.warton@unsw.edu.au>

References

Warton DI (2022) Eco-Stats - Data Analysis in Ecology, from t-tests to multivariate abundances. Springer, ISBN 978-3-030-88442-0

See Also

cresiduals, lm, plotenvelope, predict.lm

Examples

data(iris)
# fit a mlm:
iris.mlm=lm(cbind(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width)~Species,data=iris)
# predict each response conditionally on the values of all other responses:
cpredict(iris.mlm)


[Package ecostats version 1.2.1 Index]