R/reg_qr.R

Defines functions reg_qr

Documented in reg_qr

#' Linear regression with QR decomposition
#'
#' @param X covariates
#' @param y response
#' @return regresion coefficients
#' @export
reg_qr <- function(x,y){
  QR <- qr(x)
  Q <- qr.Q(QR)
  R <- qr.R(QR)
  coef<-solve(R,t(Q)%*%y)
  return(coef)
}
pderdeyn/Stats230pieter documentation built on March 21, 2022, 6:32 a.m.