Coder’s corner posts


“Simulations-based power calculations” (2019)

Stata [code]

If you want to run power calculations using your baseline data, you can (typically) either use the asymptotic properties of your sample or bootstrap your βi using simulations on your baseline data. One advantage of using simulations is that you can add controls to your power analysis. Typically, policies/interventions only mildly affect the variance of the outcome of interest. So even if your policy has a (relatively) large impact, the standard errors (SEs) under the null hypothesis can be similar to the SE under the alternative. Adding controls can help get more precisely measures of the impact of interest. In this post, I walk you through how to run these simulations, using a command I wrote and shared along with the .pdf.

“Compiling .tex files to .docx” (2020)

Unix [code]

Working with LaTeX is super convenient, but the downside is that it can make teamwork a challenge. That is especially true if a team includes individuals from fields in which LaTeX is not the default text editing language. In this post, I will walk you through a way to compile your .tex into a .docx. Just as a warning, step 1 is the most tedious step if you are not familiar with command prompts, but fortunately you just need to run it once. When that’s done, you will never (hopefully ever) have to worry about step 1 again.

“Autogenerate your folder structure” (2020)

R and Stata [code]

For multi-year, muti-analysts/RA/PIs projects, it is very important to keep a clean and organized folder structure. There are a few resources out there to organize and maintain a sound folder structure that will make sense years down the line (see Gentzkow and Shapiro, 2014). However, it can be quite tedious to manually create all these folders. This post is designed as one to copy-paste whenever you start a new project.

Cheat Sheets / Primers


Instrumental Variables

[one-pager]
I created this cheat sheet for my graduate students struggling with IVs. It summarizes all the important concepts to remember when using or reading a paper that uses IVs.

Coding (mainly Stata)

[useful resources for coders]
Stata/R have been around for quite some time and there exists a slew of resources out there and parsing those can be challenging especially if you don’t have a specific question. In this document I compile a limited list of primers.