After I shared my recent blog post about randomization inference (or RI), I got a number of requests for the Stata code I’ve used for my own RI tests. This sounded like a good idea to me, but also like a hassle for me. And my code isn’t designed to be easily used by other folks, so it would be a hassle for them as well.
Fortunately, a new Stata Journal article – and Stata package – came out the day after my post that does much better than any of my own code I could have shared. The article, by Simon H. Heß, is “Randomization inference with Stata: A guide and software”. It addresses a key problem with how economists typically handle RI currently:
Whenever researchers use randomization inference, they regularly code individual program routines, risking inconsistencies and coding mistakes.
This is a major concern. Another advantage of his new package is that the existence of a simple Stata command to do RI means that more researchers are likely to actually use it.
You can run
findit ritest in Stata to get Simon’s package.
I’ve started trying out
ritest with the same dataset on the literacy program, and it handles everything we need it to do quite well. Our stratified lottery and clustered sampling are taken care of by basic options for the program. We have multiple treatment arms, which
ritest can handle by permuting our multi-valued
Study_Arm variable and then using Stata’s “
i.” factor variable notation. We can then run a test for the difference between two different treatment effects by including “
(_b[1.Study_Arm]-_b[2.Study_Arm])” in the list of expressions
ritest computes. Highly recommended.