Friday, July 31, 2020

Trick for Making Lots of Pretty Graphs In Stata

Two main points to make in this today. 

1. MOST IMPORTANT: Make graphs! Graphs are so much better than tables. Also note: do as I say, not as a I do.
2. But speaking of do's...David McKenzie has a nice trick for how to make those graphs good looking using do files! I'll copy-paste here for convenience, but all credit goes to him. 


 Stata trick I learned this week: often I create graphs in Stata, and then want to pretty them up using Stata’s graph editor. But while you can record what you do in the graph editor as a .grec file, this is a pain for replicability since you need to go in and edit each time. I learned you should do the following steps:

1)       Open the graph editor, start recording, and do the editing you want, and save the editing file as a .grec file.

2)       Then open the .grec file, and you will see a bunch of commands. Take these commands and add gr_edit in front of them in your main do file.

E.g. now my do file would read something like

graph use "output\myfigure.gph"

gr_edit style.editstyle boxstyle(shadestyle(color(white))) editcopy

gr_edit legend.style.editstyle boxstyle(linestyle(color(white))) editcopy

gr_edit yaxis1.title.DragBy -.1931240126534509 -2.317488151841824

Wednesday, July 29, 2020

Spatial Regression Discontinuity: It's Wiggida Wiggida Wiggida Wack!

Ok, I'm not sure if "wiggida wiggida wiggida wack" is a good thing or bad thing, but I do know that regression discontinuity is all about spatial jumps which made me think of a song from my youth, Jump by Kris Kross. I blog a lot about old fashioned regression discontinuity (also all about jumps!) so what's this about spatial RD? Nothing. It's pretty much the same thing except that the running variable is usually about distance from a border. Here's a nice description

One example discussed in the blog entry: Imagine you want to know the causal impact of having access to an irrigation system that uses gravity for getting water from one place to another. Plots just below the canal receive access to irrigation, while plots just above the canal do not. By comparing plots just below or just above the canal, you can get at causal impacts of the canal. 

So what's the difference between spatial RD and regular RD? 
1. In regular RD, there's a single score that determines whether you're just above or just below the cutoff---let's say one test score determines whether you get into your college of choice or not. Spatial RD is often about distance so there's a longitude and latitude component. 
2. If you use, let's say, county of residence to determine distance to a state border, some people in that county may be very close to the border and others quite farther away. 
3. Speaking of exploiting distance from state borders---the problem is that there are often many policies that differ when you cross a state border, not just one. 

Read the full blog entry for more details about practical issues when using spatial RD techniques. 

Go off and search for those jumps! jumps! :) 

Sunday, July 26, 2020

Easiest to Implement Most Useful Advice Ever

I read a paper "one last time" last week before sending it to a journal. I found and fixed a few things but thought it was generally good to go. Then I remembered reading some advice on twitter about how having Word (or some other program) read your paper out loud to you is a better way to catch mistakes. I tried it, and it worked! I found a bunch of missing words that way! How is possible that we miss these things when reading? Did you notice that I missed the word "it"?  

I didn't know Word knew how to read documents aloud, and I especially didn't know it was such an easy way to catch your own mistakes. 

Friday, July 10, 2020

How to Write an Abstract

Allison Luedtke has tweeted about how to write an abstract. The basic idea: Instead of sitting down to write "the abstract of your paper"----ie, the most important part, the only thing that most people will read, the culmination of years and years hard work----you just sit down to answer four simple question. Much, much better right? 

Question 1: What is the big picture motivation? 
Question 2: What do you do? 
Question 3: What do you find?
Question 4: What do we know now that we didn’t know before?


See the twitter thread for more details, but if you just answer the questions as quickly and simply as you can without trying to make it sound fancy, you'll probably make a lot of progress. The important bit: Abstracts get rewritten a ga-zillion times, so don't worry at all about writing your first one. It will be rewritten anyway. You can probably answer those four questions lots of different ways. Write them all down, maybe in a notebook vs. in the paper itself. See which sounds most compelling. 

P.S.

Yes, I wrote this tweet with job market paper writers in mind, but if there are any second or third years out there, you can start practicing now! Yes, you may not be ready to write your actual abstract just yet. My advice to prepare: when you read papers for your field courses, see if you can answer those four questions from reading just the abstracts. The more practice you have with going from abstract to answering those questions, the easier it will be for you to go from the answers to the questions to the abstract when it comes time for you to do this for your own work. 

Saturday, July 4, 2020

Stata Tip: How to Make a Specification Curve

We know. You have run many regressions and you want to show us how robust your results are. Or maybe you want to show us which control variables make a difference and which ones. Or maybe you want to show us what happens to your coefficients when you use many, many different samples. Sure you can include a gazillion different tables of regressions results, but you can also just show us one picture that tells us everything we need to know. What is that picture? A specification curve! You can see an example below and you can easily make one with the Stata command, speccurve
Demo
Thank you, Hans, for sharing this!