Skip to content

Commit

Permalink
Merge pull request #2 from fyradur/var-beta-with-QR
Browse files Browse the repository at this point in the history
Make calculation of variance of beta utilize QR decomposition.
  • Loading branch information
aurora-mm authored Oct 9, 2024
2 parents b3369cc + 14d95c3 commit e105d71
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 e105d71

Please sign in to comment.