Announcement

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

  • DID with Multiple Treatment Years

    Dear Statalist,

    I have a problem running a DID. I have students who are assigned to a program. The assignment is random, so I have a treatment and a control group. The year in which the treatment is received is random as well and varies across students.

    I want to run a DID and I think that a possible specification could be:

    y_it=\alpha+beta*Treatment_i+year_fe+delta*(Treatm ent_i*Post_t)+e

    I also want to compute the time varying fixed effects. Can I do:

    y_it=\alpha+beta*Treatment_i+year_fe+sum delta_t*(Treatment_i*Post_t*Year_t)+e

    Thank you!

  • #2
    Your first specification is not correct. In addition to the Treatment*Post interaction, you also need Post by itself in the model. Moreover, if the time at which treatment is received is not the same for everyone, then you need to be sure you have defined your Post variable in an appropriate way for the controls: in particular, setting it to zero for all controls is dead wrong--so if that's what you did, you need to fix it before you run any regressions at all.

    If you are not familiar with Stata's factor variable notation, now is a good time to learn it. Not only does it simplify coding of the regression commands, it sets you up to use the -margins- command afterwards, which greatly simplifies the interpretation of the results in a model with interactions. So

    Code:
    xtset student_id_variable
    xtreg i.Treatment##i.Post i.year, fe
    margins treatment#post // PREDICTED MARGINS 
    margins treatment, dydx(post) // MARGINAL EFFECT OF STARTING TREATMENT
    If you are not familiar with these commands, read -help fvvarlist-, and http://www.stata-journal.com/sjpdf.h...iclenum=st0260.

    Note that when you run the fixed-effects regression, the Treatment variable will be omitted because it is colinear with the student fixed effects. Also, because you are including time fixed effects, the two of the year-indicator variables will be omitted, instead of the usual one, due to colinearity with the Post variable. These are normal and should not cause you any worry.

    I'm not sure what you're getting at with the second equation. You speak of time varying fixed effects, but the equation you show looks like something different from that: year-specific interaction effects. I have difficulty understanding how that would even be meaningful.

    Comment


    • #3
      Thank you very much for your reply! I still have a couple of questions:

      1) How should I define the post variable for the control group?
      2) What I want to capture with the second equation is the effect of treatment separate for each year after the treatment. Does it make sense to you?

      Thank you very much!

      Comment


      • #4
        1. In the classical DID model, all of the treated entities begin treatment at the same time, and that time defines the cut-point for the post variable for both treatment and control entities. You don't have that situation here. So you need to impute, for each control, a time at which that entity would have begun treatment had it been in the treatment group. The best way to do that is if there is some real information about that. For example, if the treatment constitutes enacting a certain law, the year in which the legislature considered the law but voted it down would serve. If nothing of that nature applies to your situation, then the next best bet is to match each control entity to a treatment entity, and impute the matched treatment entity's start date to each control that matches to it. If it is possible to do the match in a meaningful way, that is best. If there is no meaningful approach to matching cases and controls, then a random match will do. Anyway, in the end, you have a date at which treatment actually started, or would have started, for each entity in your data. And post is defined as 0 for before that date, and 1 for that date and after (or 0 on that date and 1 only after if there is reason to expect the effect to be delayed.)

        2. This is pretty complicated, and I don't think it makes sense. Is there any real reason to think that the treatment effect would vary by calendar year? It's hard for me to think of any real world situation where that would happen. I can think of situations where a treatment effect might differ in certain particular years. (For example, the effect of some financial regulation might be different in the year when there is a financial crisis.) So adding an interaction term between the diff-in-diff interaction term and the indicator for that special year might make sense. Or, I can imagine that in many situations the effect of treatment might change, not with the calendar year, but with the nuimber of years since treatment initiated. In most of those situations, though, I would tend to think of it not as a different change with each year, but rather some continuous function of treatment duration. So in that case I would set a variable equal to the duration of treatment (current year minus year of actual or counterfactual initiation) and then incorporate an interaction between the diff-in-diff interaction term and c.duration or some other variable that is a function of c.duration.

        Comment


        • #5
          Thanks a lot, this really helps! I totally got your point 2. Re point 1, if I use student and year FEs, then I only have a Treat*Post variable, which, by definition, is always zero for the control group. Do I still need to impute a treatment year for the control group then?

          Thanks!

          Comment


          • #6
            if I use student and year FEs, then I only have a Treat*Post variable, which, by definition, is always zero for the control group. Do I still need to impute a treatment year for the control group then?
            A Treat*Post variable that is always zero for the control group is useless (even if you weren't using all those FE's). So the first thing to do is -drop- that useless variable and its equally useless Post constituent. Then go ahead and do as I suggested in #1: impute a treatment year for every control, and then create anew a Post variable defined by reference to the observed or imputed treatment year (in treatment and control group observations, respectively), and only then proceed to your interaction analysis.

            To be clear: the year of onset of treatment (observed or imputed) does not directly enter the model. But it is by reference to this variable that the Post variable, and then the Treatment#Post interaction, get defined.

            Code:
            gen Post = (year >= year_treatment_started)

            Comment

            Working...
            X