leverage | R Documentation |
Extracts the leverage component of a fit object using the
na.action
component if available
leverage(object)
object |
an object containing a component |
The difference to hatvalues
is that leverage
does not
call influence
and therefore does not require residuals.
It is therefore simpler and more widely applicable.
The function uses the qr
decomposition of object
.
If necessary, it generate it.
The leverage is the squared Mahalanobis distance of the observation
from the center of the design X (model.matrix
) with
"covariance" X^T X. If there are weights (object$weights
),
the weighted center and "covariance" are used, and the distances are
multiplied by the weights.
To obtain the distances in the latter case, "de-weight" the leverages
by dividing them by the weights.
The vector fit$leverage
, possibly expanded by missing values
if fit$na.action
has class na.exclude
Werner A. Stahel, ETH Zurich
hat; hatvalues; influence
data(d.blast)
r.blast <-
lm(log10(tremor)~location+log10(distance)+log10(charge), data=d.blast)
showd(leverage(r.blast))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.