Announcement

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

  • Dynamic treatment effects model (difference in difference)

    Hello Statalist,

    I am currently analyzing a repeated cross-sectional data to estimate the impact of county-level treatments (binary variable) on individuals' outcomes. There is a variation in treatment timing by year and all counties get treated eventually. When the treatments are turned on, they stay on during the study time period. I'm trying to estimate the dynamic treatment effects model (two-way FE: county FE and year FE) and I am interested in the coefficients on the treatment variable that correspond to the year when the treatment was implemented, a year and 2 years after the implementation.

    Code:
    reg outcome i.treatment#i.post_treat_rel i.year i.county
    I used the code above. The "treatment" variable is a 0 or 1 variable that indicates 1 if the treatment was implemented in a given county in a specific year. The "post_treat_rel" variable shows the relative time to the year when the treatment gets turned on in each county --i.e. 0 for the pre-treatment years, becomes 1 in the year when the treatment is implemented in each county, and 2 and 3 after each year.

    My question is, does my code (specifically, the coefficients on the interaction terms of treatment and post_treat_rel) above correctly estimate the dynamic treatment effects?

    Another question is, I want to test the interaction effect of the treatment and one demographic variable (e.g. gender). In that case, how should I code this into the dynamic treatment effects model? I thought about running a three-way interaction, but it really complicates the interpretation. Are there other ways that people do to test the interaction effect in the dynamic DID model?

    I would really appreciate any help you can give on this problem. Thank you in advance.

  • #2
    I posted this about a week ago -- but I would really appreciate it if I can receive some help on my questions.

    Comment


    • #3
      Stephanie: I had this open for several days but didn't have a chance to respond. My suggestion is to not try to wedge this into the traditional DID framework. Since you have repeated cross sections rather than panel data, you have to be a bit careful in defining the lags. What I would do is, in each year, define three treatment indicators: one to indicate current treatment, treatment a year ago, and treatment two years ago. Maybe treat0, treat1, treat2. Then include all three in a regression analysis using the individual level pooling across time and counties. Include county and time fixed effects.

      JW

      Comment


      • #4
        Hello Professor Wooldridge,

        Thank you so much for your reply! Does the following equation align with your suggestion on creating the three treatment indicators?

        Yict = B0 + B1*treat_ct-2 + B2*treat_ct-1 + B3*treat_ct + Xict + county FE + time FE + epsilon

        I apologize for the messy equation -- I wanted to copy and paste the equation from the word document, but somehow I couldn't do it here.


        Since you have repeated cross sections rather than panel data, you have to be a bit careful in defining the lags
        Also, could you explain why we have to be more careful in defining the lags when we work with repeated cross sections?

        Comment


        • #5
          Here's a classic example of what I think you're going for. Hope this helps.
          Note this requires coefplot (from SSC).

          Code:
          clear all
          set more off
          
          shell curl -o outsourcingatwill_table7.zip "http://economics.mit.edu/~dautor/outsourcingatwill_table7.zip"
          unzipfile outsourcingatwill_table7.zip
          
          use "table7/autor-jole-2003.dta", clear
          gen lnemp = log(annemp)
          
          gen nonemp  = stateemp - svcemp
          gen lnnon   = log(nonemp)
          gen svcfrac = svcemp / nonemp
          
          gen bizemp = svcemp + peremp
          gen lnbiz  = log(bizemp)
          
          gen t  = year - 78
          gen t2 = t^2      
          
          keep if inrange(year, 79, 95) & state != 98
          
          gen clp     = clg + gtc
          gen a1624   = m1619 + m2024 + f1619 + f2024
          gen a2554   = m2554 + f2554
          gen a55up   = m5564 + m65up + f5564 + f65up
          gen fem     = f1619 + f2024 + f2554 + f5564 + f65up
          gen white   = rs_wm + rs_wf
          gen black   = rs_bm + rs_bf
          gen other   = rs_om + rs_of
          gen married = marfem + marmale
          
          replace unmem = . if inlist(year, 79, 81)
          replace unmem = unmem * 100              
          
          reg lnths lnemp admico_2 admico_1 admico0 admico1 admico2 admico3 mico4 admppa_2 admppa_1   ///
              admppa0 admppa1 admppa2 admppa3 mppa4 admgfa_2 admgfa_1 admgfa0 admgfa1 admgfa2 admgfa3 ///
              mgfa4 i.year i.state i.state#c.t, cluster(state)
          
          
          coefplot, ///
             keep(admico_2 admico_1 admico0 admico1 admico2 admico3 mico4)  ///
             coeflabels(admico_2 = "2 yr prior"   ///
             admico_1 = "1 yr prior"              ///
             admico0  = "Yr of adopt"             ///
             admico1  = "1 yr after"              ///
             admico2  = "2 yr after"              ///
             admico3  = "3 yr after"              ///
             mico4    = "4+ yr after")            ///
             vertical                             ///
             yline(0)                             ///
             ytitle("Log points")                 ///
             xtitle("Time passage relative to year of adoption of implied contract exception") ///
             addplot(line @b @at)                 ///
             ciopts(recast(rcap))                 ///
             rescale(100)                         ///
             scheme(qleanmono)
          Click image for larger version

Name:	figurename.png
Views:	1
Size:	238.9 KB
ID:	1575329

          "Autor, David H. "Outsourcing at will: The contribution of unjust dismissal doctrine to the growth of employment outsourcing." Journal of labor economics 21, no. 1 (2003): 1-42."
          Last edited by Justin Niakamal; 02 Oct 2020, 15:31. Reason: Added source

          Comment


          • #6
            Thank you so much for the great advice, Justin! So, to clarify, does the code you provided align with my model? The model I'm thinking of is: Yict = B0 + B1*treat_ct-2 + B2*treat_ct-1 + B3*treat_ct + Xict + county FE + time FE + epsilon

            Comment


            • #7
              Take a close look at "Table 1: A Stylized Example" in the article below -- this is the cleanest explanation on this topic I've seen.
              You might find this command (ssc install eventdd) useful for your purposes. Hope this helps.

              http://ftp.iza.org/dp13524.pdf

              Comment


              • #8
                Hi Stephanie, I am dealing with a similar problem and dataset. I was wondering what specification you finally ended up using?

                Comment

                Working...
                X