Skip to contents

(X^T X + alpha A) theta = X^T y with A the identity minus the intercept slot. Effective df = tr(X (X^T X + alpha A)^-1 X^T) makes the shrinkage visible.

Usage

morie_geron_ridge_normal(X, y, alpha, intercept_index = 0)

Arguments

X, y

Design and targets.

alpha

Non-negative penalty.

intercept_index

0-based unpenalised index, or NULL.

Value

List with theta, residuals, rss, effective_df, alpha, estimate, n.

Examples

morie_geron_ridge_normal(X = c(1, 2, 3, 4, 5, 6, 7, 8), y = c(1, 2, 3, 4, 5, 6, 7, 8), alpha = 0.5)
#> $theta
#> [1] 1
#> 
#> $residuals
#> [1] 0 0 0 0 0 0 0 0
#> 
#> $rss
#> [1] 0
#> 
#> $effective_df
#> [1] 1
#> 
#> $alpha
#> [1] 0.5
#> 
#> $estimate
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Ridge closed form (X^T X + alpha A) theta = X^T y"
#>