Tutorials › Causal Inference › Inference With Few Clusters in DiD

Difference-in-Differences · Tutorial 600 of 972

Inference With Few Clusters in DiD

Learn how to assess and adjust DiD inference when the number of independent clusters is small.

Intermediate 11 min read

What You'll Learn

  • Explain why large-cluster approximations can fail when a DiD analysis has few clusters.
  • Distinguish a finite-sample variance correction from a degrees-of-freedom adjustment.
  • Interpret CR2 standard errors and contrast-specific Satterthwaite degrees of freedom.
  • Carry out a wild cluster bootstrap-t test under a null hypothesis.
  • Recognize why few treated clusters can limit the reliability of every available method.

Why the Number of Clusters Matters

In a difference-in-differences analysis, outcomes from units in the same assignment cluster may share shocks. Cluster-robust standard errors allow this within-cluster dependence, but their usual justification relies on having many independent clusters. A data set can contain thousands of individuals and still provide little information for inference if treatment was assigned in only a small number of schools, hospitals, or regions.

The key sample size for cluster-robust inference is the number of independent clusters, not the number of individual observations. With few clusters, the estimated variance can be biased downward, and the usual normal reference distribution can make tests too likely to reject a true null hypothesis. These problems can be acute when only a few clusters receive treatment or when cluster sizes and leverage differ substantially.

Definition: In cluster-robust DiD inference, a cluster is a group of observations whose errors may be dependent within the group, while errors are assumed independent across clusters. Let \(G\) denote the number of independent clusters. “Few clusters” means that \(G\) is too small for the large-\(G\) approximation underlying conventional cluster-robust inference to be dependable; there is no single cutoff that applies to every design.

For a two-period illustration, a common regression is

$$ Y_{ict}=\alpha_c+\lambda_t+\tau(D_c\times Post_t)+u_{ict}, $$

where \(Y_{ict}\) is the outcome for unit \(i\) in cluster \(c\) at time \(t\), \(\alpha_c\) and \(\lambda_t\) are cluster and time effects, \(D_c\) indicates a treated cluster, and \(Post_t\) indicates the post-intervention period. The coefficient \(\tau\) is the DiD interaction estimate. A causal interpretation still requires the relevant identification assumptions, including parallel trends; changing the standard error method does not establish them. The discussion here concerns uncertainty quantification for the estimated coefficient.

Write the regression in matrix form as \(Y=X\hat{\beta}+\hat{u}\), with \(X_c\) and \(\hat{u}_c\) denoting the regressors and residuals for cluster \(c\). The basic cluster sandwich covariance estimator has the form

$$ \widehat{V}_{CR0} =(X'X)^{-1} \left(\sum_{c=1}^{G}X_c'\hat{u}_c\hat{u}_c'X_c\right) (X'X)^{-1}. $$

Each cluster contributes one score-like quantity to the “meat” of this estimator. With many independent clusters, the aggregate can often be approximated by a normal distribution. With few clusters, that approximation and the estimated variance may both be poor. The usual large-sample standard error alone does not account for this uncertainty about the reference distribution.

Finite-Sample Adjustments and Degrees of Freedom

One common adjustment, often called CR1, multiplies the CR0 covariance estimate by a finite-sample factor. A frequently used version is

$$ \widehat{V}_{CR1} = \frac{G}{G-1}\frac{N-1}{N-K}\widehat{V}_{CR0}, $$

where \(N\) is the number of observations and \(K\) is the number of estimated regression coefficients. Implementations vary in the correction they use. The factor can increase the estimated variance, but it does not by itself ensure valid inference with few clusters. In particular, multiplying a covariance estimate by a correction factor and choosing an appropriate reference distribution are separate decisions.

A simple degrees-of-freedom choice for a cluster-robust test is a \(t\) distribution with \(G-1\) degrees of freedom rather than the standard normal distribution. This recognizes that the number of independent cluster contributions is limited. It is a useful basic adjustment, but \(G-1\) need not accurately reflect the information available for a particular coefficient when treatment is concentrated in a few clusters or cluster leverage is uneven.

Justification: Suppose, as an idealized case, that under the null a contrast is estimated from \(G\) independent, normally distributed cluster contributions with a common mean and variance. The studentized mean of those contributions then has an exact \(t\) distribution with \(G-1\) degrees of freedom. In a regression, cluster contributions need not be equally variable or equally influential, so this exact argument generally does not apply. It explains the \(G-1\) reference as a small-sample approximation, not a universal solution.

Worked Example: Comparing Normal and Small-Cluster Inference

Suppose a hypothetical two-period DiD regression has 12 independent clusters, 6 treated and 6 comparison clusters. The estimated treatment effect is \(4.80\) outcome points, and its conventional cluster-robust standard error is \(2.40\) points. Assume the model and the cluster definition are appropriate, and consider a two-sided test of \(H_0:\tau=0\).

The test statistic is

$$ t=\frac{4.80-0}{2.40}=2.00. $$

Using a standard normal reference gives a two-sided \(p\)-value of about \(0.0455\). That would just pass a 5% threshold, but the normal reference is a large-sample approximation. Using the simple \(t_{G-1}=t_{11}\) reference instead gives a two-sided \(p\)-value of about \(0.0709\), which does not pass that threshold.

The corresponding 95% interval using the \(t_{11}\) critical value \(2.201\) is

$$ 4.80\pm 2.201(2.40) =4.80\pm 5.2824 =[-0.4824,\ 10.0824]\text{ points}. $$

This interval includes zero. Under this reference-distribution approximation, the data do not provide evidence against a zero effect at the 5% level. The change in conclusion illustrates why using many individual observations does not justify a normal approximation when the independent-cluster count is small.

Bias-Reduced Variance Estimation

A further option is a bias-reduced cluster covariance estimator, commonly called CR2. Its adjustment accounts for the leverage of observations or clusters in fitting the regression, in a manner analogous to small-sample corrections for heteroskedasticity-robust variance estimation. The aim is to reduce finite-sample bias in the estimated covariance; the adjustment is not a guarantee that the resulting test is exact.

CR2 is commonly paired with a Satterthwaite approximation for the degrees of freedom of the coefficient or contrast being tested. This approximation uses the estimated variability and influence pattern of that specific contrast. Consequently, its degrees of freedom can be fractional and can be much smaller than \(G-1\). The standard error adjustment and the degrees-of-freedom calculation are both relevant: reporting a CR2 standard error but silently using a normal reference can discard an important part of the small-sample procedure.

Worked Example: Using CR2 With Contrast-Specific Degrees of Freedom

Consider a hypothetical DiD study with 8 independent clusters, only 3 of which are treated. Suppose a CR2 analysis reports an estimated effect of \(3.20\) points, a CR2 standard error of \(1.80\) points, and Satterthwaite degrees of freedom of \(4.6\) for this contrast. Assume the model and clustering are appropriate; the reported degrees of freedom reflect the leverage and treatment allocation in this design.

The test statistic for \(H_0:\tau=0\) is

$$ t=\frac{3.20}{1.80}=1.778. $$

Using a \(t_{4.6}\) reference gives a two-sided \(p\)-value of approximately \(0.14\). The 97.5th percentile of this reference distribution is about \(2.64\), so the 95% interval is

$$ 3.20\pm 2.64(1.80) =3.20\pm 4.752 =[-1.552,\ 7.952]\text{ points}. $$

The interval includes zero, and the test does not reject the null at the 5% level. The result is less precise than a calculation using a normal reference would suggest. The degrees of freedom are below \(G-1=7\), which is plausible here because treatment is assigned in only 3 clusters. This calculation uses the stated CR2 output; it does not imply that CR2 can compensate for having very little independent treatment information.

Wild Cluster Bootstrap Inference

A wild cluster bootstrap-t is another method for testing a DiD coefficient with few clusters. The procedure constructs a reference distribution by repeatedly generating bootstrap outcomes under the null hypothesis, while preserving dependence within each cluster. A typical implementation restricts the regression under \(H_0:\tau=\tau_0\), applies a common random weight to the residuals within each cluster, and refits the regression in each bootstrap sample. It then compares the observed studentized statistic with the bootstrap statistics.

For example, with Rademacher weights, each cluster independently receives a weight of \(+1\) or \(-1\), each with probability \(1/2\). Applying the same weight to all residuals in a cluster preserves their within-cluster pattern. Each bootstrap replication must use the same regression specification and cluster definition as the original analysis. The null restriction matters: for a test of zero effect, the bootstrap samples should be generated under the zero-effect null rather than treating the unrestricted fitted effect as true.

For \(B\) bootstrap replications, a commonly used two-sided bootstrap \(p\)-value with a finite-simulation adjustment is

$$ \hat{p}_{boot} = \frac{1+\sum_{b=1}^{B}I(|t_b^*|\geq |t_{obs}|)}{B+1}, $$

where \(t_{obs}\) is the observed studentized statistic, \(t_b^*\) is the statistic in bootstrap replication \(b\), and \(I(\cdot)\) equals 1 when its condition is true and 0 otherwise. The added 1 prevents reporting a zero \(p\)-value merely because none of the simulated statistics exceeded the observed one.

Worked Example: Calculating a Wild Cluster Bootstrap p-Value

Suppose a hypothetical DiD estimate is \(5.00\) points with a cluster-robust standard error of \(2.00\) points. The observed statistic for testing \(H_0:\tau=0\) is

$$ t_{obs}=\frac{5.00}{2.00}=2.50. $$

A restricted wild cluster bootstrap with \(B=999\) replications is run using the same model and clusters. In 87 replications, the absolute bootstrap statistic is at least \(2.50\). Thus,

$$ \hat{p}_{boot} = \frac{1+87}{999+1} = \frac{88}{1000} = 0.088. $$

This bootstrap test does not reject the zero-effect null at the 5% level. The result is a simulated \(p\)-value under the specified bootstrap procedure, not the probability that the null hypothesis is true. A different valid implementation, weight distribution, or small set of clusters can produce different finite-sample behavior, so the procedure should be reported clearly rather than treated as an automatic guarantee.

What These Methods Can and Cannot Fix

Small-sample corrections and bootstrap procedures address the uncertainty calculation, not the causal design. They do not repair violations of parallel trends, treatment misclassification, or a cluster definition that fails to capture relevant dependence. They also cannot create independent treatment assignments that the study did not have.

In particular, few treated clusters are a serious limitation even if the total number of clusters seems moderate. If a policy is adopted by only two regions, for example, the evidence about treatment effects may be highly sensitive to those regions. A bootstrap with many replications does not turn those two treated clusters into many independent pieces of information. When feasible, researchers should report the numbers of treated and comparison clusters, cluster sizes, the variance correction, reference distribution and degrees of freedom, and the bootstrap design and replication count.

A common mistake is to reason: “There are thousands of people in the data, so the cluster-robust \(z\)-test must be reliable.” The correction is that people within a cluster may share shocks, so they are not thousands of independent contributions to the variance estimate. Inference must reflect the independent clusters and how treatment is distributed among them.

No small-cluster method is uniformly best for every design. A transparent analysis may report a well-justified bias-reduced method and a wild cluster bootstrap as a sensitivity check, while emphasizing the small number of independent clusters. Agreement between methods can be reassuring, but it is not proof that their assumptions hold.

Key takeaway: With few clusters, conventional cluster-robust standard errors and normal critical values can produce misleadingly precise DiD inference. Finite-sample variance corrections, suitable degrees-of-freedom approximations, and wild cluster bootstrap tests can improve calibration, but none removes the information limit created by few independent or treated clusters.

Check Your Understanding

Check that you can distinguish the role and limits of each small-cluster method.

  1. Why does the number of individual observations not necessarily determine the reliability of a cluster-robust DiD test?
  2. What is the difference between adjusting a cluster covariance estimate and choosing a degrees-of-freedom reference distribution?
  3. Why might a Satterthwaite degrees-of-freedom estimate for a treatment contrast be less than \(G-1\)?
  4. In a wild cluster bootstrap-t test of a zero effect, why should the bootstrap samples be generated under the null restriction?
  5. What important limitation remains if only two clusters received treatment, even after applying CR2 or a wild cluster bootstrap?
Clinical Biostats