Announcement

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

  • Difference-in-difference fixed effects with multiple periods

    Dear all,

    I am trying to run a difference-in-difference fixed-effects model. The challenge here is that I have MULTIPLE periods and treatment did not take place in a particular year for all units. Whenever I use one of the commands below, the treated#post coefficient, which I am interested in, is omitted.

    xtreg outcome i.treated##i.post i.year, fe vce(cluster unit)
    xtreg outcome i.treated#i.post i.year, fe vce(cluster unit)

    The only way to bring it back is to interact i.year with i.treated instead of i.post with i.treated (see below).
    xtreg outcome i.treated##i.year, fe vce(cluster unit)

    But if I do so, I do not account for the exact year in which a unit is treated but rather that a unit is generally treated or not. I do not think this is acceptable.

    The other alternative I could think of is to use diff-in-diff random effects instead of diff-in-diff fixed effects, as follows:
    xtreg outcome i.treated#i.post, re vce(cluster unit)

    But I think fixed effects better reflect my data.

    Any advice will be highly appreciated, thanks in advance.

    Best regards,
    Amira

  • #2
    Amira: Difference-in-differences is a special case of a more general methodology. I can't figure out why people insist on using i.treated#i.post when the implementation policy is staggered: clearly the variable "post" is not uniquely defined. What you need to do is define a single dummy variable, say, "policy," to be one when unit i is subject to treatment in year t. You'll have to do this "by hand" if it is not already given by the data. I suspect it essentially is; otherwise, how would you know that the initial intervention changed by unit. Hopefully you have the precise information needed to construct the intervention dummy.

    I discuss the general approach in the recent 7th edition of my book "Introductory Econometrics: A Modern Approach." It's really very easy once you have properly defined the policy variable.

    Code:
    xtreg outcome i.policy i.year, fe vce(cluster id)

    Comment


    • #3
      Dear Amira, I think that, as many people I encountered, you do not know that there are two, broadly speaking, "flavors" of DID setups. One deals with the "same" policy change timing (your code fits in this case), and the other deals with the "different" (as stated by Professor Wooldridge, staggered) policy change timing. In the latter situation, you should employ the code provided by Professor Wooldridge (@Jeff Wooldridge).
      Last edited by River Huang; 10 Oct 2019, 21:51.
      Ho-Chuan (River) Huang
      Stata 19.0, MP(4)

      Comment


      • #4
        Thank you so much for the elaboration, highly appreciate it. Yes, the variable "post" is not uniquely defined. It is equal to one for a treated unit after treatment, zero otherwise. I thought about interacting "post" with "treated" to compare between the effect of the reform when it was first implemented on some units versus later, when commitment to reform weakened. But now as you made it clear that this is incorrect, I will employ the code kindly provided by Professor Wooldridge (@Jeff Wooldridge). Thanks again.

        Comment


        • #5
          Hello again. May you please advise on the code if the intervention (e.g., reform program) has two stages? I wish to compare the outcomes of the units that went through the second stage of reform to the outcomes of the units that went through the first stage only. Thanks in advance.

          Comment


          • #6
            Jeff Wooldridge. Dear Sir. How can we test for pre-treatment parallel trends if we are applying the general DiD approach you kindly recommended? Thank you in advance.

            Code:
            xtreg outcome i.policy i.year, fe vce(cluster id)

            Comment


            • #7
              Dear all. Can I use the general DiD approach with two policy variables (i.e., two treatments) as below? Thanks in advance.
              Code:
              xtreg outcome i.policy_1 i.policy_2 i.year, fe vce(cluster id)

              Comment

              Working...
              X