Why Cluster-Robust Inference Has Conditions
Cluster-robust standard errors are used when observations in the same group may be related—for example, patients treated at the same clinic or students attending the same school. They change how uncertainty is estimated, allowing residuals within a cluster to be correlated. That flexibility does not make inference assumption-free. In particular, the clusters must provide independent contributions, there must be enough such contributions for the usual approximation, and the regression mean model must be appropriate for the coefficient being interpreted.
These conditions concern different parts of the analysis. Independence and the number of clusters support the variance approximation. The mean-model condition supports the interpretation and estimation of the regression coefficients. A cluster-robust variance estimator addresses neither a misspecified mean nor dependence that remains between supposedly separate clusters.
Model and Core Conditions
Suppose observations are grouped into \(G\) clusters. Write \(y_{ig}\) for the outcome and \(\mathbf{x}_{ig}\) for the vector of predictors (including an intercept if the model has one), for observation \(i=1,\ldots,n_g\) in cluster \(g=1,\ldots,G\). The linear regression mean model is
Here \(\boldsymbol{\beta}\) is the coefficient vector and \(u_{ig}\) is the error. A standard sufficient condition for the mean model is that the conditional mean of the error is zero given the predictors in the relevant data:
where \(\mathbf{X}\) denotes the full predictor design. This condition says that, after accounting for the included predictors and the specified functional form, the model has no systematic mean error. It is stronger than merely requiring the errors to average to zero across the whole sample.
The independence condition applies to the clusters’ contributions to estimation—not necessarily to each observation inside a cluster. In a sampling framework, clusters should be independently sampled or otherwise plausibly independent. In an experiment, the design and source of dependence must likewise support treating the clusters as independent units. If clinics share a common shock, for example, treating each clinic as independent may be inappropriate even if patients within each clinic are clustered correctly.
The second condition is asymptotic: the usual cluster-sandwich approximation is justified as the number of independent clusters \(G\) grows. The number of individual observations alone does not replace this requirement. Repeatedly adding observations to only a few clusters does not provide the same accumulation of independent information as adding clusters. There is no universal threshold that makes a particular value of \(G\) automatically sufficient; the number and structure of clusters must be considered in context.
The design must also contain enough variation to estimate the coefficients: the predictor columns cannot be perfectly redundant. For the usual large-cluster approximation, no single cluster should dominate the total information, and the cluster contributions should have suitable finite moments. These regularity conditions express the idea that the approximation is built from many reasonably well-behaved cluster contributions rather than being controlled by one exceptional group.
Why Cluster Independence Matters: A Short Justification
Let \(\mathbf{S}_g=\sum_{i=1}^{n_g}\mathbf{x}_{ig}u_{ig}\) be the score-like contribution of cluster \(g\) to the estimating equation for least squares. Under the linear model, the coefficient estimation error can be written as the inverse design cross-product multiplied by the sum of these cluster contributions:
If clusters are independent and each contribution has mean zero, the variance of the sum is the sum of the cluster variances. Within a cluster, however, the terms \(\mathbf{x}_{ig}u_{ig}\) and \(\mathbf{x}_{jg}u_{jg}\) may be correlated, so they must be combined before forming the variance contribution. This is the reason the clustered sandwich uses a cluster-level sum rather than treating each observation as an independent contribution.
The empirical cluster-sandwich variance estimate has the same structure. With \(\mathbf{x}_{ig}\) treated as column vectors, define the cluster residual score \(\widehat{\mathbf{S}}_g=\sum_i\mathbf{x}_{ig}\widehat{u}_{ig}\). An uncorrected form is
The middle factor keeps the within-cluster products together. The outer factors scale that estimated variability to the coefficient scale. The formula does not, by itself, verify that clusters are independent, that there are enough of them, or that the mean model is correct. Those are features of the design and model, not facts that can be established by calculating the sandwich.
Worked Example: Identifying the Independent Units
Suppose a hypothetical analysis relates a clinic’s average patient outcome to a clinic-level predictor. The data contain 48 clinics and 20 patients per clinic, for \(48\times20=960\) patient records. Assume the clinics were independently sampled from distinct catchment areas, with no shared organization-wide intervention or other known source of dependence between them.
Model and clustering. A patient-level regression could be written \(y_{ig}=\beta_0+\beta_1x_{ig}+u_{ig}\), where \(g\) indexes clinic. If patient outcomes within a clinic may be related, the clinic is the cluster: the patient records within it need not be independent.
Independence check. The stated sampling setup makes independence across the 48 clinics plausible. It does not establish that every possible source of cross-clinic dependence is absent, so the design and context still matter. If all clinics shared a common intervention or a common unmodeled shock, the independence assumption would need reconsideration.
Cluster-count check. The relevant count is 48 clusters, not 960 observations. Forty-eight independent contributions provide a basis for a large-cluster approximation that 960 observations concentrated in just a few clinics would not provide in the same way. This count alone does not certify the approximation; there is no universal cutoff that settles the question.
Mean-model check. The assumed regression mean must also be suitable. For example, if the outcome’s mean changes nonlinearly with \(x_{ig}\) but the model includes only a straight-line effect, cluster-robust standard errors do not correct that mismatch. The example’s sampling description helps assess clustering, but it does not establish that the chosen predictors and functional form are adequate.
Worked Example: Calculating a Cluster-Sandwich Quantity
Consider hypothetical outcomes from three independent clusters, with two observations per cluster, and fit an intercept-only model \(y_{ig}=\beta_0+u_{ig}\). The six outcomes are \(8,10\) in cluster 1, \(9,13\) in cluster 2, and \(11,15\) in cluster 3. This calculation illustrates the cluster-sandwich arithmetic; three clusters are not presented as enough to justify usual large-cluster inference.
The fitted intercept is the overall sample mean:
For an intercept-only model, each observation’s predictor is \(1\), so the cluster residual score is the sum of that cluster’s residuals. The residuals and scores are:
The scalar design cross-product is \(6\), and the cluster meat is the sum of squared cluster scores, \((-4)^2+0^2+4^2=32\). Thus the uncorrected sandwich variance and its square root are:
The arithmetic shows how the variance estimate uses whole-cluster residual sums. It does not make a reliable inferential procedure out of this three-cluster example: the large-cluster condition is not established, and the calculation cannot test whether the mean model or independence assumptions hold.
Worked Example: A Robust Variance Does Not Fix a Wrong Mean
Suppose a hypothetical outcome has conditional mean \(E(Y\mid x)=x^2\), and observations occur in otherwise independent clusters. Consider fitting a straight-line mean model with an intercept using equally weighted predictor values \(x=-1,0,1\). The true mean outcomes at these values are \(1,0,1\).
The best-fitting straight line for these three mean values has slope zero: the deviations of \(x\) from zero are balanced, while the outcomes at \(-1\) and \(1\) are equal. Its intercept is the mean outcome:
The residual mean at each predictor value is therefore
These conditional residual means are not zero. The straight-line mean model has omitted the curvature in the true relationship, so the zero-conditional-mean condition for that model fails. A cluster-robust variance may allow residuals within each cluster to covary, but it cannot remove this systematic pattern or turn the fitted straight-line coefficient into a description of the quadratic mean relationship.
What the Conditions Do—and Do Not—Provide
When the mean model is appropriate, the clusters are independent, and the number of clusters is sufficiently large for the approximation, cluster-robust inference can account for a broad range of within-cluster dependence without specifying its exact covariance pattern. This is useful when the within-cluster correlation structure is complicated or not of direct interest.
The conditions are not interchangeable. A very large number of observations cannot repair dependence across clusters. Independent clusters cannot repair an omitted nonlinear term or an endogenous predictor. A correctly specified mean cannot make a variance approximation dependable if it rests on too few independent cluster contributions. Each condition needs a separate assessment based on the design, substantive knowledge, and model.
The coefficient’s interpretation also depends on the mean model and study design. A regression coefficient describes an adjusted association under the specified model; cluster-robust uncertainty does not establish causation. In a randomized study, causal interpretation additionally relies on the assignment design and the estimand being studied, not on the sandwich formula alone.
Common Mistakes
- Counting records instead of independent clusters. Saying “there are 900 observations, so the cluster approximation is safe” ignores whether those records come from many or few independent groups. Count the clusters and assess whether they can reasonably be treated as independent.
- Assuming “robust” means any dependence is allowed. Cluster-robust methods allow dependence within a declared cluster; they do not automatically account for dependence between declared clusters. The clustering definition must reflect the design and plausible sources of shared variation.
- Using robust standard errors as a cure for a misspecified mean. A sandwich variance changes the uncertainty calculation, not the fitted mean. Check whether the included predictors and functional form represent the conditional mean needed for the coefficient’s interpretation.
- Treating a computed standard error as proof that assumptions hold. A numerical result can be calculated even when the conditions are doubtful. The calculation does not establish independence, adequate cluster count, or mean-model correctness.
Check Your Understanding
Answer in the context of the model and design, not just by naming an assumption.
- A data set contains 1,200 patients from 6 hospitals. Which count is relevant to the usual cluster asymptotic justification, and why?
- What kind of dependence does a cluster-robust variance estimate allow, and what independence condition does it still require?
- Why does a large number of observations within each cluster not necessarily substitute for a large number of independent clusters?
- A straight-line model is used when the conditional mean is curved in a predictor. Which key condition fails, and what does a cluster-robust standard error not fix?
- In the intercept-only worked example, why were residuals summed within each cluster before squaring the cluster contribution?