Announcement

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

  • Combining jwdid event aggreagations with event_plot

    Hello,
    I am trying to estimate a DiD event plot model and I would like to put into the same plot both my TWFE estiamtes as well as the results of the approach introduced by Wooldridge 2021 (ETWFE).

    Does someon know a workaround to do this?

    Here is an example
    First I estimate my ETWFE model
    Code:
    * Upload baseline data
    ssc install frause
    frause mpdta.dta, clear
    
    * jwdid estimates
    jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat) never
    estat event,  estore(etwfe)
    then I create variables necessary to estimate a simple TWFE

    Code:
    * create lags and lead dummies to estimate the simple twfe model
    decode __event__, gen(ttt)
    destring ttt,replace
    
    summ ttt
    local relmin = abs(r(min))
    local relmax = abs(r(max))
    
        // leads
        cap drop F_*
        forval x = 2/`relmin' {  // drop the first lead
            gen F_`x' = ttt == -`x'
        }
    
        
        //lags
        cap drop L_*
        forval x = 0/`relmax' {
            gen L_`x' = ttt ==  `x'
        }
    And estimate the simple TWFE model

    Code:
    reghdfe lemp L_* F_*, absorb(countyreal year)
    eststo twfe
    Now how can I combine the results of my estimation into a single plot using event_plot?

    here is one attempt

    Code:
     est restore etwfe
    (results etwfe are active now)
    
    . matrix etwfe_b = e(b_iw)
    
    . matrix etwfe_v = e(V_iw)
    
    .
    .
    . event_plot twfe etwfe_b#etwfe_v, ///
    >     stub_lag(L_# L__event__#) ///
    >     stub_lead(F_# F__event__#) //
    No estimates found for the model "etwfe_b#etwfe_v". Make sure you have specified stub_lag and stub_lead correctly.
    r(498);
    I think the problem relates to the fact that the way jwdid estimates are saved does not differentiates pre-post treatment and the solution would be to do a workaround to rename the estimates. Would anyone be able to help me?


    Code:
    . matrix list jw_b
    
    jw_b[1,29]
                 1.          2.          3.          4.          5.          6.          7.          8.          9.
         __event__   __event__   __event__   __event__   __event__   __event__   __event__   __event__   __event__
    y1    .0020739  -.00535054   .00346115   .01881496   .01907641  -.00106849  -.02179202  -.01319871           0
    
                10.         11.         12.         13.         14.         15.         16.         17.         18.
         __event__   __event__   __event__   __event__   __event__   __event__   __event__   __event__   __event__
    y1  -.00500839   -.0008726  -.00085282   -.0135531  -.00487692   .01775061  -.00271763   .00220589  -.01344839
    
                19.         20.         21.         22.         23.         24.         25.         26.         27.
         __event__   __event__   __event__   __event__   __event__   __event__   __event__   __event__   __event__
    y1   .01331134   .02196031   .01573812   .00941126   .02729782   .01452821   .02321013  -.02210793   .01325247
    
                28.         29.
         __event__   __event__
    y1  -.01168418  -.09846029


    thank you very much in advance for your help
Working...
X