leverage: Get leverage values

leverageR Documentation

Get leverage values

Description

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

Usage

leverage(object)

Arguments

object

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

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.

Value

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

Author(s)

Werner A. Stahel, ETH Zurich

See Also

hat; hatvalues; influence

Examples

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

plgraphics documentation built on Oct. 19, 2023, 3 p.m.