Did someone manipulate the cutoff? (rddensity)
Follow the analysis.
Select a node to explore the method
Take the running variable
Data preparation — shapes the raw inputs into what the estimator expects.
Collect the forcing variable (centered so the cutoff is 0).
# Install: install.packages("rddensity") # R · pip install rddensity (Python)
library(rddensity)
set.seed(42)
x <- rnorm(2000, mean = 0, sd = 1)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Run the manipulation test
A pre-flight check — run this before trusting any estimate downstream.
rddensity fits local-polynomial densities on both sides and tests for a jump at the cutoff.
out <- rddensity(X = x, c = 0)
summary(out)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Plot the two densities
Reporting — turn the numbers into a figure or table a reader can act on.
rdplotdensity overlays the estimated densities with confidence bands so you can see whether they meet at the cutoff.
rdplotdensity(out, x)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Inputs & data
A numeric vector of the running (forcing) variable and the cutoff c.
Show data format & exampleHide example
| running var x |
|---|
| -0.42 |
| -0.05 |
| 0.18 |
| 0.77 |
Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.
The estimate
T=\dfrac{\hat f_{+}(c)-\hat f_{-}(c)}{\sqrt{\widehat{\mathrm{Var}}}}\ \xrightarrow{\ H_0\ }\ \mathcal N(0,1)
⚠️ Unofficial community showcase of rddensity (docs). Not affiliated with the authors — all credit to Matias D. Cattaneo, Michael Jansson & Xinwei Ma; this summarizes public documentation.
What it does. A regression-discontinuity design is only credible if units couldn't precisely manipulate the running variable. rddensity runs the density-continuity (manipulation) test: is there a discontinuity in the density of the running variable exactly at the cutoff?
How it works. It fits local-polynomial density estimators on each side of the cutoff and tests whether they differ there, using a robust bias-corrected statistic. A large p-value supports no manipulation; a small one warns that sorting may invalidate the design. rdplotdensity() draws the two estimated densities.
Assumptions. Smoothness of the density away from the cutoff; the test targets manipulation, a necessary (not sufficient) check for RD validity.
Implements the no-manipulation diagnostic for the RD designs Imbens co-founded; package by Cattaneo, Jansson & Ma.
What you get — A robust manipulation-test statistic and p-value (large p ⇒ no evidence of sorting at the cutoff).
Example output
Manipulation testing using local polynomial density estimation.
Number of obs = 2000
Model = unrestricted
BWmethod = comb
Kernel = triangular
Method T P > |T|
Robust -0.31 0.7541
Discuss the workflow (0)
Log in to join the discussion.