
Conditional Density Method
These programs implement the conditional density method I used in this paper to impute missing variables and values in the American Community Survey and extended in my job market paper to correct for measurement error. All programs are for Stata and can be installed by copying the .ado files to a directory on the search path or the working directory. You can also install them from ssc by runningssc install conddens
,ssc install cddens
orssc install cdreg
in Stata. They are preliminary versions, i.e. I have tested them and they work, but some details about the implementation and the way they are run will need to be improved in future versions and the helpfiles need revisions. Please let me know if you have any questions or suggestions. Theconddens
command estimates conditional densities.cddens
uses estimated parameters of a conditional density to consistently estimate a marginal density or distribution in the presence of measurement error and missing data. It can also be used to simulate samples from the conditional density in order to estimate other models (as described in my job market paper) and implements tests of the conditional distribution.cdreg
uses the same method to correct linear regressions. See the help files that are included with the programs for further details.Parameter Estimates: Food Stamps 20082010 New York State ACS

Factor Models
This program for R estimates factor models by GMM where measures are uniquely assigned to factors. We used this to estimate the proxy variable model for "Estimating Effects of School Quality using Multiple Proxies." More details about the estimator the programs implement can be found in the paper and Black and Smith (2006) who first used this kind of estimator. There are two versions of the program, the only difference is that mmme_par.R uses the packageforeach
to parallelize the bootstrap for the difference between implied and actual OLS coefficients. If you getforeach
to work and want to use the bootstap, it will be much faster using mmme_par.R. This was my first attempt to implement an estimator and the first time I used R, so the program is a bit slow and not very elegant, but it works. See the description for further details. The functions can be used after pasting the code in R or by usingsource("mmme_par.R")
.Files: mmme

Fixed Effects
The programs below implement the algorithm to compute estimates of large twoway fixed effects and match effects models that I described in this paper. The matlab program solves the problem directly using the CholeskyFactorization. Notes on how to run it are provided at the beginning of the file. The Stata Programs implement the iterative solution using the conjugate gradient algorithm, plese see the included helpfile for further details. The programs can also be installed from ssc by runningssc install twfe
in Stata.
Files: Stata Programs Matlab Program

Misclassification
This program implements the Probit estimators that are consistent when the dependent variable suffers from misclassification. Bruce Meyer and I used these estimators in this paper. mrprobit.ado can be used to estimate the model proposed in Hausman, Abrevaya and ScotMorton (1998), the extensions we used (known probabilities of misreporting and allowing these probabilities to vary by cell) and the predicted probabilities estimator. See the helpfile for more details. mrprlik.ado contains the likelihood function for mrprobit.ado and is required to be in the working directory or on the .ado search path. mrprjlik.ado contains the likelihood function for the joint estimators we used. The models can be estimated by making Stata's ml command use it as the likelihood function usingml lf mrprjlik [model specification]
. I hope to provide a helpfile for Stata shortly, if you want to use it and cannot figure out how it works, please let me know. The programs can either be installed by copying the files into a folder on the ado path or from ssc by runningssc install mrprobit
in Stata.
Note (2/2/2013):Uploaded a revised version that fixed a problem with Stata 10. See the helpfile for details.Files: mrprobit

Other
Just some smaller programs that I wrote for miscellaneous reasons. ksmirnov2  KolmogorovSmirnov test with weights in Stata
The ksmirnov command in Stata does not allow weights, so I added a few lines to the .ado file (to get the KSdistance from cumul, which allows weights). Almost everything else is code from the official Stata version, please see the helpfile for further details. The test should be used with much caution  the asymptotic distribution of the test assumes an iid sample and to my knowledge it is not clear whether the test or the bootstrap are consistent.Files: ksmirnov2
 twclust  TwoWay Clustering in Stata
Cameron, Gelbach and Miller (2011) describe how to do multiway clustering and have a program that probably covers more general cases and works better than mine. It did not work well for the large datasets I used for this paper, so I wrote this. The helpfile contains further details.Files: twclust
 .do files to import American Community Survey data into Stata
While NBER provides excellent files to read the CPS into Stata, I did not find any programs that import and label the ACS files provided by the Census Bureau. I'm using the files below to download, unzip, import, label and clean the ACS housing and population files. Further information is provided at the top of the "read_acs_1y.do" file. They are rather simple, but maybe you'll find them useful. I have only used a small subset of the ACS variables and have not checked whether everything else is imported correctly and there probably is a more elegant solution than recycling the 2010 labels. If you find any mistakes or have any improvements, please let me know.Files: ACS Stata files
 ksmirnov2  KolmogorovSmirnov test with weights in Stata