Tutorials › Causal Inference › Standard Errors and Clustering in RD

Regression Discontinuity Designs · Tutorial 643 of 972

Standard Errors and Clustering in RD

Choose an RD variance estimator that matches the outcome’s variance structure and assignment unit, then quantify how clustering changes standard errors and confidence intervals.

Advanced 12 min read

What You'll Learn

  • Distinguish heteroskedasticity-robust standard errors from cluster-robust standard errors in RD.
  • Relate the variance estimator to the local polynomial regression and its weights.
  • Identify when dependence within assignment units calls for clustering.
  • Calculate an RD standard error and confidence interval with and without clustering.
  • Interpret cluster-robust uncertainty cautiously when the number of clusters is small.

Why Standard Errors Matter in RD

An RD estimate is local: it summarizes the outcome discontinuity at a cutoff using observations in a chosen neighborhood. Its standard error quantifies sampling uncertainty in that estimate. A variance estimator that ignores unequal outcome variability or dependence within assignment units can make the standard error too small or too large, changing the apparent precision of the RD result.

These are separate issues. Heteroskedasticity means the conditional outcome variance can differ across observations, even when observations are independent. Clustering means outcomes for observations in the same group may be dependent. RD analyses often need a variance estimator robust to both.

Definition: A heteroskedasticity-robust standard error allows the error variance to differ across observations while relying on independence across observations. A cluster-robust standard error allows arbitrary dependence within specified clusters and relies on independence across clusters, with sufficiently many independent clusters for its usual large-sample approximation.

Local RD Regression and Its Variance

Let \(R_i\) be the running variable for observational unit \(i\), let \(c\) be the cutoff, and define \(D_i=1[R_i\ge c]\). A local polynomial regression fits a polynomial in \(R_i-c\) on each side of the cutoff, using observations near the cutoff and kernel weights. In the sharp RD case, the coefficient on \(D_i\), under a specification that allows the two sides’ slopes to differ, estimates the local outcome jump. The bandwidth and polynomial order define the fitted estimator; they do not determine which variance estimator is appropriate.

For clarity, write the weighted regression in matrix form as \(Y=X\beta+u\), where \(Y\) is the outcome vector, \(X\) contains the local polynomial terms and side indicators, and \(W\) is the diagonal matrix of kernel weights. The weighted least-squares estimate is \(\hat\beta=(X'WX)^{-1}X'WY\). The RD estimate \(\hat\tau\) is the component of \(\hat\beta\) corresponding to the cutoff jump. This regression description applies to the local polynomial fit; inference must also reflect any bias correction used.

The conventional homoskedastic covariance formula imposes a common error variance. If that restriction is not credible, a heteroskedasticity-robust sandwich estimator replaces it with a sum of observation-level residual contributions. For a weighted fit, let \(\hat u_i\) be the residual and \(x_i\) the row of \(X\). The HC0 covariance estimator is

$$ \widehat V_{\mathrm{HC0}}(\hat\beta) =(X'WX)^{-1} \left[ \sum_i w_i^2 x_i'x_i\,\hat u_i^2 \right] (X'WX)^{-1}. $$

The standard error for \(\hat\tau\) is the square root of the corresponding diagonal element. The squared weights appear because the weighted regression’s observation-level score is \(w_i x_i'\hat u_i\). Other HC versions add finite-sample adjustments; the exact adjustment should be reported rather than treated as interchangeable in small samples.

For robust bias-corrected RD inference, the standard error must be for the bias-corrected estimator, not simply the ordinary standard error from the original local fit. Bias correction changes the estimator’s uncertainty. A reported robust bias-corrected interval should therefore use the variance calculation and critical value appropriate to that corrected estimator.

Worked Example: A Heteroskedasticity-Robust RD Standard Error

Suppose a hypothetical local-constant RD calculation uses 25 equally weighted observations just below the cutoff and 25 just above it. The below-cutoff outcome mean is 10 points and its sample variance is 9 points squared; the corresponding above-cutoff values are 12 points and 16 points squared. Assume observations are independent, and that local approximation bias is negligible for this illustration or has been addressed separately.

The estimated jump is the difference in the local means:

$$ \hat\tau=12-10=2\ \text{points}. $$

With unequal variances allowed, the estimated variance of the difference is the sum of the estimated variances of the two sample means:

$$ \widehat{\operatorname{Var}}(\hat\tau) =\frac{16}{25}+\frac{9}{25} =1, \qquad SE(\hat\tau)=\sqrt{1}=1\ \text{point}. $$

Using a normal critical value of 1.96 gives the approximate 95% interval \(2\pm1.96(1)\), or \([0.04,3.96]\) points. Under the stated approximation, this interval excludes zero. This calculation does not claim that the two sides have equal variances; it uses each side’s own sample variance. It also does not solve a possible bias problem: the example assumes bias is negligible or otherwise handled.

Clustering by the Assignment Unit

In many RD applications, the assignment rule operates at a group level even though outcomes are recorded for individuals. For example, a school’s running-variable value may determine whether all students in that school are eligible for a program. Students in the same school can share unobserved conditions, so their outcomes may be correlated. Treating all students as independent would then count within-school information as if it were independent evidence.

The cluster-robust sandwich estimator aggregates the regression score within each cluster before forming the “meat” of the sandwich. Let \(g=1,\ldots,G\) index clusters, and let \(X_g\), \(W_g\), and \(\hat u_g\) denote the corresponding rows, weights, and residuals. Define the cluster score \(S_g=X_g'W_g\hat u_g\). A basic cluster-robust covariance estimator is

$$ \widehat V_{\mathrm{cl}}(\hat\beta) =(X'WX)^{-1} \left[ \sum_{g=1}^{G} S_g S_g' \right] (X'WX)^{-1}. $$

A finite-sample multiplier is often applied to this estimator. Its form depends on the software and specification, so analysts should identify the adjustment used. The essential feature is aggregation: within-cluster residual contributions can reinforce or offset one another before the cluster scores are squared. When outcomes are positively correlated within clusters, the resulting standard error is often larger than the observation-level robust standard error, but that is not guaranteed in every data set.

The cluster definition should follow the source of dependence and the assignment process, not be chosen to obtain a desired standard error. The number of independent clusters matters more for the quality of the usual cluster-robust approximation than the total number of individual observations alone. With few clusters, conventional cluster-robust standard errors and normal critical values can be unreliable; suitable small-sample corrections or methods designed for few clusters may be needed. Clustering does not repair a misspecified RD model, inadequate bandwidth choice, or unaddressed bias.

Worked Example: The Same RD Contrast With and Without Clustering

Consider a hypothetical local-constant contrast based on four schools on each side of a cutoff. Each school contributes five students, and all five students in a school have the same outcome in this deliberately simple example. Below-cutoff school means are 9, 10, 11, and 12 points; above-cutoff school means are 11, 12, 13, and 14 points. The school is the assignment and dependence unit.

The two student-level means are 10.5 and 12.5 points, so the estimated jump is \(12.5-10.5=2\) points. If the 40 student records are incorrectly treated as independent, each side has 20 observations. On either side, the sum of squared deviations from that side’s mean is \(5(1.5^2+0.5^2+0.5^2+1.5^2)=25\). Thus the student-level sample variance is \(25/19=1.3158\) points squared, and the independence-based standard error is

$$ SE_{\mathrm{ind}} =\sqrt{\frac{1.3158}{20}+\frac{1.3158}{20}} =\sqrt{0.13158} =0.3627\ \text{points}. $$

Instead, calculate uncertainty across the independent school means. On each side, the school-mean sample variance is \((1.5^2+0.5^2+0.5^2+1.5^2)/3=5/3\) points squared. The standard error of the difference between the two four-school means is

$$ SE_{\mathrm{cl}} =\sqrt{\frac{5/3}{4}+\frac{5/3}{4}} =\sqrt{\frac{5}{6}} =0.9129\ \text{points}. $$

For illustration, suppose the school means are treated as independent normal observations with a common variance on the two sides, and use a \(t\) critical value of 2.447 with \(df=6\). The resulting interval is \(2\pm2.447(0.9129)\), which is approximately \([-0.2338,4.2338]\) points. By contrast, the independence-based normal interval is \(2\pm1.96(0.3627)=[1.289,2.711]\) points. In this constructed data set, ignoring the school grouping gives a much narrower interval. The \(t\)-based calculation is a small-sample illustration under the stated assumptions, not a universal rule for cluster-robust RD inference.

Confidence Intervals and Corrected RD Estimates

A confidence interval combines an estimate, its standard error, and a critical value appropriate to the inferential procedure. In a large-sample normal approximation, the interval has the form \(\hat\tau\pm z_{1-\alpha/2}SE(\hat\tau)\). With cluster-based inference, the critical value or degrees-of-freedom adjustment may differ, especially when the number of clusters is limited. An interval for a bias-corrected estimate must pair that estimate with its bias-corrected standard error.

Worked Example: A Cluster-Based Interval for a Bias-Corrected RD Estimate

Suppose a hypothetical analysis reports a bias-corrected RD estimate of 2.0 points and a cluster-robust standard error of 0.962 points. There are 20 independent assignment clusters. For this numerical illustration, use a \(t\) critical value of 2.093 with \(df=19\); this choice is an explicit approximation, not a prescription for every cluster design.

The margin of error is

$$ 2.093(0.962)=2.013466\ \text{points}. $$

Therefore, the 95% interval is

$$ 2.0\pm2.013466 =[-0.01347,\ 4.01347]\ \text{points}. $$

The interval includes zero, narrowly. Under the stated interval procedure, the data do not exclude a zero discontinuity at the 5% two-sided level. This is not evidence that the null is true; it indicates that the estimate is not sufficiently precise to rule out zero using this interval. The endpoints are calculated from the unrounded margin of error, then rounded to five decimal places.

Choosing and Reporting the Variance Estimator

A practical choice begins with the design and data structure. If observations are independent but conditional variances may differ, use a heteroskedasticity-robust estimator. If observations may be dependent within assignment units, cluster at the level that captures that dependence; a cluster-robust estimator also permits heteroskedasticity across observations and clusters. If both features are present, clustering is generally the relevant dependence adjustment, not a reason to assume equal variance.

1
Specify the RD estimator.
State the cutoff, outcome, running variable, bandwidth, polynomial order, kernel, and whether the reported estimate is bias-corrected.
2
Identify independent units.
Determine whether assignment or shared conditions create dependence within schools, clinics, geographic areas, or another group.
3
Match variance to the estimator.
Use an HC variance for independent heteroskedastic observations or a cluster-robust variance for within-cluster dependence, with the correction appropriate to the procedure.
4
Report the basis for inference.
Give the standard error, confidence interval, cluster definition, number of clusters, and critical-value or small-sample method.

For fuzzy RD, the estimated effect is a ratio involving discontinuities in treatment receipt and outcome. Its uncertainty must account for the variance of both estimated discontinuities and their covariance; when assignment units induce dependence, that covariance calculation must also respect clustering. The same general principle applies: the standard error must correspond to the estimator actually reported.

Common Mistakes and Why They Matter

  • Using ordinary standard errors because the sample is large. A large number of individuals does not make within-cluster dependence disappear. If there are few independent assignment units, the effective information for inference may be much closer to the number of clusters than the number of records.
  • Clustering only as a formality. The cluster level should reflect plausible dependence and the assignment mechanism. An arbitrary grouping does not guarantee valid inference.
  • Assuming a robust standard error fixes bias. Robust variance estimators address uncertainty under their dependence assumptions; they do not remove local polynomial approximation bias. Use the appropriate bias-corrected procedure when needed.
  • Reading a wider interval as a smaller estimated effect. Clustering changes the estimated uncertainty, not necessarily the point estimate. It can change whether an interval excludes zero without changing the estimated jump.
  • Using a cluster-robust standard error with an unsuitable critical value. A normal approximation may be poor with few clusters. State how the critical value and any finite-sample correction were chosen.
Key takeaway: RD inference requires a standard error matched to both the fitted estimator and the dependence structure. Heteroskedasticity-robust inference allows unequal variances; cluster-robust inference additionally allows dependence within assignment units. Report the cluster level and number of independent clusters, and keep variance estimation distinct from bias correction.

Check Your Understanding

Use these questions to check whether the variance choice and interpretation are clear.

  1. In a local RD regression, what does a heteroskedasticity-robust variance estimator allow that a homoskedastic formula does not?
  2. Why might student-level standard errors be misleading if eligibility is assigned to schools?
  3. A clustered RD analysis has many individuals but only a small number of independent assignment units. Why can the usual large-sample cluster approximation be unreliable?
  4. In the school example, which quantity changed when clustering was taken into account: the estimated jump, its standard error, or both?
  5. Why must the standard error for a robust bias-corrected RD estimate correspond to the corrected estimator?
Clinical Biostats