A standard error for a model that is wrong

The bread and the filling

The robust standard error is not a safety margin. At one setting of the error variance it is 1.2806 times the model-based one and at another it is 0.8246 times it, and the sign of a single dial decides which.

Worth reading first: What a wrong model estimates.

Fit a straight line to eighty rows whose error variance is largest at the ends of the design, and read each candidate standard error against the spread the slope actually has across twenty thousand draws. The model-based variance estimate averages 0.6081 of that spread. The unbiased robust correction averages 0.9961 of it. One of the two is a standard error, and it is not the one the regression prints by default.

The usual account of why stops at the word heteroskedasticity and moves on. It is worth going one step further, because the step contains a result most readers carry backwards: the robust standard error is not systematically the larger of the two. At the setting above it is 1.2806 times the model-based one. Move the error variance from the edges of the design into its middle and the same comparison reads 0.8246 — the model-based error is a fifth larger than the one that is right, and quoting the robust error as a conservative margin would there be quoting the smaller number.

That is a statement about a ratio, and the ratio has a closed form with exactly one design quantity in it. What follows computes it three ways, checks the three against each other, and then sweeps the dial that reverses the sign.

The bread is the design; the filling is what the errors did

The sandwich estimator is A1BA1A^{-1}BA^{-1}, and the two letters are doing different jobs. The bread A=E[xx]A = E[xx'] is the design’s own second-moment matrix — the thing least squares inverted in order to produce a fit at all — and it knows nothing about the response. The filling B=E[ε2xx]B = E[\varepsilon^2 xx'] is the same matrix with each observation weighted by how large its error was.

The model-based variance is what the sandwich collapses to when the error variance is one number. Write it σ2A1\sigma^2 A^{-1}: the errors’ contribution factors out of BB entirely, one AA cancels, and what is left is the familiar σ2/(xixˉ)2\sigma^2/\sum(x_i - \bar{x})^2 for a slope. The model-based estimate is not a different estimator; it is the sandwich under an assumption, which is why the two agree exactly where the assumption holds and why the disagreement can point either way when it does not.

The disagreement’s size is decided by how the error variance lines up with the design. Write the variance as σ2(x)=σ02(1+γ(u2/v1))\sigma^2(x) = \sigma_0^2\left(1 + \gamma\left(u^2/v - 1\right)\right), with uu the covariate less its mean and vv its variance. The average of that is σ02\sigma_0^2 for every γ\gamma, so the dial changes the shape of the error variance and never its level: a study with γ=0.8\gamma = 0.8 and one with γ=0.4\gamma = -0.4 have exactly as much noise in them. What differs is where the noise sits, and γ>0\gamma > 0 puts it where the leverage is.

Carrying that through the two matrices gives the slope’s variance ratio as

VsandwichVmodel=1+γ(κ1),\frac{V_{\text{sandwich}}}{V_{\text{model}}} = 1 + \gamma(\kappa - 1),

with κ\kappa the covariate’s own kurtosis. Nothing about the amount of noise survives into that expression. The size of the correction is a property of the covariate’s tail and of one shape parameter, and no part of it is a property of how noisy the data is.

What each error is a claim about, and what the claim comes out asEach variance estimate's average over 20000 draws, divided by the variance the slope actually has across those same draws, at 80 rows with the error variance leaning towards the edges of the design (γ = 0.8). One is a standard error that is right. The model-based estimate reads 0.6081 of the spread, so its standard error is 77.98% of the one it should report; the four robust corrections read 0.9576, 0.9821, 0.9961, 1.0362. Two further routes agree with the count and share none of its arithmetic: n times the counted variance is 4.8905 against a population sandwich of 4.9200, and the counted ratio of the two standard errors is 1.2799 against a closed form of 1.2806.the model-based error0.6081assumesHC00.9576robustHC1, n/(n − 2)0.9821robustHC2, 1/(1 − h)0.9961robustHC3, 1/(1 − h)²1.0362robust20000 draws of 80 rows, γ = 0.8one is a standard error that is right
Fig. 1 Each variance estimate’s average over twenty thousand draws of eighty rows, divided by the variance the slope actually has. The model-based estimate reads 0.6081 of that spread; HC2 reads 0.9961. The slider moves the shape of the error variance.

Three routes, and they agree

A ratio is easy to get right by accident, so the level is computed three ways that share no arithmetic.

The first is the spread itself: the variance of twenty thousand fitted slopes, multiplied by the sample size, which comes to 4.89053. That reads no formula at all. The second is the population sandwich, an expectation of a polynomial in the centred covariate against the design’s own central moments, which comes to 4.92000 and reads no data at all. The third is the model-based variance under the same population, 3.00000. The first two agree to within six parts in a thousand, which is about what twenty thousand draws buys; the third is a different quantity and misses the spread by a third.

Reading each estimator against the spread rather than against a formula is what makes the table interpretable. The model-based estimate averages 0.6081 of the variance the slope has, so its standard error is 0.7798 of the one it should report. HC0 reads 0.9576, HC1 0.9821, HC2 0.9961 and HC3 1.0362 — the four differ by less than a twentieth here, and the field’s account of which correction to use is about a design where they differ by a factor of sixteen.

The ratio of the two standard errors follows: 1.2799 counted and 1.2806 in closed form, which is 1.64=1+0.8×0.8\sqrt{1.64} = \sqrt{1 + 0.8 \times 0.8} on a uniform covariate’s kurtosis of 1.8000. Two routes, seven digits of input in common — the design and the dial — and no shared arithmetic between them.

The ratio is the covariate’s fourth moment

The closed form says the correction reads the design’s kurtosis, and four designs are enough to see that it reads nothing else.

At γ=0.8\gamma = 0.8 the even spread over the doubled unit interval gives a sandwich variance of 4.92000 against a model-based 3.00000. The same spread shifted gives the same pair. The same spread widened gives 1.23000 against 0.75000 — a quarter of each, because widening the design quarters the variance of a slope — and therefore the identical ratio of 1.6400. The exponential design gives 7.40000 against 1.00000, a ratio of 7.4000, on a kurtosis of 9.0000 against the uniform’s 1.8000. Every one of those four matches 1+γ(κ1)1 + \gamma(\kappa - 1) to twelve places.

The filling is the design's fourth moment. n times the variance of the slope under the sandwich and under the model, in closed form, on four covariate distributions at a variance leaning towards the edges of the design (γ = 0.8). The bread A = E[xx′] is the same object in both; only the filling B = E[ε²xx′] differs, and its slope element is E[u²σ²(u)] rather than E[σ²]E[u²]. The ratio is exactly 1 + γ(κ − 1) with κ the design's own kurtosis, so the even spreads read ×1.6400 on a kurtosis of 1.80 and the exponential reads ×7.4000 on a kurtosis of 9.00. The size of the correction is a property of the covariate's tail, and no part of it is a property of how much noise there is.
Fig. 2 The slope’s variance under the sandwich and under the model, in closed form on four designs at a variance leaning towards the edges. The two even spreads differ in level by a factor of four and share a ratio of 1.6400; the exponential design’s ratio is 7.4000 on a kurtosis of 9.0000.

The practical reading is that the amount a robust standard error can differ from a model-based one is set before the response is looked at. A covariate with a heavy tail admits a large correction; a covariate spread evenly admits at most a modest one, since κ1=0.8\kappa - 1 = 0.8 bounds the whole effect at 1+0.8γ1 + 0.8\gamma. It is the same quantity in the same position as the leverage in the essay on what one observation does to a slope, seen as a moment rather than as a point.

The direction is the sign of one dial

Sweep γ\gamma from 0.4-0.4 to 0.80.8 at eighty rows, five thousand draws a setting, and the ratio of the two standard errors traces out 1+γ(κ1)\sqrt{1 + \gamma(\kappa - 1)}: 0.8246, 0.9165, 1.0000, 1.0770, 1.1489, 1.2166, 1.2806. The counted ratios are 0.8271, 0.9173, 0.9996, 1.0760, 1.1477, 1.2154 and 1.2798 — within a thousandth at every setting. Two of the seven sit below one and four above.

The two below one are the point of the sweep. At γ=0.4\gamma = -0.4 the error variance is largest in the middle of the design, where the leverage is least, so the observations that move the slope most are the quietest ones and the slope is more stable than a constant-variance calculation says. The model-based standard error is then 1.2222 times the one the slope’s own spread calls for — it over-states the uncertainty by a fifth — while the robust one is 1.0109 times it.

Across all seven settings the robust standard error stays between 1.0054 and 1.0109 of the right one while the model-based one runs from 1.2222 down to 0.7856. That is the honest summary of what a robust standard error buys: not a larger number, but the same number under a change of shape that moves the other one by fifty per cent of its own value.

The correction has no fixed direction. The robust standard error divided by the model-based one, across the shape of the error variance, at 80 rows over 5000 draws apiece. The closed form is √(1 + γ(κ − 1)) with κ the covariate's kurtosis — 1.8 for an even spread — and the count follows it to within a thousandth at every setting. Where the variance is largest at the edges of the design, which is where the leverage is, the robust error is larger: ×1.2806 at γ = 0.8. Where the variance is largest in the MIDDLE it is smaller: ×0.8246 at γ = -0.4, so the model-based error is a fifth larger than the one that is right. A robust standard error is a different estimator rather than a safety margin, and reading it as a margin is a habit the sign of one dial refuses.
Fig. 3 The robust standard error divided by the model-based one across the shape of the error variance, closed form as a line and counts as points. It crosses one at zero, reaching 0.8246 where the variance sits in the middle of the design and 1.2806 where it sits at the edges.

Two readings follow, and both cut against habit. A robust standard error is not conservative. It is an estimate of a different quantity that happens to be the right one, and on a study whose noisy observations sit in the middle of its design it will report a narrower interval than the default. And an analyst who switches to robust errors and finds the numbers barely moved has learned something specific: not that the model is fine, but that γ(κ1)\gamma(\kappa - 1) is small on this design, which can happen because the error variance is nearly constant or because the covariate has no tail for it to lean on.

There is a diagnostic buried in that, and it is a poor one. The ratio of the two standard errors on a single dataset is an estimate of 1+γ(κ1)\sqrt{1 + \gamma(\kappa - 1)}, so an analyst who computes both is holding a noisy reading of exactly the quantity that decides whether the default was safe. The trouble is that both numerator and denominator are noisy at the sample sizes where the answer matters, and the ratio is near one under a wide band of departures — at γ=0.2\gamma = 0.2 the closed form is 1.0770, which a reader would round to “no difference” while the model-based standard error is already 0.9354 of the one it should report. A test built on that comparison is the check before the standard error in a different subject, and it has the same defect there: the departures large enough to detect reliably are the ones large enough to see, and the ones that quietly cost coverage are the ones the check misses.

What each error is a claim about, and what the claim comes out as. Each variance estimate's average over 20000 draws, divided by the variance the slope actually has across those same draws, at 80 rows with the error variance leaning towards the edges of the design (γ = -0.4). One is a standard error that is right. The model-based estimate reads 1.4896 of the spread, so its standard error is 122.05% of the one it should report; the four robust corrections read 0.9884, 1.0137, 1.0196, 1.0520. Two further routes agree with the count and share none of its arithmetic: n times the counted variance is 2.0215 against a population sandwich of 2.0400, and the counted ratio of the two standard errors is 0.8273 against a closed form of 0.8246.
Fig. 4 The same reading at a variance leaning towards the middle of the design. The model-based estimate now averages 1.4896 of the spread the slope has and the unbiased robust one averages 1.0196 — the over-statement is the default’s, not the correction’s.

Where they agree exactly, and what that costs

Set the dial to nought and the two estimators are estimating the same thing. The sweep confirms it at every level: the scaled counted variance is 2.97826 against a population sandwich of 3.00000, the counted ratio of the standard errors is 0.9999 against a closed form of 1.0000, and the model-based estimate averages 1.0069 of the spread against HC2’s 1.0066.

The last pair is the one worth staring at, because it is where the case for a default comes from. Under a constant error variance the two estimates are equally right on average and they are not equally precise. The model-based estimate’s own coefficient of variation across the twenty thousand draws is 0.1608; HC0’s is 0.2156 and HC3’s is 0.2175. The robust estimate is right and noisy; the model-based one, in the one case where it is unbiased, is right and steady. That is the whole of the trade, and the essay that prices it where the risk is absent counts what the noise costs.

The same column at γ=0.8\gamma = 0.8 says the trade does not reverse. The model-based estimate’s coefficient of variation is 0.1976 against HC2’s 0.2615, so it is still the steadier estimate — it is simply steady around the wrong number. A precise estimate of the wrong quantity is the failure mode this whole field is about, and it is not visible in any diagnostic that reads only the estimate’s own variability.

What each error is a claim about, and what the claim comes out as. Each variance estimate's average over 20000 draws, divided by the variance the slope actually has across those same draws, at 80 rows with the error variance leaning towards the edges of the design (γ = 0). One is a standard error that is right. The model-based estimate reads 1.0069 of the spread, so its standard error is 100.34% of the one it should report; the four robust corrections read 0.9714, 0.9963, 1.0066, 1.0432. Two further routes agree with the count and share none of its arithmetic: n times the counted variance is 2.9783 against a population sandwich of 3.0000, and the counted ratio of the two standard errors is 0.9999 against a closed form of 1.0000.
Fig. 5 The same reading under a constant error variance, where the model-based estimate is exactly right. It averages 1.0069 of the spread the slope has, against HC2’s 1.0066 and HC3’s 1.0432.

One squared residual for every variance

There is an objection to the whole construction that deserves an answer rather than a shrug, and it is usually raised as a rhetorical question: the filling asks for the error variance at every row, and there is exactly one observation at every row, so how can anything be estimated at all?

The answer is that the filling is never estimated. What is estimated is a single weighted average of it — B^=1nei2xixi\hat{B} = \frac{1}{n}\sum e_i^2 x_i x_i' is a sum of nn terms whose expectation is the population filling, and a sum of nn noisy terms converges even though not one of the terms individually estimates anything. Each ei2e_i^2 is a hopeless estimate of σ2(xi)\sigma^2(x_i) — it has one degree of freedom and a coefficient of variation of about 2\sqrt{2} — and the average of eighty of them is a perfectly good estimate of the one number the slope’s variance needs.

That is why the robust estimate’s own coefficient of variation is 0.2604 at eighty rows rather than the 2\sqrt{2} of a single squared residual: the averaging has done its work. It is also why the noise does not vanish the way the model-based estimate’s does. The model-based estimate pools every residual into one s2s^2 with n2n - 2 degrees of freedom and then multiplies by a known matrix; the robust one lets each residual keep its own position in the design, so the rows with the most leverage — the rows whose squared residuals matter most to the sum — are exactly the rows there are fewest of. The estimate is right on average and is carried by its extremes, which is the same structure the essay on which resampling keeps a non-constant error variance finds when it asks what a bootstrap must preserve.

And the residual is not the error. The fit removes part of every error, and it removes more of it where the leverage is high, so E[ei2]=σ2(1hii)E[e_i^2] = \sigma^2(1 - h_{ii}) rather than σ2\sigma^2 — the exact statement of the essay that separates residuals from errors. The uncorrected filling is therefore short by construction before any noise is considered, which is the whole content of the four corrections and the reason the choice between them is a question about the design.

What could have produced this without the claim being true

The estimand could have moved. The sweeps in this essay hold the fitted model’s mean correct: the truth is a straight line and only the error variance departs from what least squares assumes. That is deliberate. The projection a wrong mean converges to moves the target as well as the spread, and mixing the two would leave a reader unable to say which defect produced the number. Here the target is the truth’s own slope, the coverage question is clean, and every ratio above is a statement about variance alone.

The residuals could be carrying the misfit rather than the errors. Under the mean model used here they are not, because there is no misfit. Under a curved truth they would be: the filling of a robust estimate is the squared residual, and a squared residual contains the systematic arch as well as the error. That arch is not small — on the even design it runs to 0.3234 at both ends — and it enters the filling as though it were noise, which means a robust standard error computed on a misspecified mean is estimating the spread of an estimator around a projection, not the spread of anything around the truth.

What a straight line through a curve converges to. A quadratic truth over an even spread over [0, 2], and the straight line least squares converges to on it. The line is not a fit to these points: it is the population projection, computable before any data exists, with slope 1.6000 and intercept 0.6667. It is above the truth in the middle of the design and below it at both ends, by 0.3234 at the low end and 0.3234 at the high, and its average against the covariate is exactly nought — which is what a projection is. The misfit is a systematic error the fit cannot remove, and it goes into the sandwich's filling as though it were noise.
Fig. 6 The systematic misfit a straight line leaves against a quadratic truth on the even design: 0.3234 at each end and −0.1667 at the middle. Squared, it enters a robust variance estimate as though it were error.

The count could be an artefact of eighty rows. It is not, in the sense that the closed forms are population quantities and agree with the count, and it is in the sense that eighty rows is a size at which the estimator has a small-sample defect of its own: HC0 reads 0.9576 rather than one here, and at twenty rows the field’s coverage sweep shows that shortfall growing to a fifth. The ratio in this essay is asymptotic and the estimate of it is not, and keeping the two apart is the whole subject of the coverage measurement.

The dial could be doing two things at once. It is not: σ2(x)=σ02(1+γ(u2/v1))\sigma^2(x) = \sigma_0^2(1 + \gamma(u^2/v - 1)) integrates to σ02\sigma_0^2 against the design for every admissible γ\gamma, which is checked rather than asserted, and the machinery refuses a γ\gamma steep enough to take the variance negative somewhere inside the design. A dial that changed the level as well as the shape would produce the same picture for a reason nobody could disentangle.

Where the arithmetic runs out

The collapsed form 1+γ(κ1)1 + \gamma(\kappa - 1) is exact for a symmetric design under a straight-line mean, and it is the form the sweeps here are checked against. The general sandwich is A1BA1A^{-1}BA^{-1} with no such collapse, and on a skewed design under a curved truth the slope element picks up cross-terms between the misfit and the variance shape that no single moment summarises. The full computation still runs — it is the same polynomial expectation — but there is no two-symbol answer to quote, and reporting one would be a tidiness that the object does not have.

It is also stated for a variance that is a stated function of the covariate. A variance that depends on something unmeasured — a group, a time, a latent stratum — is not covered by any of this, and the correction it needs is not a different weight on a row but a different unit of independence altogether. That is the count that is not the rows, where a sandwich whose filling is summed over clusters behaves like a sample of the size of the cluster count rather than of the row count.

And the whole of this essay is about expectations. Every number above is an average over twenty thousand draws or an integral against a population, and an analyst has one dataset. What the average of a variance estimate is worth to somebody holding a single draw is a question about its spread and about the reference distribution it is read against, and both of those get worse exactly where the sample gets small. That is what the coverage measurement counts, and its answer at twenty rows is that an estimate averaging 0.9576 of the truth delivers an interval covering 88.73% rather than 95% — which is a shortfall no amount of being right on average repairs.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Asymptotic varianceClosed formCoefficient of variationEstimated varianceFunctional formHeteroskedasticityHeteroskedasticity-consistentKurtosisLeast squaresLeverageMonte CarloRobust standard errorSandwich estimatorStandard errorVariance ratio