Why Cluster at the Unit Level?
In a panel, repeated observations from the same unit need not provide independent pieces of information. A household’s unobserved circumstances, for example, may affect its outcome in several periods. Treating every unit-period observation as independent can then understate uncertainty, even if the point estimate is unchanged. Unit-clustered inference addresses this by making the unit, rather than the individual observation, the basic contribution to the covariance calculation.
The key operation is to add the estimating-equation contributions over time within each unit, and then form the covariance from those unit-level sums. This allows unrestricted dependence among a unit’s period-specific scores. The usual large-sample justification still needs a condition across units: in the standard version developed here, units are independent, with the average covariance of their scores converging to a finite limit. Clustering by unit does not itself allow arbitrary dependence across units.
The Unit-Clustered Sandwich
Suppose the true parameter is \( \theta_0 \), of dimension \(k\), and \(E[g_i(\theta_0)]=0\). Define the sensitivity matrix and the covariance of the unit-level estimating functions by
For the standard independent-unit result, assume that units are independent, the estimating functions have mean zero and finite moments sufficient for a central limit theorem and consistent covariance estimation, and the estimator is consistent. Also assume that \(A_N\) converges to a nonsingular matrix \(A\), and that \( \Omega_N\) converges to a finite matrix \( \Omega\). A convenient special case is independent and identically distributed units with finite second moments. For independent but non-identically distributed units, convergence of the average score covariance is an additional condition, not an automatic consequence of independence.
Time-period scores within a unit can be dependent and can have different variances across periods. Their joint effect is contained in \(g_i g_i'\). Short-panel asymptotics typically let the number of units grow while the number of periods per unit is fixed or bounded; they do not require the period-level errors within a unit to be independent.
The estimated covariance matrix of \( \hat{\theta} \) is
where \( \widehat{A}^{-1'}\) means the transpose of \( \widehat{A}^{-1}\). The matrix \( \widehat{\Omega}\) is the clustered “meat”; the two sensitivity matrices are the “bread.” The estimated standard error for a component is the square root of its diagonal entry. Some presentations combine the factor \(1/N\) with the meat; the formula is equivalent if the scaling is applied consistently. Small-sample multiplicative adjustments are distinct from this basic large-\(N\) estimator.
Why the Formula Works
The justification is a first-order expansion of the estimating equation around \( \theta_0\). The argument uses the covariance of the sum of unit scores. Under independence across units, cross-unit covariance terms vanish. The within-unit covariance terms do not vanish and are retained by the outer product of each summed score.
Expand \(N^{-1}\sum_i g_i(\hat{\theta})=0\) around \( \theta_0\). With the stated sign convention for \(A_N\), this gives \( \sqrt{N}(\hat{\theta}-\theta_0)=A^{-1}N^{-1/2}\sum_i g_i(\theta_0)+o_p(1)\), when the derivative average converges and the remainder is negligible.
Under the moment and regularity conditions, \(N^{-1/2}\sum_i g_i(\theta_0)\) has limiting covariance \( \Omega\), because the average of the unit score covariance matrices converges to \( \Omega\).
The limiting covariance of \( \sqrt{N}(\hat{\theta}-\theta_0)\) is \(A^{-1}\Omega A^{-1'}\). Therefore the covariance of \( \hat{\theta}\) is approximately \(N^{-1}A^{-1}\Omega A^{-1'}\).
Replace the sensitivity by its sample estimate and \( \Omega\) by the average outer product of the estimated unit scores. Under the stated conditions, these substitutions yield the displayed clustered sandwich estimator.
The crucial covariance statement is for the unit-level scores. If units are weakly dependent rather than independent, cross-unit covariances can contribute to the limiting covariance of \(N^{-1/2}\sum_i g_i\). In that setting, \(N^{-1}\sum_i E[g_i g_i']\) alone is generally not the correct limiting covariance. A different covariance estimator must account for the relevant cross-unit dependence; the ordinary unit-clustered formula does not do so.
Worked Calculations
Worked Example: A Scalar Regression With Two Periods per Unit
Consider the hypothetical regression \(y_{it}=\beta x_{it}+u_{it}\), with no intercept, estimated by pooled least squares. For three units with two observations each, suppose the data are:
| Unit | \(x_{i1},x_{i2}\) | \(y_{i1},y_{i2}\) |
|---|---|---|
| 1 | 1, 1 | 2, 0 |
| 2 | 1, 2 | 1, 3 |
| 3 | 2, 1 | 0, 2 |
The pooled estimate is \( \hat{\beta}=\sum_{i,t}x_{it}y_{it}/\sum_{i,t}x_{it}^2\). Here \( \sum x_{it}y_{it}=2+7+2=11\) and \( \sum x_{it}^2=2+5+5=12\), so \( \hat{\beta}=11/12=0.9167\). The unit score is \(g_i(\hat{\beta})=\sum_t x_{it}(y_{it}-\hat{\beta}x_{it})\). The three scores are
They sum to zero, as required by the fitted estimating equation. The estimated sensitivity is \( \widehat{A}=N^{-1}\sum x_{it}^2=12/3=4\). The estimated meat is
Thus \( \widehat{\operatorname{Var}}(\hat{\beta})=(1/3)(1/4^2)(301/72)=301/3456=0.08710\), and the unit-clustered standard error is \( \sqrt{0.08710}=0.2951\). The computation sums the two period scores within each unit before squaring. With only three units, this example illustrates the formula rather than establishing that a normal approximation is reliable.
Worked Example: Within-Unit Dependence Changes the Meat
Suppose a hypothetical intercept-only panel has three units and two periods per unit, with observations \( (5,7)\), \( (4,4)\), and \( (6,8)\). The estimate of the common mean is \( \hat{\mu}=34/6=17/3\). Each period contributes \(y_{it}-\mu\), so the unit score is the sum of its two residuals. These scores are \(2/3\), \(-10/3\), and \(8/3\), which add to zero. The sensitivity is \( \widehat{A}=2\), because each unit contributes two derivatives of \(-1\). Therefore
For comparison, treating the six observations as independent would use the sum of squared observation-level residuals, \(40/3\), and divide by \(6^2\), giving \(10/27=0.3704\). That calculation omits the within-unit cross-products when the two residuals in each unit are added. The clustered calculation includes them through \(g_i^2\). The difference here is illustrative; neither estimate should be treated as precise inference from just three units.
Worked Example: A Two-Parameter Clustered Regression
For a second hypothetical dataset, there are four units, each observed twice. In both periods of unit \(i\), the regressor is \(x_i\), and the outcome is \(y_{it}=1+2x_i+v_i\). Take \(x_i=(-1,0,1,2)\) and \(v_i=(1,-3,3,-1)\). The residual pattern is orthogonal to both the intercept and regressor because \( \sum_i v_i=0\) and \( \sum_i x_i v_i=0\). Thus pooled least squares gives \( \hat{\beta}=(1,2)'\), where the first component is the intercept.
For \(z_i=(1,x_i)'\), the unit score is \(g_i=\sum_t z_i e_{it}=2v_i z_i\). In order, the scores are \( (2,-2)'\), \( (-6,0)'\), \( (6,6)'\), and \( (-2,-4)'\). Their outer products sum to
The sensitivity is \( \widehat{A}=N^{-1}\sum_{i,t}z_i z_i'=\begin{pmatrix}2&1\\1&3\end{pmatrix}\), whose inverse is \( \frac{1}{5}\begin{pmatrix}3&-1\\-1&2\end{pmatrix}\). Substitution into the sandwich gives
The estimated standard errors are \( \sqrt{1.34}=1.158\) for the intercept and \( \sqrt{0.36}=0.600\) for the slope. The off-diagonal entry records estimated covariance between the two coefficient estimates. This calculation also shows why the meat is a matrix of unit-score outer products: it retains cross-products between the intercept and slope scores as well as dependence across the two periods.
Interpretation, Scope, and a Common Pitfall
With many independent units and the stated regularity conditions, the sandwich estimates the sampling covariance of the estimator under the specified estimating equations, even if the working model does not correctly describe the within-unit covariance matrix. It does not make coefficients causal: that interpretation requires a suitable identification strategy and assumptions. Nor does it correct bias in the point estimator or protect against misspecified moment conditions.
- Wrong reasoning: “There are many unit-period observations, so an observation-level standard error is adequate.” Repeated observations from one unit may have correlated scores, so the number of rows can overstate the amount of independent information.
- Correction: Form \(g_i\) by summing scores within each unit, then use the outer products \(g_i g_i'\). The large-sample argument is based on the number of independent units \(N\), not the total number of rows.
- Wrong reasoning: “Clustering by unit permits any dependence in the panel.” The usual estimator allows arbitrary dependence within a unit, not arbitrary dependence across units.
- Correction: State the cross-unit assumption explicitly. Under independent units, the average unit-score covariance supplies the meat. Under cross-unit dependence, covariances between different units may also contribute and require a method that accounts for them.
A large number of observations is not a substitute for a large number of independent units. When the number of clusters is small, conventional cluster-robust standard errors and normal or large-sample \(t\)-based approximations can be inaccurate. The large-\(N\) derivation here does not resolve that issue; it is a separate finite-cluster problem.
Check Your Understanding
Use the definitions and formulas in this tutorial to answer the following.
- For a panel estimating equation, what is the unit-level score, and why is it formed before taking outer products?
- Which assumptions permit the average of \(g_i g_i'\) to estimate the limiting score covariance in the standard unit-clustered result?
- In a scalar estimating equation with \(N\) units, explain the roles of \(A\), \(\Omega\), and the factor \(1/N\) in the estimated covariance.
- Why can an observation-level covariance calculation differ from one based on unit-level score sums?
- If adjacent unit scores are correlated, why may the ordinary unit-clustered meat fail to estimate the limiting covariance of the normalized score sum?