Announcement

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

  • Hi @FernandoRios,

    I am using csdid. I have a few questions about the csdid's output. Here is an example of my code:

    csdid rpcinccpi distCBD if cty==1, ivar(StationID) time(year2) gvar(openingyear2) notyet long2
    estat simple
    estat calendar
    estat group
    estat event
    csdid_plot, title("Event-Study")
    estat pretrend
    Is estat simple equation (3.10) in Callaway and Sant’Anna (2021)? Further, I assume that estat event generates the "Event study" line of estimates in Table 3 of Callaway and Sant’Anna (2021)?

    Thanks for your help in advance!

    -Erik
    Last edited by Erik Nelson; 16 Jun 2025, 12:42.

    Comment


    • 1) Yes, that is the idea
      2) No, the original paper CS(2021) produced "Dynamic" effectplot that is replicated if ou drop the long2 option. However, most people like the traditional event/like plot that is what you observe

      Comment


      • Dear Fernando,

        I'm using the Stata csdid package as part of my job market paper. In the main specification, I cluster the standard errors at the district level (around 400 districts). As a robustness check, I, however, need to show that the results are robust when clustering at a more aggregate level (regions, 11 in total). For this purpose, I'm using wild bootstrap within the csdid command. I'm sharing the code that I'm using for this purpose below. I'm a bit surprised by how large the t statistics still is after wild bootstrapping standard errors. When I replicate the results with standard TWFE and wild bootstrap standard errors there, the p values get much larger - this may partly be due to smaller coefficients when using TWFE but I'm not sure the difference in how the statistical significance of the results changes with and without bootstrap standard errors should be so large. Could you please check the code to see if I'm applying the wild bootstrap command correctly? (I tried to closely follow the example in the Stata helpfile).

        Code:
        gen gvar = cond(reformyear== ., 0, reformyear) // group variable as required for the csdid command
        
        csdid $outcome, time(birthyear) gvar(gvar) method(reg) agg(simple) cluster($se_distr)  
        
        csdid $outcome, time(birthyear) gvar(gvar) method(reg) cluster($se_region) wboot rseed(1212) saverif(_rif_) replace 
            
        use _rif_, clear
        
        csdid_rif ATT  , wboot reps(2000) cluster($se_region) seed(1212)
        Here are screenshots from the results window (1) after wild bootstrapping standard errors (I'm not showing the first part of the results here as the table is very large with lots of comparisons) and (2) with the more disaggregately clustered standard errors:

        Click image for larger version

Name:	wildbootstrap results.jpg
Views:	1
Size:	46.4 KB
ID:	1778998


        Click image for larger version

Name:	clustered results district level.jpg
Views:	1
Size:	104.5 KB
ID:	1778999


        Thanks a lot in advance!

        Kind regards,
        Anne

        Comment


        • There is something else going on here.
          Your results using csdid_rif and estat simple should be the same. Would need to double check what you are getting

          Comment


          • Thank you for your response! Is there anything you'd need from me to do that?

            Comment


            • Reproducible example

              Comment


              • Alright. I will share one with you on Monday/ Tuesday.

                Comment


                • Just a heads up:
                  I shared the data and code via email with you yesterday.

                  Comment


                  • Yes Saw that. Will take at least til friday to look at it

                    Comment


                    • Hello Fernando,

                      Thank you for your work on these packages. I am using csdid to conduct a heterogeneity analysis by subgroup. Specifically, I estimate ATT effects separately for males and females using a common treatment timing, with 4 years pre- and 2 years post-treatment. I'm working with panel data.

                      Specifically, I am running:

                      Code:
                       csdid outcome  $controls if male == 1, ivar(id) time(year) gvar(first_treated) long method(reg)
                       csdid outcome  $controls if male == 0, ivar(id) time(year) gvar(first_treated) long method(reg)
                      I would like to test whether the point estimates from these two subgroup models (e.g., the post-treatment ATT estimates) are statistically different. After running:
                      Code:
                      estat simple

                      I tried the following approach:

                      Code:
                      csdid outcome  $controls if male == 1, ivar(id) time(year) gvar(first_treated) long method(reg)
                      estat simple 
                      estimates store m1
                         
                      csdid outcome  $controls if male == 0, ivar(id) time(year) gvar(first_treated) long method(reg)
                      estat simple
                      estimates store m2
                           
                      suest m1 m2
                      However, I received the following error:

                      unable to generate scores for model m1
                      suest requires that predict allow the score option
                      r(322);
                      I then attempted:

                      Code:
                      csdid outcome  $controls if male == 1, ivar(id) time(year) gvar(first_treated) long method(reg)
                      estat simple 
                      predict att
                      But encountered another error:

                      variable t_2006_2009 not found
                      r(111);
                      I understand that csdid may not be fully compatible with suest or traditional predict commands. What would you recommend as the best way to formally test whether subgroup ATT estimates (from estat simple or estat event​​​​​​​) are statistically different?

                      Is there a workaround or built-in approach in csdid that allows for this kind of subgroup comparison, accounting for uncertainty in the estimates?

                      I’m using csdid for my main analysis, so I’d like to use the same method for the subgroup analysis to keep things consistent.

                      Many thanks in advance for your help.

                      Comment


                      • You can’t do it with csdid
                        i posted some time ago something for this, which requires more steps.
                        but if you use jwdid instead, is far easier.

                        Comment


                        • You can’t do it with csdid
                          i posted some time ago something for this, which requires more steps.
                          but if you use jwdid instead, is far easier.

                          Comment

                          Working...
                          X