Skip to contents

theta = (X^T X + alpha diag(0, 1, ..., 1))^-1 X^T y; the bias column is never penalised.

Usage

morie_geron_ridge_normal_equation(X, y, alpha, intercept = TRUE)

Arguments

X, y

Design and targets.

alpha

Non-negative penalty.

intercept

Zero the first diagonal entry.

Value

List with theta, fitted, residuals, rss, penalty.

Examples

morie_geron_ridge_normal_equation(X = c(1, 2, 3, 4, 5, 6, 7, 8), y = 5L, alpha = 0.5)
#> $theta
#> [1] 5 0 0 0 0 0 0 0
#> 
#> $fitted
#> [1] 5
#> 
#> $residuals
#> [1] 0
#> 
#> $rss
#> [1] 0
#> 
#> $penalty
#> [1] 0
#> 
#> $estimate
#> [1] 5 0 0 0 0 0 0 0
#> 
#> $n
#> [1] 1
#>