Skip to contents

Solves (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.

Usage

morie_geron_normal_equation(X, y, fit_intercept = FALSE)

Arguments

X

Design matrix.

y

Targets.

fit_intercept

Prepend a column of ones.

Value

List with theta, residuals, rss, cond, estimate, n.

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)"
#>