Tutorials › Econometrics (Graduate) › Observation-Level Contributions to HC Covariance

Heteroskedasticity-Robust Inference · Tutorial 121 of 952

Observation-Level Contributions to HC Covariance

Learn to calculate HC covariance contributions observation by observation, summarize which observations drive a target variance, and interpret concentration cautiously.

Intermediate 12 min read

What You'll Learn

  • Write an HC covariance estimator as a sum of observation-level matrix contributions.
  • Calculate each observation’s contribution to the estimated variance of a coefficient or contrast.
  • Distinguish contributions to the covariance “meat” from contributions to the final covariance matrix.
  • Compare HC0 and leverage-adjusted HC2 contributions in a worked regression.
  • Use contribution shares to flag concentrated, potentially unstable standard errors without treating the shares as a formal test.

Why Inspect Observation-Level Contributions?

A heteroskedasticity-consistent standard error can be valid even when the error variance changes across observations. But a reported standard error is a single summary: it does not show whether its estimated variance is supported broadly across the sample or is driven mainly by a few observations. That distinction matters when a small change in the data or in the HC adjustment could substantially change the result.

The HC covariance estimator has an additive structure. Each observation supplies a piece to its middle matrix, often called the meat, and therefore a corresponding piece to the final covariance matrix. For a particular coefficient or linear contrast, these pieces reduce to nonnegative contributions to the estimated variance. Examining them makes it possible to describe concentration directly, while keeping clear that such a description is a diagnostic—not a replacement for the estimator or a formal test.

The Model and the HC Decomposition

Let \(y_i\) be the outcome and \(x_i\) a \(k\)-component column vector of regressors for observation \(i\), including a constant if the model has an intercept. Write \(X\) for the \(n\) by \(k\) design matrix, and suppose \(X\) has full column rank. The linear conditional-mean model is \(y_i=x_i'\beta+u_i\), where \(E(u_i\mid X)=0\). For heteroskedasticity-robust inference, observations are assumed independent conditional on \(X\), with finite error variances that need not be equal. The HC covariance estimator is motivated by this setting; its usual large-sample justification also requires appropriate regularity conditions.

Let \(\hat\beta=(X'X)^{-1}X'y\) be the ordinary least-squares estimator, let \(\hat u_i=y_i-x_i'\hat\beta\) be its residual, and put \(A=(X'X)^{-1}\). An HC estimator uses residual squares with an observation-specific adjustment. Write that adjustment as \(\lambda_i\). Then the estimator is

$$ \widehat{\operatorname{Var}}_{\mathrm{HC}}(\hat\beta) =A\left(\sum_{i=1}^{n}\lambda_i\hat u_i^{\,2}x_i x_i'\right)A. $$

The middle matrix is the meat: it is the sum of the observation-level matrices \(\lambda_i\hat u_i^{\,2}x_i x_i'\). The matching contribution to the final covariance matrix is

$$ C_i=\lambda_i\hat u_i^{\,2}(Ax_i)(Ax_i)', \qquad \widehat{\operatorname{Var}}_{\mathrm{HC}}(\hat\beta)=\sum_{i=1}^{n}C_i. $$

This follows by distributing \(A\) over the sum and using the symmetry of \(A\). Each \(C_i\) is positive semidefinite: for any vector \(a\), \(a'C_i a=\lambda_i\hat u_i^{\,2}(a'Ax_i)^2\geq 0\), provided \(\lambda_i\geq0\). The off-diagonal entries of \(C_i\), however, can be negative. So the matrices add up observation by observation, but their individual entries are not all nonnegative.

Definition: An observation-level HC covariance contribution is the matrix \(C_i=\lambda_i\hat u_i^{\,2}(Ax_i)(Ax_i)'\) that observation \(i\) adds to the estimated covariance matrix. For a coefficient or linear contrast, its contribution to the estimated variance is a nonnegative scalar obtained by evaluating that matrix in the direction of the target.

Common choices of \(\lambda_i\) include \(1\) for HC0, \(n/(n-k)\) for HC1, \(1/(1-h_{ii})\) for HC2, and \(1/(1-h_{ii})^2\) for HC3, where \(h_{ii}=x_i'Ax_i\) is the observation’s leverage. HC1 applies the same multiplier to every observation; HC2 and HC3 adjust each observation according to its leverage. The decomposition works for each choice, but the contributions—and their relative sizes—can change with the choice.

Contributions for a Coefficient or Contrast

Let \(c\) be a \(k\)-component vector defining a target \(c'\beta\). For example, \(c\) can select one coefficient, or it can define a difference between two coefficients. The estimated variance of \(c'\hat\beta\) is \(c'\widehat{\operatorname{Var}}_{\mathrm{HC}}(\hat\beta)c\). Its observation-level contribution is

$$ q_i(c)=c'C_i c =\lambda_i\hat u_i^{\,2}(c'Ax_i)^2, \qquad \widehat{\operatorname{Var}}_{\mathrm{HC}}(c'\hat\beta) =\sum_{i=1}^{n}q_i(c). $$

The square in this expression makes every \(q_i(c)\) nonnegative when the HC adjustment is nonnegative. If the total variance is positive, the share \(q_i(c)/\sum_j q_j(c)\) gives the fraction of that estimated variance supplied by observation \(i\). These shares are specific to the target: an observation can contribute substantially to one coefficient’s variance and little to another’s.

Worked Example: Decomposing an HC0 Covariance Matrix

Consider a hypothetical regression with an intercept and one regressor. The four observations have \(x_i=-1,0,1,2\) and outcomes \(y_i=2,0,4,4\). We calculate their HC0 contributions, so \(\lambda_i=1\).

Check the fitted regression. The sample means are \(\bar{x}=0.5\) and \(\bar{y}=2.5\). The slope is \((\sum_i x_i y_i-n\bar{x}\bar{y})/(\sum_i x_i^2-n\bar{x}^2)=(10-5)/(6-1)=1\), and the intercept is \(2.5-1(0.5)=2\). Thus \(\hat y_i=2+x_i\), giving residuals \(1,-2,1,0\). They satisfy \(\sum_i\hat u_i=0\) and \(\sum_i x_i\hat u_i=0\), as required by the least-squares normal equations.

Calculate the bread. With \(x_i\) vectors written as \((1,x_i)'\),

$$ X'X= \begin{pmatrix} 4&2\\ 2&6 \end{pmatrix}, \qquad A=(X'X)^{-1} = \begin{pmatrix} 0.3&-0.1\\ -0.1&0.2 \end{pmatrix}. $$

Calculate the meat. The residual squares are \(1,4,1,0\). Therefore the meat is \(\sum_i\hat u_i^{\,2}x_i x_i'=\begin{pmatrix}6&0\\0&2\end{pmatrix}\). For instance, the off-diagonal entry is \(\sum_i\hat u_i^{\,2}x_i=-1+0+1+0=0\). The final HC0 covariance estimate is

$$ A \begin{pmatrix} 6&0\\ 0&2 \end{pmatrix} A = \begin{pmatrix} 0.56&-0.22\\ -0.22&0.14 \end{pmatrix}. $$

Verify by adding observation contributions. The transformed regressors \(Ax_i\) are \((0.4,-0.3)'\), \((0.3,-0.1)'\), \((0.2,0.1)'\), and \((0.1,0.3)'\). Multiplying each outer product by its residual square gives

$$ C_1= \begin{pmatrix}0.16&-0.12\\-0.12&0.09\end{pmatrix}, \quad C_2= \begin{pmatrix}0.36&-0.12\\-0.12&0.04\end{pmatrix}, \quad C_3= \begin{pmatrix}0.04&0.02\\0.02&0.01\end{pmatrix}, \quad C_4= \begin{pmatrix}0&0\\0&0\end{pmatrix}. $$

Their sum is the covariance matrix above. Notice that observation 2 has a negative off-diagonal contribution. That does not make its covariance contribution invalid: the whole matrix \(C_2\) is positive semidefinite, and its contribution to the variance of any specified contrast is nonnegative.

Finding Which Observations Drive a Target Variance

For the slope in the example, take \(c=(0,1)'\). The slope component of \(Ax_i\) is \(-0.1+0.2x_i\). Under HC0, the contributions are the squared residual multiplied by the square of this component:

Worked Example: Ranking Contributions to the Slope Variance

Using the same hypothetical regression, calculate \(q_i(c)\) for the slope coefficient. The relevant values of \(c'Ax_i\), in observation order, are \(-0.3,-0.1,0.1,0.3\). Thus,

$$ (q_1,q_2,q_3,q_4) =(1(0.3)^2,\;4(0.1)^2,\;1(0.1)^2,\;0(0.3)^2) =(0.09,\;0.04,\;0.01,\;0). $$

The variance estimate is \(0.09+0.04+0.01=0.14\), matching the slope’s diagonal entry in the HC0 covariance matrix. The corresponding standard error is \(\sqrt{0.14}=0.3742\) in outcome units per unit of \(x\).

The contribution shares are \(0.09/0.14=64.29\%\), \(0.04/0.14=28.57\%\), \(0.01/0.14=7.143\%\), and \(0\%\). The first observation alone supplies nearly two-thirds of this estimated slope variance. A descriptive summary of concentration is the effective number of contributors, defined here as \((\sum_i q_i)^2/\sum_i q_i^2\). For these values it is \(0.14^2/(0.09^2+0.04^2+0.01^2)=2.000\). This says the observed contributions are as concentrated, by this particular summary, as two equal contributions would be. It is not a formal count of independent observations or a test of inference quality.

How Leverage Adjustments Change the Decomposition

The observation-level display is also useful for seeing how an HC adjustment changes the estimated variance. With HC2, each residual square is divided by \(1-h_{ii}\). In the example, the leverages are \(h_{ii}=x_i'Ax_i\), which evaluate to \(0.7,0.3,0.3,0.7\). They are all below one, so the HC2 adjustment is defined. For the slope, the unadjusted squared pieces \(0.09,0.04,0.01,0\) are divided by \(0.3,0.7,0.7,0.3\), respectively.

Worked Example: Diagnosing Concentration Under HC2

For the same hypothetical data, the HC2 slope-variance contributions are

$$ (q_1,q_2,q_3,q_4) = \left( \frac{0.09}{0.3}, \frac{0.04}{0.7}, \frac{0.01}{0.7}, \frac{0}{0.3} \right) =(0.3000,\;0.05714,\;0.01429,\;0). $$

The HC2 slope-variance estimate is \(0.3000+0.05714+0.01429=0.3714\), with standard error \(\sqrt{0.3714}=0.6094\) in outcome units per unit of \(x\). The first observation contributes \(0.3000/0.3714=80.77\%\) of that variance; the second contributes \(15.38\%\), and the third \(3.846\%\). In this small hypothetical sample, the leverage adjustment makes the already largest contribution more dominant. This calculation illustrates a possible instability signal; it does not establish that HC2 is inappropriate or that a particular inferential conclusion is wrong.

Using Contribution Summaries Carefully

A concentrated contribution profile is a reason to investigate the sensitivity of the reported standard error, not a reason to discard observations automatically. A large contribution can reflect a large residual, a regressor vector that strongly projects onto the target after multiplication by \(A\), a large HC adjustment, or a combination of these. In leverage-adjusted HC estimators, a factor such as \(1/(1-h_{ii})\) can amplify a residual-based piece when leverage is high.

It is useful to report the target being examined, the HC estimator used, the largest contribution shares, and—if helpful—a concentration summary. Comparing contribution profiles across HC variants can reveal whether a large standard error is broadly supported or depends heavily on a few adjusted pieces. For an overall covariance matrix, inspect target variances or specified contrasts rather than trying to rank observations by individual matrix entries: off-diagonal contributions may be negative, and “largest matrix contribution” has no single natural ranking without a chosen measure.

These calculations do not measure how much an observation would change the regression estimate if removed. They decompose the covariance estimator at the fitted model and for a stated target. Nor do they establish that an observation is erroneous, influential in every sense, or responsible for a causal effect. Such conclusions require additional analysis and substantive context.

Common Pitfall

  • Wrong reasoning: “One observation contributes 65% of the slope variance, so the robust standard error is invalid and that observation should be removed.”
  • Correction: The share identifies concentration in this estimator for this target. It is a diagnostic prompt to check the data, design, residual, HC choice, and sensitivity of the result. It is not itself a validity test, and deleting a genuine observation just to reduce its share can introduce bias.
  • Wrong reasoning: “A negative off-diagonal entry means an observation has a negative covariance contribution.”
  • Correction: Individual covariance matrices can have negative off-diagonal entries while remaining positive semidefinite. For a specified contrast, calculate \(q_i(c)=c'C_i c\); that scalar contribution is nonnegative under a nonnegative HC adjustment.
Key takeaway: For a specified target \(c'\beta\), the HC variance is the sum of \(q_i(c)=\lambda_i\hat u_i^{\,2}(c'Ax_i)^2\). Contribution shares reveal how concentrated that estimated variance is, but they are descriptive diagnostics, not formal tests or automatic reasons to alter the data.

Check Your Understanding

Use the decomposition and examples above to check your understanding.

  1. What is the observation-level contribution \(C_i\) to an HC covariance matrix, and why is it positive semidefinite when \(\lambda_i\geq0\)?
  2. For a target \(c'\beta\), explain why its observation-level variance contribution is nonnegative even when an off-diagonal entry of \(C_i\) is negative.
  3. In the HC0 slope example, which observation has the largest variance contribution, and what percentage of the total does it supply?
  4. How does HC2 change the first observation’s contribution in the example, and what feature of the design enters that adjustment?
  5. Why should a large contribution share prompt investigation rather than automatic deletion of the observation?
Clinical Biostats