
OLS by the normal equation (Geron Ch 4, morie.fn hmneq)
Source:R/geron_ml2_native.R
morie_geron_normal_equation.RdSolves (X^T X) theta = X^T y as a linear system, never forming the inverse, and refuses a rank-deficient Gram matrix rather than returning an arbitrary member of the solution set.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_normal_equation(V, V)
#> $theta
#> [1] 1
#>
#> $residuals
#> [1] 0 0 0 0 0 0 0 0
#>
#> $rss
#> [1] 0
#>
#> $cond
#> [1] 1
#>
#> $estimate
#> [1] 1
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Normal equation solved as a linear system (no explicit inverse)"
#>