Why Estimate the Weights?
Weighted least squares (WLS) uses different weights when observations have different error variances. If the variances are known, the usual choice is to weight observation \(i\) by the reciprocal of its variance. In many applications, however, the variance pattern is unknown. Regression residuals can provide information about that pattern, allowing us to estimate the variances and then carry out feasible weighted least squares (FWLS).
The word “feasible” matters: the procedure replaces unknown variance parameters with estimates. It is not generally identical to WLS using known variances, especially in a finite sample. A useful analysis therefore explains both how the weights were constructed and what assumptions support their use.
This setup assumes that the conditional mean is correctly specified and that observations have no conditional error covariance with one another. It also requires positive fitted variances. The predictors \(z_i\) may be columns of \(X\), other observed covariates, or functions of observed covariates. For example, a log-linear variance function is \(\sigma_i^2=\exp(z_i'\gamma)\); the exponential guarantees positive variances for every finite \(\gamma\).
Estimating a Variance Function From Residuals
A common starting point is an ordinary least-squares (OLS) regression of \(y\) on \(X\). Let \(\widehat{u}_i\) denote its residuals. Residual magnitudes contain information about error dispersion, but individual squared residuals are noisy: even when the variance is constant, some will be large and others small. A variance-function estimate therefore models a systematic pattern in residual squares rather than treating each square as the variance for that observation.
One approach is to group observations with similar variance predictors, calculate a residual-based variance estimate in each group, and fit a parametric function to those estimates. Another is to fit a specified model directly to squared residuals or to use a likelihood or quasi-likelihood criterion. The details depend on the model and available data. With a log-linear variance model, a common grouped approach regresses the logarithm of each group’s residual variance estimate on the group’s variance predictors. Adequate observations per group and a suitable model for how variance changes with those predictors are important.
Worked Example: Fitting a Log-Linear Variance Pattern
Suppose a hypothetical pilot regression includes group indicators, and there are three observations in each of three groups indexed by \(z=0,1,2\). The group residuals are \((-\sqrt{0.5},0,\sqrt{0.5})\), \((-1,0,1)\), and \((-\sqrt{2},0,\sqrt{2})\), respectively. Estimate a log-linear variance function from the group residual variances.
Calculate each group variance. In each group, the residuals sum to zero. With three observations and one group mean estimated, the sample residual variance uses \(3-1=2\) degrees of freedom. Thus the estimates are
Fit the log-linear pattern. Write \(\log(\sigma_i^2)=\gamma_0+\gamma_1 z_i\). The three responses for the grouped regression are \(\log(0.5)\), \(\log(1)=0\), and \(\log(2)\). These lie exactly on a line: the intercept is \(\log(0.5)\), and the slope is \(\log(2)-\log(0.5)=\log(4)\) over a two-unit increase in \(z\), so the per-unit slope is \(\log(2)\). Therefore,
The fitted variances at \(z=0,1,2\) are \(0.5,1,2\). The corresponding inverse-variance weights are \(2,1,0.5\). In an actual application, residual-based estimates are random and need not fall exactly on the chosen parametric curve. This small example illustrates the calculation, not a claim that three groups suffice for reliable estimation.
From Estimated Variances to FWLS
Once the variance parameters have been estimated, form \(\widehat{\Omega}=\operatorname{diag}(\widehat{\sigma}_1^2,\ldots,\widehat{\sigma}_n^2)\). The FWLS estimator minimizes the weighted residual sum of squares. If \(X'\widehat{\Omega}^{-1}X\) is invertible, its formula is
Equivalently, it minimizes \(\sum_{i=1}^n (y_i-x_i'\beta)^2/\widehat{\sigma}_i^2\). An observation with a larger fitted error variance receives less weight because its outcome is expected to be less precise. Multiplying every weight by the same positive constant does not change the coefficient estimate: that constant multiplies the whole objective function but does not change its minimizer.
Worked Example: A Weighted Regression With Estimated Weights
Suppose the fitted variance function from a hypothetical pilot sample gives estimated variances \(0.5,1,2\) at \(z=0,1,2\). In a second hypothetical sample, regress \(y\) on an intercept and \(x\), with observations \((x,y)=(0,1),(1,2),(2,2)\), and let the variance predictor be \(z=x\). Calculate the FWLS coefficients.
The inverse-variance weights are \(2,1,0.5\). For an intercept and a single regressor, define \(S_w=\sum_iw_i\), \(S_x=\sum_iw_ix_i\), \(S_y=\sum_iw_iy_i\), \(S_{xx}=\sum_iw_ix_i^2\), and \(S_{xy}=\sum_iw_ix_iy_i\). Substitution gives
The weighted slope and intercept are
The fitted line is \(1.077+0.6154x\), with the slope measured in units of \(y\) per unit of \(x\). The calculation treats the variance estimates as given; in practice they were themselves estimated, so the procedure is feasible rather than oracle WLS.
Why Consistency Can Survive Estimated Weights
Correct variance weights can improve precision, but consistency of the coefficient estimator does not generally require the variance function to be correct. The key mean condition is \(E(u\mid X)=0\). For any positive weights that are functions of observed covariates, the weighted population moment is then zero:
In a sample, the corresponding weighted normal equations are \(n^{-1}\sum_i \widehat{w}_i x_i(y_i-x_i'\widehat{\beta})=0\), where \(\widehat{w}_i=1/\widehat{\sigma}_i^2\). If estimated weights converge to positive, finite weights determined by the observed covariates, the weighted design matrix has a nonsingular limit, and the usual sampling regularity conditions hold, the weighted estimator converges to \(\beta\). In particular, a misspecified variance model can still yield consistent coefficient estimates under exogeneity and appropriate control of the weights. It may, however, fail to deliver the efficiency of correctly weighted estimation.
This reasoning also indicates why the mean assumption cannot be skipped. If the conditional mean is misspecified or \(E(u\mid X)\ne0\), weighting changes which observations influence the fit and does not generally repair the resulting bias. Nor is consistency guaranteed if fitted variances approach zero or become arbitrarily large in a way that makes the weights unstable, or if the weighted design loses rank.
Worked Example: Comparing Precision Under Correct Weights
Consider a hypothetical intercept-only model \(y_i=\beta+u_i\) with four independent observations. Suppose two errors have variance \(1\) and two have variance \(4\), and the conditional mean is correctly specified. Compare the variance of the unweighted mean with that of WLS using the true inverse-variance weights.
The OLS estimate is the ordinary mean. Independence gives its variance as the sum of the four error variances divided by \(4^2\):
The inverse-variance weights are \(1,1,0.25,0.25\). The weighted estimate is a weighted mean, and its variance is the sum of squared weights times their corresponding error variances, divided by the square of the sum of weights:
Here the correct weights reduce the estimator’s variance from \(0.625\) to \(0.400\). This is a finite-sample calculation with known variances. Estimated weights do not guarantee this exact reduction in a particular sample; efficiency gains for FWLS depend on consistent variance estimation and suitable regularity conditions.
Efficiency, Limitations, and a Common Pitfall
With a correctly specified conditional covariance and exogenous errors, GLS is the best linear unbiased estimator under the Gauss–Markov conditions. FWLS aims to approach that benchmark by estimating the covariance pattern. When the variance function is consistently estimated, fitted variances remain well behaved, and the design is sufficiently informative, the coefficient estimator can have the same large-sample first-order behavior as GLS with the true variances. This is an asymptotic claim, not a promise of improved precision in every finite sample.
If the variance function is wrong, positive weights based on observed covariates can still preserve consistency under the conditional mean assumption, but generally do not attain GLS efficiency. If weights are estimated from the same regression residuals, their estimation can also affect finite-sample behavior. Inference should not be treated as automatically exact merely because a weighted regression was run; its validity depends on the sampling and variance assumptions and on how uncertainty in the fitted variance model is handled.
Common pitfall: “The residuals are larger for some observations, so I can use their inverse squared residuals as weights.” This confuses noisy individual residual squares with underlying conditional variances. A single residual may be large by chance, and using its reciprocal can produce an extreme weight. Instead, estimate a structured variance function from a sufficiently informative collection of residuals, check that fitted variances are positive and plausible, and state the assumptions that support the chosen weighting model.
Obtain residuals from a regression whose mean specification and exogeneity assumptions are defensible.
Use residual information and a stated parametric variance function; account for the noise and structure of the residual-based estimates.
Set each weight to the reciprocal of its fitted variance, and verify that the fitted variances are positive and weights are not pathologically extreme.
Compute the weighted regression, report the units of coefficients, and distinguish consistency claims from efficiency claims.
Check Your Understanding
Use the definitions and conditions above to answer the following questions.
- Why are individual squared residuals generally inadequate as direct estimates of each observation’s conditional variance?
- If a fitted variance at an observation is \(4\), what inverse-variance weight does FWLS assign it?
- Explain why a positive variance model such as \(\exp(z_i'\gamma)\) is convenient.
- Can a misspecified variance function still yield consistent regression coefficients? State the key mean and weight conditions.
- Why does a correct variance function support an efficiency claim that a merely positive weighting scheme does not?