Create the "hat matrix" for weighted least squares regression
wls_hat_matrix(X, w)
X
: Matrix of predictor variables, with n
rowsw
: Vector of weights (should all be nonnegative), of length n
An matrix. This is the "hat matrix" for a WLS regression.
Useful links