Randomization Tests
Overview
A collection of randomization tests, data sets and examples. The current version focuses on five testing problems and their implementation in empirical work. First, it facilitates the empirical researcher to test for particular hypotheses, such as comparisons of means, medians, and variances from k populations using robust permutation tests, which asymptotic validity holds under very weak assumptions, while retaining the exact rejection probability in finite samples when the underlying distributions are identical. Second, the description and implementation of a permutation test for testing the continuity assumption of the baseline covariates in the sharp regression discontinuity design (RDD) as in Canay and Kamat (2018) https://goo.gl/UZFqt7. More specifically, it allows the user to select a set of covariates and test the aforementioned hypothesis using a permutation test based on the Cramer-von Misses test statistic. Graphical inspection of the empirical CDF and histograms for the variables of interest is also supported in the package. Third, it provides the practitioner with an effortless implementation of a permutation test based on the martingale decomposition of the empirical process for testing for heterogeneous treatment effects in the presence of an estimated nuisance parameter as in Chung and Olivares (2021) doi:10.1016/j.jeconom.2020.09.015. Fourth, this version considers the two-sample goodness-of-fit testing problem under covariate adaptive randomization and implements a permutation test based on a prepivoted Kolmogorov-Smirnov test statistic. Lastly, it implements an asymptotically valid permutation test based on the quantile process for the hypothesis of constant quantile treatment effects in the presence of an estimated nuisance parameter.
Bug fixes (Khmaladze permutation tests)
This release corrects several errors in the Khmaladze-transformation
permutation tests PT.Khmaladze.fit() and PTQTE.Khmaladze.fit(). Users of
these functions in earlier versions should re-run their analyses. A detailed
erratum documenting each issue, its mechanism, and the corrected behavior is
available separately.
- **
PT.Khmaladze.fit()— empirical process.** The two-sample empirical process was constructed so that the test statistic did not depend on the treatment sample. It now evaluates both empirical CDFs at the control quantiles (generalized-inverse convention) as intended. - **
PT.Khmaladze.fit()— score function.** The extended score is now estimated on the correct (outcome) scale and with the correct normalization (-psifromquantreg::akj, i.e.f'/f, rather thanf').
Show all changes in 0.1.12Hide the rest of the changes in 0.1.12
- **
PT.Khmaladze.fit()/PTQTE.Khmaladze.fit()— evaluation grid.** The compensator grid was set to three times the total sample size, which disabled the score-direction projection of the martingale transform. The grid is now tied to the control sample size, restoring the intended behavior. - **
PTQTE.Khmaladze.fit()— observed statistic.** The observed treatment assignment was not included among the permutations, forcing the rejection rate to equal the nominal level regardless of the data. The observed assignment is now included, so the test has power against alternatives.
New features
- **
PT.Khmaladze.fit()gains anakj.controlargument**, an optional named list of tuning parameters passed toquantreg::akjfor score estimation (alpha,kappa,h,iker1). The default (standardakjsettings) is recommended: in simulation, alternative settings that reduce the score's estimation error were found to lower test power.
Notes
- Under the designs used in the associated papers the corrected tests have approximately nominal size. Under heavier-tailed designs, finite-sample size distortion can appear at small samples and diminishes as the sample size grows.
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-08
- ERROR12 OK, 1 ERROR2026-09-07
- OK13 OK2026-08-30
- WARNING10 OK, 2 NOTE, 1 WARNING2026-06-05
- NOTE12 OK, 2 NOTE2026-03-10
Documentation
- Help pages
- 18
- Examples that run
- 14%1 run in a plain check · 6 never run
- Exported functions with examples
- 60%
- Documented parameters
- 98%
- Return-value docs
- 100%
- Help pages citing references
- 67%
Downloads
Repository
- PRs merged (all time)
- 0%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Issues over time
3 development-tooling and community-health practices detected across 3 families in the upstream repository
Checks run against github.com/ignaciomsarmiento/ratest on 2026-10-21.
GitHub Pages site last deployed 2018-12-05
Dependencies
Code & Tests
Datasets
People & History
Maintainer since 0.1.0 (2017)
Pick two releases to compare their code metrics.
- 0.1.12Latest
- 0.1.112026-08-21 · diff ↗
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- RR 4.3.0 released · 2023-04-21
- 0.1.102022-09-29 · diff ↗
- RR 4.2.0 released · 2022-04-22
- 0.1.9
- RR 4.1.0 released · 2021-05-18
- 0.1.8
- RR 4.0.0 released · 2020-04-24
- 0.1.7
- 0.1.6
- 0.1.52019-07-12 · diff ↗
- RR 3.6.0 released · 2019-04-26
Package metadata
- First published
- 2017-08-14
- Total releases
- 13 / 9 yrs
- License
- MIT + file LICENSE OSI · relicensed from GPL (>= 2) in 0.1.11
- Minimum R
- ≥ 3.00
- Bundled data
- 94 KB / 1 file
- Download size
- 322 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("RATest")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.