Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graph plotting outcome variable before after treatement

    Dear all,

    I am running a staggered difference in difference and I would like, after the regression estimation, to plot a graph as follow.
    Y axis: Dependant variable
    X axis: time period relative to treatment introduction.

    The graph should be more or less as the example below. Given that I have 3 cohorts and each of them receive treatment in 2009,2010,2011 I cannot have x-axis with absolute year. But just t=0 t+1 etc.
    Moreover: 1)as below, vertical bands should represent 95% confidence intervals for the point estimates in each period and 2)I need to omit the indicator for year t-1, which serves as the benchmark period with an OLScoefficient and standard error of zero.

    Do you have any advice on how to address this issue?

    Many thanks




    Click image for larger version

Name:	Graph.png
Views:	1
Size:	7.3 KB
ID:	1668681

    ow:
    Last edited by Marco Errico; 10 Jun 2022, 09:22.

  • #2
    Code:
    use https://friosavila.github.io/playingwithstata/drdid/mpdta.dta, clear
    
    gen rel_time = cond(first_treat, year - first_treat + 100, 0)
    
    eststo event: xtreg lemp ib(99).rel_time i.year, fe i(countyreal) r
    
    coefplot event, keep(*rel_time) base vert yline(0) xline(4.5)

    Comment

    Working...
    X