R/wls.R

Defines functions wls

Documented in wls

#' Weighted leas squares regression
#'
#' Estimates linear regression coefficients. Standard errors should be computed
#' with a different function depending on various assumptions.
#' @param Y The outcome variables
#' @param X The explanatory variables
#' @param W The weighting matrix
#' @export

wls <- function(Y, X, W) {
  beta <- solve(t(X)%*%W%*%X)  %*% t(X) %*% W %*% Y
  return(beta)
}
samuelhigbee/myRtools documentation built on Sept. 25, 2021, 1:26 a.m.