Taking variance into account with weighted least squares