- Introduced by
- Alexander Craig Aitken
- Year
- 1935
- Type
- Weighted linear estimator
What does it do?
Weighted Least Squares (WLS) is a generalization of Ordinary Least Squares (OLS) regression in which each observation receives a weight, typically inversely proportional to its error variance, so that less precise observations influence the fit less.
It is the standard remedy for heteroscedasticity when the error variance structure is known or can be reliably estimated. The estimator belongs to the generalized least-squares framework, which is usually traced to Aitken's work on least squares, and it is treated in standard texts such as Greene (2012) and Montgomery, Peck and Vining (2012).
The intuition behind the method
Imagine fitting a line to data where some measurements are reliable (tight spread) and others are noisy (wide spread). Ordinary least squares treats every point equally, so the noisy, unreliable points can pull the fitted line away from the truth. Weighted least squares fixes this by giving each point a vote proportional to its reliability — precise observations count more, imprecise ones count less. The result is a fit that reflects where the data are trustworthy rather than where they happen to be loudest.
History
The weighted estimator (X⊤WX)⁻¹X⊤Wy is a special case of the generalized least-squares framework, usually traced to A. C. Aitken's paper 'On Least Squares and Linear Combination of Observations' in Proceedings of the Royal Society of Edinburgh. The weighted matrix form is standard in later texts, including Greene's Econometric Analysis and Montgomery, Peck and Vining's Introduction to Linear Regression Analysis. WLS is the special case of Generalised Least Squares (GLS) with a diagonal error covariance matrix, and it became a routine tool in econometrics and statistics as computing became widespread.
When to use it
Use WLS when the error variance differs across observations (heteroscedasticity) and you have a principled basis for specifying the weights. Common triggers include residual plots that fan out with fitted values or a predictor; data that are group means or proportions, where group sizes are natural weights; measurements taken by instruments of differing precision; and aggregate data in which units represent different population sizes. Do not use WLS without a defensible weight model: if the weights are misspecified, the estimates can be less efficient than OLS and the standard errors can be misleading. When the variance structure is unknown, the weights are first estimated from the data, which is the Feasible WLS route, a special case of Feasible GLS; if errors are also correlated, use GLS or clustered standard errors instead.
Limitations and considerations
- Requires knowledge of, or a reliable estimate of, the relative error variances; misspecified weights can produce estimates less efficient than OLS.
- The best linear unbiased and efficiency properties rely on a known variance structure up to a constant of proportionality. With estimated weights (Feasible WLS) these properties are not guaranteed in finite samples.
- Handles only diagonal error covariance (uncorrelated errors with unequal variances); for autocorrelated or clustered errors, Generalized Least Squares or clustered standard errors are needed.
- Estimated weights (Feasible WLS) add uncertainty that the nominal standard errors do not capture unless the sample is large.
- Sensitive to the weight specification: a single observation assigned a very large weight can dominate the fit.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- When the true heteroscedastic error structure is known, the estimator is the best linear unbiased estimator and is more efficient than OLS.
- When the weights are correctly specified, the covariance matrix σ²(X⊤WX)⁻¹ gives valid standard errors and confidence intervals under heteroscedasticity without sandwich corrections. Correct specification is rarely certain in practice, so the weight model should be checked before these standard errors are relied on.
- The weights make the modelling assumptions explicit: each weight records a judgement about how reliable an observation is.
- Computationally it is equivalent to OLS on rescaled data, so it is available in standard statistical packages with no special algorithm.
Applications
- Correcting heteroscedasticity in economic and financial regression models where residual variance tends to grow with the size of the unit, such as income or firm size.
- Meta-analysis, where each study estimate is weighted by the reciprocal of its variance (w = 1/variance) to combine evidence across studies.
- Regression with analysis weights set by the analyst to reflect differing precision. Sampling weights in complex surveys usually also require design-based variance estimation, so WLS standard errors alone are not sufficient for population-level inference.
- Fitting models to grouped or aggregated data (e.g. regional averages), using group size as the weight to account for differing precision.
- Calibration studies in chemistry and engineering where measurement uncertainty is quantified and must be propagated through the regression.
How it works
How it works
The linear model is the same as OLS: the response y_i equals a linear combination of predictors plus an error term. The key departure is that errors are allowed to have unequal variances: Var(ε_i) = σ²/w_i, where w_i is the weight for observation i. Larger weights correspond to smaller variance, i.e. more reliable observations.
Formula
y_i = \mathbf{x}_i^\top \boldsymbol{\beta} + \varepsilon_i, \quad \operatorname{Var}(\varepsilon_i) = \sigma^2 / w_iWeights are collected into a diagonal matrix W whose i-th diagonal entry is w_i. In the ideal case, w_i is set to 1/σ_i², the reciprocal of the known error variance. In practice, weights are often estimated from group variances, replicate measurements, inverse fitted values (when the variance is proportional to the mean), or sample sizes for aggregated data.
Formula
\mathbf{W} = \operatorname{diag}(w_1, w_2, \ldots, w_n), \quad w_i \propto 1/\sigma_i^2The WLS coefficient vector is given by the closed-form Aitken estimator: β̂_WLS = (X⊤WX)⁻¹X⊤Wy. This is algebraically equivalent to running OLS on data in which each observation is multiplied by √w_i before fitting, so the same software routines can be used once the data are rescaled.
Formula
\hat{\boldsymbol{\beta}}_{\text{WLS}} = (\mathbf{X}^\top \mathbf{W} \mathbf{X})^{-1} \mathbf{X}^\top \mathbf{W} \mathbf{y}The estimator minimises a weighted sum of squared residuals, Σ w_i(y_i − x_i⊤β)², rather than the unweighted sum of OLS. Observations with high weight contribute more to the minimisation criterion; observations with low weight contribute less.
Formula
\hat{\boldsymbol{\beta}}_{\text{WLS}} = \arg\min_{\boldsymbol{\beta}} \sum_{i=1}^{n} w_i \left(y_i - \mathbf{x}_i^\top \boldsymbol{\beta}\right)^2The covariance matrix of the WLS estimator is σ²(X⊤WX)⁻¹. This matrix gives valid standard errors only if the weights correctly reflect the true relative error variances. Under that condition WLS is the best linear unbiased estimator, as the Gauss-Markov result extends to a non-scalar error covariance structure (the GLS setting of which WLS is a special case).
Formula
\operatorname{Var}(\hat{\boldsymbol{\beta}}_{\text{WLS}}) = \sigma^2 (\mathbf{X}^\top \mathbf{W} \mathbf{X})^{-1}Common pitfalls
- Using WLS without diagnosing why and how variance changes — arbitrary weight choices can worsen estimation relative to plain OLS.
- Forgetting to re-check residual plots after fitting; WLS residuals should be examined on the weighted (studentised) scale, not the raw scale.
- Conflating WLS with robust regression: WLS corrects for known heteroscedasticity but is not resistant to outliers the way M-estimators are.
- Applying WLS when errors are correlated as well as heteroscedastic — in that case, full GLS with an off-diagonal covariance matrix is required.
Frequently asked questions
How do I choose the weights?
The ideal weight for observation i is 1/σ_i², the reciprocal of its error variance. In practice: if you have replicates, estimate σ_i² from them; if variance scales with a predictor x_i (common in economics), use w_i = 1/x_i or w_i = 1/x_i²; if data are group means, use w_i = n_i (group size). When weights must be estimated from the data, the procedure becomes Feasible WLS and introduces additional sampling error.
Is WLS the same as GLS?
WLS is a special case of GLS. GLS allows a fully general error covariance matrix Ω; WLS restricts Ω to be diagonal, meaning errors are uncorrelated but have unequal variances. If errors are also correlated (e.g. time series, clustered data), you need full GLS or a clustered-error correction.
Why not just use OLS with heteroscedasticity-robust (sandwich) standard errors?
Robust standard errors correct OLS inference without changing the coefficient estimates. WLS changes the estimates themselves, making them more efficient when the weight structure is well specified. If the variance function is well understood, WLS yields narrower confidence intervals than robust OLS. If it is uncertain, robust OLS is safer because it does not rely on a possibly wrong weight model.
How do I verify that WLS has improved the fit?
Plot the weighted residuals (raw residual × √w_i) against fitted values and predictors. The weighted residuals should show roughly constant spread (homoscedasticity) if the weights are correctly specified. Also compare the residual standard error and information criteria (AIC/BIC) between the WLS and OLS models.
Related methods
Sources
Aitken, A. C. (1935). IV.—On least squares and linear combination of observations. Proceedings of the Royal Society of Edinburgh, 55, 42–48.
Open DOI referenceGreene, W. H. (2012). Econometric Analysis (7th ed.). Pearson Education.
ISBN: 978-0131395381Montgomery, D. C., Peck, E. A., & Vining, G. G. (2012). Introduction to Linear Regression Analysis (5th ed.). Wiley.
ISBN: 978-0470542811