title: Stata Event Study Graph Code
body: <p>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 (<a href="http://www.princeton.edu/~davidlee/wp/0.pdf" rel="nofollow noreferrer">http://www.princeton.edu/~davidlee/wp/0.pdf</a>), have a plot that is very similar to what I want, except that I also want to add confidence intervals.</p>
  
  <p>Based on this tutorial, <a href="http://www.stata.com/meeting/germany14/abstracts/materials/de14_jann.pdf" rel="nofollow noreferrer">http://www.stata.com/meeting/germany14/abstracts/materials/de14_jann.pdf</a>, I have written the following code:</p>
  
  <pre><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
  </code></pre>
  
  <p>This produces something in the ballpark of what I want, but there are the following problems:</p>
  
  <ol>
  <li>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).</li>
  <li>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=.</li>
  <li>I had to start my t numbering at 1 in this toy example because the factor variables combined with the <code>i</code> operator need to be non-negative. I would like to have my time variable be able to take on negative numbers.</li>
  <li>I don't want <code>trunk</code> and <code>weight</code> to appear in the plot. Is it fine to just place these in <code>drop(...)</code>?</li>
  <li>I would also like to be able to do all this in regression residuals as opposed to what I have above.</li>
  <li>I would like to connect the point estimates with lines.</li>
  </ol>
  
  <p>I am not at all married to the <code>coefplot</code> command. Other techniques, especially using built-in Stata commands are also perfectly acceptable.</p>