The McCrary density test checks whether the running variable in a [[Design Pattern II - Regression Discontinuity (RD)|regression discontinuity]] design has an unusual concentration of observations right at the cutoff (which may serve as evidence for self-selection into treatment: subjects may have manipulated the running variable to sort themselves into the treatment group). If the density of the running variable jumps at the cutoff, the [[Local identification by a cutoff|local randomization assumption]] is violated and the RD design loses its identification. The original test (McCrary, 2008) fits separate kernel densities on each side of the cutoff and tests whether the two densities meet there.[^1] The current implementation in the `rddensity` package (Cattaneo et al., 2018) replaces the kernel density with a local polynomial density estimator that has better behavior at boundaries.[^2] A non-significant p-value provides evidence *against* manipulation; it does not prove its absence. [^1]: McCrary, J. (2008). Manipulation of the running variable in the regression discontinuity design: A density test. *Journal of Econometrics*, 142(2), 698–714. [^2]: Cattaneo, M. D., Jansson, M., & Ma, X. (2018). Manipulation testing based on density discontinuity. *The Stata Journal*, 18(1), 234–261. > [!info]- Last updated: May 13, 2026