Announcement

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

  • Treatment vs Control graph with FE

    Hello guys,

    I'm trying to do a graph (treat x control / x-axis: year by year / y-axis: Outcome) of a DiD with a couple of FE. It is a "treatment x Post", where "treatment" has staggered adoption dummy (may starts equals 0, then turn 1 in the next period and then become 0 again) and "post" is a dummy for the last period.

    I tried these possibilities:

    1) Use "collapse" and "twoway" to do a simple graph but this doesn't take FE into account.

    2) "Margins" it worked with something like this:

    HTML Code:
    reghdfe outcome i.treatment##i.year if var1==1 & var2==1, a(firstFE secondFE third FE) cluster(group)
    margins year, at(treatment = (0 1)) noestimcheck
    marginsplot, xdimension(year)

    But I'm not sure about the interpretation of this and if it is exactly what I want. I read the paper about it, but no quite sure about the interpretation.

    3) I can do an "xtdidregress".

    HTML Code:
    xtdidregress (outcome) (treatment) if var1==1 & var2==1 , nogteffects group(group) time(year)
    estat trendplots

    But when I do the "estat trendplots" after this. It says "treatment assignment times vary" because of the restricted sample (this is probably easy to solve). And when I use the option "nogteffects" to don't automatically create group and time FE it says that the plot it is not allowed with this option.

    4) "csdid" is only valid with single adoption period for treatment, right?



    Someone know how could I do a graph like this?
    Last edited by Paulo Andre; 03 Feb 2023, 15:45.

  • #2
    Just a sample of the data
    Attached Files
    Last edited by Paulo Andre; 03 Feb 2023, 18:07.

    Comment


    • #3
      And an example of the graph Click image for larger version

Name:	statalist.JPG
Views:	1
Size:	21.5 KB
ID:	1700305
      Last edited by Paulo Andre; 03 Feb 2023, 18:10.

      Comment


      • #4
        Here's a start

        Code:
        reghdfe outcome i.treatment##i.year if var1==1 & var2==1, a(firstFE secondFE third FE) cluster(group)
        margins year#treatment
        marginsplot, xdimension(year)
        You might consider having your if call before just to not have those observations in the margins calculations (or use if e(sample)).

        Comment


        • #5
          Originally posted by Justin Niakamal View Post
          Here's a start

          Code:
          reghdfe outcome i.treatment##i.year if var1==1 & var2==1, a(firstFE secondFE third FE) cluster(group)
          margins year#treatment
          marginsplot, xdimension(year)
          You might consider having your if call before just to not have those observations in the margins calculations (or use if e(sample)).
          Thank you!

          Comment

          Working...
          X