
Ridge by the augmented normal equation (Geron Ch 4, morie.fn hmridn)
Source:R/geron_ml2_native.R
morie_geron_ridge_normal.Rd(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.
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"
#>