Doug Miller’s Stata code page 

This page has Stata code used in some of my papers.

Multi-way clustering with OLS

cgmreg.ado – This is the multi-way clustering regression code used in “Robust Inference with multi-way clustering” by Cameron, Gelbach, and Miller (2006, NBER TWP 327).  Some sample Stata code that uses this ado file is .

Percentile-t cluster bootstrap example

In Cameron, Gelbach, Miller (ReStat 2008), we suggest using a “Wild cluster-bootstrap percentile-t procedure, imposing the null hypothesis,” for improved inference with few clusters.  I don’t have an .ado file that will automatically run this, but I do have a .do file, which is adopted from the Gruber-Poterba Application of our paper, that can serve as an example.  The file is, and it uses the dataset collapsed.dta.  The code produces p-values for “pairs cluster bootstrap,” “cluster residual bootstrap,” and “Wild bootstrap.”  (Note:  The numbers for the Wild bootstrap are different than those in our paper, because in the old version of the code we used different (and less intuitive) weights for the wild bootstrap, and we did not "impose the null hypothesis".  Because our base recommendation is to use the Wild Bootstrap, impose the null, and use the +1 -1 weights, I've modified the code to reflect those recommendations.)

Nonparametric Regression Discontinuity Code

An earlier version of this code was used in Ludwig and Miller (2007).

Start with the readme.txt file.  The code to run is the file.  The actual nonparametric RD code is in the file.  An example of the graphs that can be made is in example_graph.wmf file.


Code and Public Data for “Does Head Start Improve Children’s Life Chances?  Evidence From a Regression Discontinuity Design”

This .zip file (almost 7MB) when extracted contains data and Stata .do files that reproduce the tables and graphs in: Jens Ludwig and Douglas L Miller, "Does Head Start Improve Children's Life Outcomes?  Evidence from a Regression Discontinuity Design," Quarterly Journal of Economics, February 2007, Vol 72, Issue 1, pp 159-208.  The file "" in the folder "tables" will create all the tables.  The graphs are in the folder "tables/graphs".  The NELS results in the paper were based on geo-coded NELS data, and this data is not publically available.  We have "commented out" the lines in the .do files that create these results, and do not include NELS files in this folder.

Head Start QJE 2007 data and code


Code for “Robust inference with Multi-way Clustering”

This .zip file contains a folder with Stata code behind the tables in:  Colin Cameron, Jonah Gelbach, and Douglas L Miller, "Robust Inference with Multi-way Clustering", Journal of Business and Economic Statistics, 2011.  Please see the readme.txt file for description of the .do files.

Multi-way Clustering JBES 2011


To UC Davis or the Economics Department

This page last updated on April 27, 2007.