Learn R Programming

plgraphics (version 1.2)

leverage: Get leverage values

Description

Extracts the leverage component of a fit object using the na.action component if available

Usage

leverage(object)

Value

The vector fit$leverage, possibly expanded by missing values if fit$na.action has class na.exclude

Arguments

object

an object containing a component fit$leverage and possibly a component fit$na.action

Author

Werner A. Stahel, ETH Zurich

Details

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.

See Also

Examples

Run this code
data(d.blast)
r.blast <-
  lm(log10(tremor)~location+log10(distance)+log10(charge), data=d.blast)
showd(leverage(r.blast))

Run the code above in your browser using DataLab