I am trying to write code for an event study in Stata, but I can't quite get what I want. Jacobson, LaLonde, and Sullivan (1993), page 698 Figure 3 (http://www.princeton.edu/~davidlee/wp/0.pdf), have a plot that is very similar to what I want, except that I also want to add confidence intervals.
Based on this tutorial, http://www.stata.com/meeting/germany14/abstracts/materials/de14_jann.pdf, I have written the following code:
sysuse auto, clear
egen t = fill(1,2,3,4,1,2,3,4)
quietly regress price ib2.t trunk weight if foreign==0
estimates store domestic
quietly regress price ib2.t trunk weight if foreign==1
estimates store foreign
coefplot (domestic, label(Domestic Cars)) (foreign, label(Foreign Cars)), drop(_cons) xline(0) vertical omitted baselevels
This produces something in the ballpark of what I want, but there are the following problems:
- The point estimates and confidence intervals are side-by-side as opposed to on top of each other (which may be fine if this were the only issue).
- My time variable, t, appears in each of the x-labels (t=1, t=2, etc.), but I just want it to say (1, 2, etc.) without the t=.
- I had to start my t numbering at 1 in this toy example because the factor variables combined with the
i
operator need to be non-negative. I would like to have my time variable be able to take on negative numbers. - I don't want
trunk
andweight
to appear in the plot. Is it fine to just place these indrop(...)
? - I would also like to be able to do all this in regression residuals as opposed to what I have above.
- I would like to connect the point estimates with lines.
I am not at all married to the coefplot
command. Other techniques, especially using built-in Stata commands are also perfectly acceptable.