Why Known Unequal Variances Change the Fit
In a linear regression, observations can have different error variances. If those variances are known, an observation with a larger variance is less precise than one with a smaller variance. Weighted least squares (WLS) accounts for that difference by giving each observation weight in inverse proportion to its variance. This changes the fitting criterion, not the underlying regression equation: the goal remains to estimate the same coefficient vector.
The distinction matters in applications where observation-specific precision is supplied by the measurement process or the design. WLS is not simply a way to make residuals look more uniform, and the weights are not chosen by inspecting which observations have the largest residuals. The inverse-variance rule follows from the model’s error covariance.
Model and Assumptions
The diagonal covariance matrix is the key restriction here: the error variance may differ by observation, but there is no covariance between distinct observations. No normality assumption is required to define or calculate WLS, or to obtain its conditional covariance matrix. If the errors are also conditionally normal, the same criterion is the Gaussian likelihood criterion for \(\beta\). The variances must be treated as known for the results below; replacing them with estimates changes the problem.
Let \(D=\operatorname{diag}(\sigma_1,\ldots,\sigma_n)\). Since its diagonal entries are positive, \(D\) is invertible. Multiplying the regression by \(D^{-1}\) divides each observation by its error standard deviation. In the transformed model the error covariance is the identity matrix:
This transformation is called whitening. It turns the unequal-variance regression into a regression with equal transformed error variances. Ordinary least squares on the transformed variables is therefore the route to WLS.
Deriving the Inverse-Variance Weights
Write \(\hat{\beta}_{WLS}\) for the WLS estimator. Ordinary least squares on the whitened equation minimizes the sum of squared transformed residuals. For a candidate coefficient vector \(b\), the transformed residual for observation \(i\) is \((y_i-x_i'b)/\sigma_i\), where \(x_i'\) is row \(i\) of \(X\). Therefore the criterion is:
To derive the estimator, differentiate the matrix criterion with respect to \(b\) and set the derivative to zero. Since \(W\) is symmetric, the resulting normal equations and solution are:
The inverse exists because \(X\) has full column rank and \(W\) is positive definite: for any nonzero \(a\), \(a'X'WXa=(Xa)'W(Xa)>0\). This also ensures the criterion has a unique minimum. Multiplying all weights by the same positive constant does not change the estimator: the common factor appears in both \(X'WX\) and \(X'Wy\) and cancels. But the relative weights matter. One must not confuse the regression weights \(1/\sigma_i^2\) with the divisors \(1/\sigma_i\) used to transform individual observations.
Properties of the Estimator
Because \(\hat{\beta}_{WLS}\) is a linear function of \(y\), its expectation and conditional covariance follow directly from the model:
For the covariance calculation, set \(A=(X'WX)^{-1}X'W\), so that \(\hat{\beta}_{WLS}=Ay\). Then \(\operatorname{Var}(Ay\mid X)=A\Omega A'\). Substituting \(W=\Omega^{-1}\), and using the symmetry of \(W\), gives:
because \(W\Omega W=W\). Thus, when the variances are known, this covariance matrix does not require an estimate of a common error variance. Under the stated zero-mean and covariance assumptions, WLS is the best linear unbiased estimator: among linear unbiased estimators, it has the smallest covariance matrix in the positive-semidefinite ordering. This is the GLS efficiency result for the diagonal covariance matrix \( \Omega \).
The covariance result does not by itself assert that the coefficient estimates are normally distributed. Conditional normality of the errors gives normal coefficient estimates and supports exact normal-theory inference using the known covariance matrix. Without that distributional assumption, unbiasedness and the covariance expression still hold, but exact finite-sample normal inference does not follow automatically.
Worked Example: Estimating a Common Mean
Suppose three independent measurements of one common quantity have values \(10\), \(14\), and \(12\) units, with known error variances \(1\), \(4\), and \(1\) squared units. Assume each measurement has that common mean and a zero-mean error. The intercept-only design has one column of ones, so the WLS estimate is the weighted mean.
The weights are the inverse variances: \(1\), \(1/4\), and \(1\). Thus:
The second measurement is less precise, so it contributes less to the estimate. For comparison, the unweighted mean is \((10+14+12)/3=12.00\) units. The conditional variance of the weighted estimate is the reciprocal of the sum of the weights, \(1/2.25=0.4444\) squared units, giving a standard error of \(\sqrt{0.4444}=0.6667\) units. These calculations use the stated known variances; they do not estimate a residual variance from the three measurements.
Weighted Regression With Unequal Known Variances
For a regression with an intercept and one predictor, the WLS criterion is the sum of each squared residual multiplied by its inverse error variance. In the next example, the observations with larger known variances are deliberately given less influence. The variances are part of the hypothetical setup, not estimates obtained from this small data set.
Worked Example: A Regression With Three Different Variances
Consider the hypothetical observations below, with a known error variance for each outcome. Fit \(y_i=\beta_0+\beta_1x_i+u_i\), assuming \(E(u\mid X)=0\), independent errors, the stated variances, and a design matrix of full column rank.
| Observation | \(x_i\) | \(y_i\) | Known variance \(\sigma_i^2\) | Weight \(w_i\) |
|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 1 |
| 2 | 1 | 4 | 4 | 1/4 |
| 3 | 2 | 2 | 9 | 1/9 |
With an intercept, each row of \(X\) is \((1,x_i)\). The weighted cross-products and outcome products are:
Solving \((X'WX)\hat{\beta}_{WLS}=X'Wy\) gives:
The fitted line is \(\hat{y}=1.192+1.269x\). Its intercept is in the units of \(y\), and its slope is in units of \(y\) per unit of \(x\). For comparison, ordinary least squares on these same observations gives slope \(0.500\) and intercept \(1.833\). The estimates differ because WLS gives the observation with variance \(9\) less weight than the observations with variance \(1\); it is not because the regression equation or target coefficient changed.
For these known variances, the conditional coefficient covariance matrix is:
For example, the standard error of the slope under the model is \(\sqrt{1/2}=0.7071\) in units of \(y\) per unit of \(x\). Its interpretation as an exact normal-theory standard error requires conditionally normal errors; the variance calculation itself uses the specified covariance matrix.
Checking the Whitening Calculation
The weighted and whitened formulations are two expressions of the same calculation. Dividing each outcome and each design row by \(\sigma_i\) produces ordinary least squares on transformed data. The example below checks this equivalence using the fitted regression just calculated.
Worked Example: Verifying the Weighted Objective After Whitening
For the three observations above, the standard deviations are \(1\), \(2\), and \(3\). The transformed outcomes \(y_i/\sigma_i\) are \(1\), \(2\), and \(2/3\); the transformed design rows \((1,x_i)/\sigma_i\) are \((1,0)\), \((1/2,1/2)\), and \((1/3,2/3)\). The weighted fit has coefficients \(31/26\) and \(33/26\).
The untransformed residuals are \(-5/26\), \(20/13\), and \(-45/26\). Dividing each residual by its standard deviation gives the transformed residuals \(-5/26\), \(10/13\), and \(-15/26\). Their squared sum is:
Computing the original residuals with weights \(1\), \(1/4\), and \(1/9\) gives exactly the same objective:
The agreement follows generally because \((y_i-x_i'b)^2/\sigma_i^2\) is the square of the corresponding transformed residual. The weighted fit therefore minimizes precisely the ordinary sum of squared residuals in the whitened regression.
Common Mistakes and Practical Limits
- Using variance instead of inverse variance. Giving more weight to larger variances reverses the precision adjustment. The objective uses \(w_i=1/\sigma_i^2\), while whitening divides by \(\sigma_i\).
- Assuming WLS repairs a misspecified mean model. WLS changes how observations contribute to fitting; it does not fix omitted variables, incorrect functional form, or a nonzero conditional error mean.
- Treating estimated variances as known. The calculations here rely on observation variances supplied as known. Estimating a variance function and constructing feasible weights requires additional methods and uncertainty considerations.
- Assuming unequal variances alone imply independent errors. The diagonal covariance model also rules out cross-observation covariance. If errors are correlated, inverse variances alone do not describe the full covariance adjustment.
- Believing any positive weights have the same justification. A common positive rescaling leaves the coefficient estimate unchanged, but changing relative weights changes the estimator. The inverse-variance choice is justified by the stated covariance model.
Known-variance WLS is useful when the precision differences are substantively supported and the covariance assumptions are credible. Its value is not that it guarantees a better-looking regression, but that it uses the supplied error information to obtain the appropriate linear unbiased estimator under the model.
Check Your Understanding
Answer each question using the model assumptions and calculations in this tutorial.
- If an observation has error variance \(16\) and another has variance \(4\), what is the ratio of their WLS weights?
- Why does whitening divide by the standard deviation rather than by the variance?
- State the conditional covariance matrix of the WLS coefficient estimator when the variances are known.
- Would multiplying every WLS weight by 10 change the coefficient estimates? Explain briefly.
- What additional assumption would support exact normal-theory inference for the coefficients in a finite sample?