Thanks to Kit Baum, -ritest- is now available for download from SSC. -ritest- is a module to conduct randomization inference and permutation tests, allowing for arbitrary randomization procedures

The package can be installed using:
Code:
 ssc install ritest
A previous version of the command was published alongside a short Stata Journal article explaining how to use the command to perform various variants of randomization inference in Stata. The article is published here: http://www.stata-journal.com/article...article=st0489 With the ritest-command it becomes very easy to perform randomization inference for any kind of command in Stata. -ritest- is flexible enough to work with arbitrarily complex randomization methods. In particular it is very easy to deal with clustered randomization, pairwise randomization, or user-written any randomization routines in Stata.

The current version on SSC is an updated version of the Stata Journal code with several bugfixes and a few new features. The full change-log is available here: https://github.com/simonheb/ritest/b...ster/README.md

For regular updates and bugfixes, I recommend installing the package through my github, which is easy:
Code:
net describe ritest, from(https://raw.githubusercontent.com/simonheb/ritest/master/)
Important updates will also be pushed to SSC.

Usage
The syntax of the command is close to that of Stata’s permute. For example, to conduct randomization inference after clustered & stratified treatment assignment, using the t-statistic of an ATE regression as the evaluation statistic run:
Code:
ritest treatment (_b[treatment]/_se[treatment]), cluster(class_id) strata(school_id): reg y treatment x
(This just permutes treatment across classes within strata and computes the t-statistic of the ATE for each permutation)

Or if, instead of permuting, one wants to apply the original randomization script to perform the re-randomizations one, but this time use the coefficient estimate as the evaluation statistic, simply write:
Code:
ritest treatment _b[treatment], samplingprogram(assignment_programm) samplingprogramoptions("school(school_id) class(class_id)"): reg y treatment x
(This repeatedly calls a program that re-assigns treatment. The user has to define the program beforehand: assignment_programm, school(schoold_id) class(class_id))

For questions/requests please use the github issue-tracking system: https://github.com/simonheb/ritest/issues