skip to content

For heteroscedastic data, when do you prefer weighted least squares over robust standard errors?

level: seniorimportance: should knowfreq 45%

answer

  1. one fix models the variance, one ignores it
  2. efficiency versus agnosticism
  3. aggregated rows make the weights arithmetic
  4. weight proportional to group size

basics

~20 s

Prefer weighted least squares when the variance model is genuinely known - most cleanly with aggregated rows whose group sizes you have. Otherwise keep ordinary least squares and report heteroscedasticity-robust standard errors, which require no variance model at all.

solid answer

~50 s

The dividing line is whether you can justify a variance model. Robust sandwich standard errors are agnostic: they leave the OLS estimates untouched and give asymptotically valid inference whatever the variance pattern. What they do not recover is efficiency - OLS weights every row equally even though the quiet rows carry more information. Weighted least squares fixes that by weighting each observation by the inverse of its error variance, and when that variance is genuinely known it is the minimum-variance unbiased linear estimator, delivering honestly narrower intervals. The clean case is aggregated data: if each row is a city-level mean over a different city population, the variance of a mean over `n_i` units is proportional to `1/n_i`, so weights proportional to `n_i` are known rather than guessed. When the weights are invented, you keep consistency but lose the efficiency argument, so weight and still report robust standard errors.

go deeper

for a junior

Know that two responses to unequal variance exist: adjust the standard errors after the fact, or weight the observations during fitting. Know that only the second one changes the coefficients.

for a middle

Explain the weighting rule - weight by the inverse of an observation's error variance - and the arithmetic behind group-size weights when each row is an average over a known number of units.

for a senior

Demonstrate the decision criterion under real conditions: whether a variance model is defensible, what happens when the weights are wrong, and why weighting plus robust standard errors is the safe combination.

for a principal

Own the standard for the team: when the efficiency gain justifies committing to a variance model, how weighted results get reported against unweighted ones, and how to prevent weights from becoming an unaudited modelling choice.

## Two different problems, two different fixes Heteroscedasticity causes two distinct injuries, and it is worth separating them because each correction addresses only one. 1. **Broken inference.** The conventional standard-error formula assumes one common error variance, so under unequal variances it is inconsistent and every t-statistic and interval built from it is wrong. 2. **Lost efficiency.** OLS gives every observation equal weight. Under unequal variances the low-noise observations carry more information about the line than the high-noise ones, so OLS is no longer the minimum-variance linear unbiased estimator - a better estimator exists. Robust standard errors fix (1) and ignore (2). Weighted least squares fixes (2) - and, if the variance model is right, fixes (1) as a side effect, because the weighted fit is homoscedastic in the transformed space. ## What robust standard errors buy The sandwich estimator plugs the observed squared residuals into the middle of the general variance expression instead of assuming a single variance times the identity. Its virtues are exactly its modesty: it commits to no shape for the variance, changes not one digit of the point estimates, and remains consistent under essentially any pattern. Variants differ only in small-sample correction - HC1 applies a simple degrees-of-freedom scaling, while HC2 and HC3 additionally adjust each squared residual for how strongly the fit was pulled toward that observation, with HC3 the most conservative and the usual recommendation for modest samples. Its limitations are also worth stating. It is an **asymptotic** argument: in genuinely small samples the sandwich estimator is itself noisy and can be anti-conservative, which is what HC3 partly compensates for. And it makes no attempt to recover efficiency - the intervals are correct but wider than they had to be. ## What weighted least squares buys If `Var(e_i) = sigma^2 / w_i`, minimising the weighted sum `sum w_i * (y_i - fitted_i)^2` produces the generalised-least-squares estimator, which under those weights is BLUE. The intuition is direct: an observation with a quarter of the variance carries four times the information about the line, so it deserves four times the weight. The gain is real and, when the variance ratio across rows is large, substantial - genuinely narrower confidence intervals rather than merely differently computed ones. Unlike robust standard errors, **WLS changes the point estimates**. Both estimators remain consistent for the same parameter when the model is correctly specified, so a large gap between the OLS and WLS coefficients is itself a diagnostic - it usually signals a mis-specified mean function or effects that genuinely differ across the population, since OLS and WLS then converge on different weighted averages of those varying effects. ## When are the weights actually known? This is the whole question, and the honest answer is: less often than textbooks imply. The defensible cases are: - **Aggregated rows.** Each row is a group mean built from a known number of underlying units. The variance of a mean over `n_i` units is `sigma^2 / n_i`, so `w_i = n_i` follows from arithmetic, not from a guess. City-level averages built from different city populations are the canonical case: weighting by population size is not a modelling choice, it is a correction for how the rows were manufactured. - **Known measurement precision.** Instruments or vendors that report a per-observation uncertainty give you the weights directly. - **Design weights.** A sampling design with known inclusion probabilities determines the weights up front. When the variance instead has to be estimated from the data - fit OLS, model the squared residuals, invert the fitted values into weights - you have moved into feasible generalised least squares. That can pay off when the variance relationship is strong and simple, but you have introduced estimation error into the weights themselves, and the theoretical efficiency guarantee is now conditional on a model you fitted from the same data. ## What goes wrong with wrong weights A useful reassurance and a useful warning. Weighting by something exogenous - unrelated to the error - keeps the estimator **consistent** even if the weights are badly chosen; you simply forfeit the efficiency gain and may end up worse off than plain OLS. What you do *not* keep is valid model-based inference: the weighted-model standard errors assume the weights are correct, and if they are not, those standard errors are wrong in the same way conventional OLS standard errors were wrong to begin with. The consequence is the practical protocol: **weight if you can justify the weights, and report heteroscedasticity-robust standard errors on the weighted fit anyway.** That combination gives you whatever efficiency the weights genuinely deliver and inference that survives being wrong about them. It is strictly better than choosing one and hoping. One genuine hazard: weights that depend on the outcome, or on anything the outcome influenced, break the exogeneity that keeps WLS consistent. Weights must come from the design or from predictors, never from the response. ## How to answer in the room Lead with the criterion rather than a preference: do I have a defensible variance model? Give the aggregated-data case as the example where the answer is yes, name efficiency as the thing WLS buys and agnosticism as the thing robust standard errors buy, and close with the belt-and-braces combination. Candidates who declare one universally superior are usually reciting; the interesting answer is the condition that decides.

  • Your weights are an educated guess. Is weighted least squares still safe?
    The point estimates stay consistent as long as the weights are exogenous - determined by design or predictors, never by the response. What you lose is the efficiency guarantee and, more importantly, valid model-based standard errors, which assume the weights are right. So weight if you like, but report heteroscedasticity-robust standard errors on the weighted fit.
  • Each row is a city-level mean. What weight would you use and why?
    Weights proportional to the number of underlying observations behind each city mean. The variance of a mean over `n_i` units is the unit-level variance divided by `n_i`, so weighting by `n_i` exactly offsets it and restores constant variance in the weighted problem. This is arithmetic from how the rows were built, not a modelling assumption.
  • OLS and weighted least squares give noticeably different coefficients. What does that tell you?
    Under a correctly specified linear model both are consistent for the same parameter, so a large gap is a warning rather than a routine consequence of weighting. The usual culprits are a mis-specified mean function or genuinely varying effects across the population, in which case the two estimators converge on different weighted averages of those effects. Investigate before reporting either.
  • Is there a cost to using robust standard errors when the errors are actually homoscedastic?
    A modest one. When the equal-variance assumption holds, the conventional formula is the efficient estimate of the variance and the sandwich version is noisier, so robust standard errors are somewhat less precise in finite samples. Asymptotically the difference vanishes. Most practitioners judge that insurance premium worth paying by default.

Robust standard errors are like widening the error bars on a survey you already ran. Weighted least squares is like running the survey again but sampling more heavily from the neighbourhoods where answers are more reliable - a better study, if you knew which those were.

saying these in an interview costs you the question

  • Applies weighted least squares with invented weights and quotes model-based standard errors
  • Says weighting is needed because OLS is biased under unequal variance
  • Assumes robust standard errors also recover the lost efficiency
  • Weights by the inverse of group size instead of by group size
  • Builds weights from the response variable

context