σ StatsDoge Causal inference workflows
9
Workflow·4 steps·branched

Sharp regression discontinuity with robust bias correction (rdrobust)

Source rdrobust — Calonico, Cattaneo, Farrell & Titiunik
Summary by StatsDoge

Treat the running variable as the assignment mechanism and identify the jump at the cutoff with a local-linear fit on each side. MSE-optimal bandwidth + robust bias-corrected intervals; bandwidth and donut sensitivity sweeps are mandatory, not optional.

1

Input · what goes in

A running variable X with a known cutoff c, and an outcome Y; treatment switches on at X ≥ c.

Show data format & exampleHide example

Format — one row per unit: running variable x, outcome y (cutoff c).

   x      y
 -0.8   2.1
  0.3   4.6   # x ≥ c → treated
 -0.1   2.9
2

Pipeline · the recipe ⑂ has parallel branches

↑ Click any step in the diagram to read its logic, code, assumptions & discussion.

1
Data prep

Running variable, cutoff, outcome

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Set up X, the threshold c, and Y. Identification rests on continuity at c.

Formula
au_{\mathrm{RD}}=\lim_{x\downarrow c}\mathbb{E}[Y\mid X=x]-\lim_{x\uparrow c}\mathbb{E}[Y\mid X=x]
Reads from the input data Feeds into the final output
Key code
library(rdrobust)
# x = running variable, c = cutoff, y = outcome

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
2
Diagnostic / pre-tests

rdplot — see the jump

A pre-flight check — run this before trusting any estimate downstream.

What happens here

Binned means on each side reveal whether there's a discontinuity to estimate.

Formula
\hat\mu_\pm(x)= extstyle\sum_b ar Y_b\,\mathbb{1}\{x\in ext{bin }b\}
Reads from the input data Feeds into the final output
Key code
rdplot(y, x, c = 0)

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
3
Estimation

Local-linear RD with bias correction

The core estimate — where the causal quantity itself is computed.

What happens here

Fit local polynomials on each side at an MSE-optimal bandwidth; robust CIs.

Formula
h_{\mathrm{MSE}}=\arg\min_h\ \mathrm{MSE}ig(\hat au_{\mathrm{RD}}(h)ig)
Reads from the input data Feeds into the final output
Key code
rdrobust(y, x, c = 0)

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
4
Robustness check

Bandwidth & donut sensitivity

A robustness check — does the headline result survive a different lens?

What happens here

Re-estimate across bandwidths and dropping points at the cutoff.

Formula
\hat au_{\mathrm{RD}}(h)\ ext{stable across }h \Rightarrow ext{credible}
Reads from the input data Feeds into the final output
Key code
rdrobust(y, x, c = 0, h = c(h1, h2))

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
3

Output · what you get

⚠️ Unofficial community showcase of rdrobust. Not affiliated with the authors; all credit to them.

Identify the effect at a cutoff: a local-polynomial RD with an MSE-optimal bandwidth and robust, bias-corrected confidence intervals.

Discussion (0)

  • No comments yet — start the conversation.