| designMD {fit.models} | R Documentation |
Design Matrix Mahalanobis Distance
Description
Returns the squared Mahalanobis distance of all rows in the design (model)
matrix X and the sample mean vector \mu of the columns
of X with respect to the sample covariance matrix \Sigma.
This is (for vector x' a row of X) defined as
d^{2} = (x - \mu)' \Sigma^{-1} (x - \mu)
where
\mu = colMeans(X)
and
\Sigma = cov(X).
Usage
designMD(object, ...)
Arguments
object |
a fitted model object with a |
... |
additional arguments are ignored. |
Value
a numeric vector containing the squared Mahalanobis distances.
Examples
stack.lm <- lm(stack.loss ~ ., data = stackloss)
# Mahalanobis distance (not squared)
sqrt(designMD(stack.lm))
[Package fit.models version 0.64 Index]