Announcement

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

  • View Controls' Coefficients in did2s

    Dear All,

    I am using the did2s command to run a staggered DiD analysis. However, after running it, I only get the coefficients for the second-stage variables. How can I get the control variables' coefficients as well?

    Code:
     did2s dependent if var1==0 [aw=_webal], first_stage(i.country_id i.year control1 control2 control3 control4 control5)
    second_stage(treat) treatment(treat) cluster(country_id)
    Thank you very much!

    Cat

  • #2
    I believe the coefficients would be from a regression of the DV on the first stage Xs using the untreated group.


    Code:
    use https://github.com/kylebutts/did2s_stata/raw/main/data/df_hom.dta, clear
    
    did2s dep_var, first_stage(i.state i.year) second_stage(i.treat) treatment(treat) cluster(state)
     
    reg dep_var i.state i.year if treat==0, cluster(state)
    predict fit, resid
     
    reg fit treat , cluster(state) noconstant
    
    ** se are not the same, but the coefficient is.

    Comment


    • #3
      Dear George,

      Thank you very much for your reply.

      I tried this manual way to calculate the did2s, however the second stage of the code you mention still only give me the result for the "treat" variable.

      I am wondering if the control's coefficients and SEs are simply the coefficients of the controls in the first stage.

      Best,
      Catarina

      Comment


      • #4
        It’s actually a regression with the not yet treated.
        If post x treat =0

        Comment


        • #5
          FernandoRios thank you for your message. I am not sure I understand then how can I get the controls for the full sample. What I'm looking for is to report the coefficients and SEs of the control variables using Gardners method. However, the did2s only reports the results of the treatment.

          Comment


          • #6
            I see your point
            so 1) look into Gardner's original paper and appendix.
            He has a GMM example that shows everything that is estimable.
            2) you can only see coefficients for variables in the control group (those not yet treated). For the treated, its assume fixed
            HTH

            Comment


            • #7
              Thank you very much for your time. I tried to run the GMM example but for some reason it didn't work. Here's what I tried:

              I replaced "y" with my dependent variable (my_dv), "year" kept the same, "id" was replaced by "country_id", and d with "did", my treatment status.

              Code:
              gmm (eq1: (my_dv - {xb: i.year} - {xg: ibn.country_id})*(1-did)) ///
                (eq2: my_dv - {xb:} - {xg:} - {delta}*d), ///
                instruments(eq1: i.year ibn.country_id) ///
                instruments(eq2: did) winitial(identity) ///
                onestep quickderivatives vce(cluster country_id)

              However, I get this error:
              Code:
              note: instrument 236.country_id omitted because of collinearity.
              could not evaluate equation 2
              Do you by any chance have any idea why? Am I doing anything wrong?

              Comment


              • #8
                Not sure at first glance.
                I would first replicate what he does, before twiking it to your specific needs.
                Also keep in mind that GMM is not good with too many Fixed effects. Using the example was more for you to be familiar with the works behind did2s,
                HTH
                F

                Comment


                • #9
                  Thank you very much!!

                  Comment

                  Working...
                  X