OLS for linear regression makes the assumption that the variance for all covariates is the same. If this is not the case we use weighted least squares. In particular, the model is
where and is a diagonal matrix with on the diagonal and . We solve for an estimate of by minimizing the “weighted residual sum of squares”, which as we’d suspect, is
which generalizes the usual residual sum of squares, in which . The solution is .