The standard manipulation test for RD designs — checks whether the running variable's density jumps at the cutoff (a sign units sorted around it).
Input · what goes in
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 |
Pipeline · the recipe
↑ Click any step in the diagram to read its logic, code, assumptions & discussion.
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)
- No comments on this step yet — be the first.
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)
- No comments on this step yet — be the first.
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)
- No comments on this step yet — be the first.
Log in to comment on this step.
Output · what you get
Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.
Result · the numbers
⚠️ 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

Discussion (0)
Log in to join the discussion.