This function implements linear regression by solving the normal equations. It constructs matrices X'X and X'Y and solves for beta in X'X*beta=X'Y using the iterative Gauss-Seidel solver of system of linear equations.

linreg.gs(Y, X)

Arguments

Y

vector of outcome variable

X

matrix of covariates

Value

coefs vector of coefficients

Examples

linreg.sor(women$height,women$weight)
#> $coefs #> [1] 25.7246016 0.2872409 #>