linreg.gs.RdThis 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)
| Y | vector of outcome variable |
|---|---|
| X | matrix of covariates |
coefs vector of coefficients
#> $coefs #> [1] 25.7246016 0.2872409 #>