Learn R Programming

fastliu (version 1.0)

hatliu: Hat matrix of Liu Regression

Description

For each value of the regularization parameter lambda, hatliu returns the hat matrix of Liu regression. The hat matrix for Liu regression is computed using the formula \(\mathbf{H}=\mathbf{X}\left(\mathbf{X}^{T}\mathbf{X}+\mathbf{I}_{p}\right)^{-1} \left(\mathbf{X}^{T}\mathbf{X}+\lambda\mathbf{I}_{p}\right)\left(\mathbf{X}^{T} \mathbf{X}\right)^{-1}\mathbf{X}^{T}.\)

Usage

hatliu(obj)

Value

The returned object is a list of matrices whose elements are the hat matrices for the values of the lambda regularization parameter.

Arguments

obj

A liureg object.

Author

Murat Genç

See Also

liureg(), summary(), pressliu(), residuals()

Examples

Run this code
data("Hitters")
Hitters <- na.omit(Hitters)
X <- model.matrix(Salary ~ ., Hitters)[, -1]
y <- Hitters$Salary
lam <- seq(0, 1, 0.01)
liu.mod <- liureg(X, y, lam)
# Hat matrix list
hatlist <- hatliu(liu.mod)
# Hat matrix for third regularization parameter
hatlist[[3]]

Run the code above in your browser using DataLab