Announcement

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

  • Hi Fernando

    Thanks for the advice! I'll try with a more consistent group / run some placebo tests and see how it looks.

    Thanks again!

    David

    Comment


    • I have seen the same error in some other posts, but none of the solutions worked for me. I am running the following code with the long2 option:

      Code:
      csdid per_des,  ivar(id_municipio) gvar(lag_treat) time(ano) long2 method(reg)
      estat event, window(-5 5) estore(cs)
      csdid_plot, legen(off) xlabel(#10,labsize(large)) xtitle("Years relative to treatment",size(large)) ylabel(#5,labsize(large)) ytitle("ATT",size(large))
      estat simple, estore(arrecadacao_total)
      graph export "figures/desmatamento_total.pdf", replace
      Nevertheless, I keep getting this error message:

      Code:
      . estat event, window(-5 5) estore(cs)
      ATT by Periods Before and After treatment
      Event Study:Dynamic effects
                             *:  3200  conformability error
                 csdid_event():     -  function returned error
                       <istmt>:     -  function returned error
      Last edited by Mateus Maciel; 13 Feb 2026, 17:48.

      Comment


      • Mateus: Is it true the error disappears if you drop window(-5 5)? You might try jwdid, as that accomplishes the same thing via running a single TWFE regression.

        Code:
        jwdid per_des, ivar(id_municipio) tvar(ano) gvar(lag_treat) never
        estat event, window(-5 5) estore(cs)

        Comment


        • Dear @FernandoRios,

          Thank you for developing the incredibly helpful csdid package. I am currently using it for my Master's thesis to estimate the dynamic effects of a fertility shock on gig economy income, using a balanced panel data from 2011 to 2023. My treatment cohorts (first childbirth) occur between 2017 and 2023.

          I am running the following command:

          Code:
          csdid gigjob_income c.age##c.age, ivar(mom_id) time(year) gvar(first_birth_year) long2
          
          estat event, window(-4 4)
          However, the output table displays event-time coefficients starting from Tm5 instead of Tm4, as shown below:

          Code:
          ------------------------------------------------------------------------------
                      | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
              Pre_avg |  -44.71372   29.70189    -1.51   0.132    -102.9283    13.50091
             Post_avg |   516.9128   70.77064     7.30   0.000     378.2049    655.6207
                  Tm5 |  -44.67074   32.52688    -1.37   0.170    -108.4223    19.08079
                  Tm4 |  -42.92353   32.55161    -1.32   0.187    -106.7235    20.87647
                  Tm3 |  -43.42168   31.83051    -1.36   0.173    -105.8083    18.96496
                  Tm2 |  -47.83893   27.54437    -1.74   0.082    -101.8249    6.147045
                  Tp0 |   7.317326   25.82761     0.28   0.777    -43.30385     57.9385
                  Tp1 |     177.32   44.67611     3.97   0.000     89.75648    264.8836
                  Tp2 |    526.611   69.73675     7.55   0.000     389.9295    663.2926
                  Tp3 |   791.2632   106.6887     7.42   0.000     582.1571    1000.369
                  Tp4 |   1082.053   157.5165     6.87   0.000      773.326    1390.779
          ------------------------------------------------------------------------------
          Based on my manual calculation, the Pre_avg (-44.71372) is the exact simple average of the displayed coefficients from Tm2 to Tm5.

          Could you kindly clarify the following points regarding the underlying mechanism of this output?
          1. Why is Tm5 displayed when the window is explicitly set to (-4 4)?
          2. Does Tm5 represent "endpoint binning"? Since my panel data traces back to 2011 (meaning that for the 2017 cohort, pre-treatment periods go up to e = -6), does the Tm5 coefficient represent an aggregated/binned average of all early periods (e <= -5)? Or does it strictly represent the isolated relative time e = -5?
          I want to ensure I interpret and report the pre-trend test and the event window correctly in my thesis. Any clarification would be greatly appreciated.

          Thank you very much for your time and your contribution to the Stata community.
          Last edited by YITING HUANG; 24 Mar 2026, 00:20.

          Comment


          • I dont remember complletly, but i think that is because -4 meant (for me) to use 4 periods before treatment (-5 to -2) so you can use -3 if you want up to -4
            and No, window event DOES NOT show binning. It ignores Treatments above or below the shown threshold
            F

            Comment

            Working...
            X