Skip to content

Commit

Permalink
Make calculation of variance of beta utilize QR decomposition.
Browse files Browse the repository at this point in the history
  • Loading branch information
fyradur committed Oct 9, 2024
1 parent b3369cc commit 14d95c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/LinearRegression.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ linreg <- function(formula, data) {
sigma2 <- sum(resid^2) / (n - p)

# Variance of betas
var_beta <- sigma2 * solve(t(X) %*% X)
var_beta <- sigma2 * solve(R) %*% t(solve(R))

# Return S3 object of class linreg
return(structure(list(
Expand Down

0 comments on commit 14d95c3

Please sign in to comment.