Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

leverage

Diagonal values of the Hat matrix


Description

Diagonal values of the Hat matrix.

Usage

leverage(x)

Arguments

x

A matrix with independent variables, the design matrix.

Details

The function returns the diagonal values of the Hat matrix used in linear regression. We did not call it "hatvalues" as R contains a built-in function with such a name.

Value

A vector with the diagonal Hat matrix values, the leverage of each observation.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr

References

See Also

Examples

x <- as.matrix( iris[1:50, 1:4] )
a <- leverage(x)

Rfast2

A Collection of Efficient and Extremely Fast R Functions II

v0.0.9
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Stefanos Fafalios and Marios Dimitriadis.
Initial release
2021-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.