Announcement

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

  • I seem to have version 1.72 ("*! v1.72 by FRA. Drops always treated"). When you asked me before, I also used "ssc install csdid, replace" and it said that everything was uptodate.
    Attaching a screenshot without the labels here... Shall I send you a reproducible example?
    Click image for larger version

Name:	gvar_tvar_table_nolab.png
Views:	1
Size:	15.1 KB
ID:	1712720

    Last edited by Anne Simon; 08 May 2023, 07:45.

    Comment


    • No need. I just reproduced the error.
      So, a) it is a bug I need to change. To least let you know what the error is.
      b) its related to my previous assessment. Namely, you don't have enough data to identify the effects properly
      The way CSDID is designed you NEED that all your GVARs are contained within all TVAR. Which is not what you have. In CSDID2, I actually fixed that. But in csdid, I didn't. So, it is internally getting mixed up, because it was expecting tvar to have all points in time for Gvar.
      unfortunately, without that it will not work.
      F

      Comment


      • Thank you for your efforts!

        Regarding b): I understood the helpfile in a way such that the treatment years (GVAR; in my case years 2000 - 2008) need to be observed within the time frame of the observation years (in my case survey years from 1999 - 2013; TVAR). But the way you put it now sounds a bit different from what I thought...

        Something else I figured out by now:
        It seems that csdid requires the time periods in TVAR to be symmetric, i.e. the same number of years need to have passed between two points in time (in our case the survey years would have to be e.g. 1999 - 2005 - 2011 or 1999 - 2006 - 2013). If I adjust the survey year variable in that way (e.g. change year 2013 to 2011), then the command runs smoothly (see screenshot). That would be ok, right? As long as I do not change anything about being early treated (before 2005) or late treated (after 2005), the order in which the groups are treated etc...


        Click image for larger version

Name:	csdid_symmetricyears.png
Views:	1
Size:	36.9 KB
ID:	1712737

        Comment


        • I think I would be hesitant of showing these results.
          Bottom line, I don't think your data is suitable for DID this way. You can still do DID 2x2 using drdid, and in that case, at least you have perfect control regarding WHO is used as control and WHO is treated. And which years you are comparing for your analysis.
          I would not recommend using CSDID results straight away.
          F

          Comment


          • Alright, I'll try using the drdid command then. Thank you so much for your thoughts on this, they were really helpful!

            Comment


            • Hi FernandoRios I've started using csdid2 and it is indeed incredibly fast. The only issue I find is that it doesn't let me run without covariates, while with csdid I can.

              csdid2 y, tvar(year) gvar(cohort) method(dripw) agg(simple)
              I get this error message
              ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
              drdid::ilogit(): 3200 conformability error
              drdid::dripw_rc(): - function returned error
              drdid::drdid(): - function returned error
              csdid::csdid(): - function returned error
              <istmt>: - function returned error

              Is it meant to be this way? Thanks for the help.

              Comment


              • Try using the latest version
                firs t check on my site
                https://friosavila.github.io/chatgpt/fra_03_30_2023/
                once you get “fra” running
                type
                fra install csdid2, replace
                restart Stata and try again

                Comment


                • Originally posted by FernandoRios View Post
                  Try using the latest version
                  firs t check on my site
                  https://friosavila.github.io/chatgpt/fra_03_30_2023/
                  once you get “fra” running
                  type
                  fra install csdid2, replace
                  restart Stata and try again
                  Lovely, thanks a lot, Fernando! Fra is running, and csdid2 was installed. I will try as soon as I can restart Stata. Many thanks!

                  Comment


                  • Dear Fernando,

                    I am currently using the csdid2 package, which I find very useful as the datasets I'm working with are quite large. However, I have a question regarding the use of the "window(#1 #2)" option when grouping the results by "event".

                    After running the command, I've tried to obtain the dynamic ATT's for only 10 periods using the option "estat event, window(-10, +10)" (as in the csdid), but Stata simply ignores it and gives me all the ATT's for all periods in my sample. Since I have many periods, the "window()" option would help me to obtain clearer results and make better plots.

                    Thank you in advance!

                    Comment


                    • Hi Carlos
                      I change the name, and im yet to document those changes
                      for what you are doing you need to type
                      estat, revent(-10/10)
                      if you would like a shorter list, or with just specific events you could:

                      estat, revent(-10 -5 -1 0 1 2 3 10)

                      revent, rgroup , rcalendar restrict your output using the list of numbers you provide, to select which groups will be considered or avoided to get the average effects.

                      Let me know if that works for you
                      F


                      Comment


                      • Hi Fernando,
                        I've tried the "revent()" option and it works the same as the "window()" option in csdid.
                        After running the csdid2, by typing: "estat event, revent(-10/10)" I've obtained results restricted to just 10 periods after and before treatment.
                        I've also done some tests with "estat group, rgroup()" and "estat calendar, rcalendar()" and also work fine.

                        Thank you so much for your quick response!

                        Comment


                        • Hey FernandoRios still struggling with csdid2 here. I am still unable to run csdid2 with no covariates. I reinstalled everything as you instructed in #307, but not been successful.



                          Now I have a different issue, and again, I would appreciate your clarifications. I run the following code, but still not sure to see the difference between estat calendar and estat event.

                          Code:
                            csdid2 scores l i.stateid if elig==1, time(year) gvar(cohortuf_stagg ) method(dripw) agg(group) cluster(schoolid)
                          ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
                          ..........
                          Difference-in-difference with Multiple Time Periods
                          Outcome model  : least squares
                          Treatment model: inverse probability
                          ------------------------------------------------------------------------------
                                       |               Robust
                                       | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                              GAverage |    .026236   .0110245     2.38   0.017     .0046285    .0478435
                                 g2011 |  -.0170135   .0250349    -0.68   0.497    -.0660809    .0320539
                                 g2012 |   .0456579   .0115261     3.96   0.000     .0230672    .0682486
                          ------------------------------------------------------------------------------
                          
                          . estat all
                          Option all not recognized
                          unrecognized command
                          r(199);
                          
                          . estat group
                          ------------------------------------------------------------------------------
                                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                              GAverage |    .026236   .0110245     2.38   0.017     .0046285    .0478435
                                 g2011 |  -.0170135   .0250349    -0.68   0.497    -.0660809    .0320539
                                 g2012 |   .0456579   .0115261     3.96   0.000     .0230672    .0682486
                          ------------------------------------------------------------------------------
                          
                          . estat event
                          ------------------------------------------------------------------------------
                                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                               Pre_avg |   -.018163   .0154908    -1.17   0.241    -.0485244    .0121984
                              Post_avg |   .0162415   .0128135     1.27   0.205    -.0088724    .0413554
                                   tm1 |   -.018163   .0154908    -1.17   0.241    -.0485244    .0121984
                                   tp0 |   .0060898   .0128828     0.47   0.636      -.01916    .0313397
                                   tp1 |   .0314717   .0133192     2.36   0.018     .0053665    .0575769
                                   tp2 |   .0272061   .0128285     2.12   0.034     .0020626    .0523496
                                   tp3 |   .0421821   .0125639     3.36   0.001     .0175573     .066807
                                   tp4 |  -.0257424   .0279634    -0.92   0.357    -.0805496    .0290648
                          ------------------------------------------------------------------------------
                          
                          . estat calendar
                          ------------------------------------------------------------------------------
                                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                              TAverage |   .0191515   .0128651     1.49   0.137    -.0060637    .0443667
                                 t2011 |   -.001346   .0312379    -0.04   0.966    -.0625711    .0598791
                                 t2012 |   .0038072   .0142353     0.27   0.789    -.0240935     .031708
                                 t2013 |   .0282782   .0135463     2.09   0.037     .0017279    .0548286
                                 t2014 |   .0227177   .0128425     1.77   0.077    -.0024531    .0478886
                                 t2015 |   .0423004   .0132491     3.19   0.001     .0163326    .0682682
                          ------------------------------------------------------------------------------
                          As results are too different, I am having trouble to interpret them.

                          Another question: how can I plot event by each specific group using csdid2?

                          Thank you so much for all the help in advance.

                          Comment


                          • Hi Sandra
                            ok so
                            Not sure why you cant run the model without covariates. I just reinstalled a version on my machine (using fra install) and I'm able to use it without controls.
                            Inregards to calendar. It is the Group /cohort specific Treatment effect.
                            Event is the average of the effects with respect to the relative year

                            Finally for group specific plots

                            ssc install frause, replace
                            fra install csdid2, replace

                            clear all
                            frause mpdta

                            csdid2 lemp, ivar(countyreal) tvar(year) gvar(first) long
                            estat event, rgroup(2004) plot
                            estat event, rgroup(2006) plot
                            estat event, rgroup(2007) plot

                            Hope this helps
                            Fernando

                            Comment


                            • Originally posted by FernandoRios View Post
                              Hi Sandra
                              ok so
                              Not sure why you cant run the model without covariates. I just reinstalled a version on my machine (using fra install) and I'm able to use it without controls.
                              Inregards to calendar. It is the Group /cohort specific Treatment effect.
                              Event is the average of the effects with respect to the relative year

                              Finally for group specific plots

                              ssc install frause, replace
                              fra install csdid2, replace

                              clear all
                              frause mpdta

                              csdid2 lemp, ivar(countyreal) tvar(year) gvar(first) long
                              estat event, rgroup(2004) plot
                              estat event, rgroup(2006) plot
                              estat event, rgroup(2007) plot

                              Hope this helps
                              Fernando
                              Thank you Fernando!! Well, it is not working for me. Thanks for helping with the code and clarifications, I was using group only. All the best!!

                              Comment


                              • Using csdid_plot in Stata, the x axis is Period to treatment. Is it possible to use the time instead, like is done in R? Using the replication example:

                                In Stata: x axis is Period to treatment.

                                Click image for larger version

Name:	teste.jpg
Views:	1
Size:	27.8 KB
ID:	1720266


                                In R: the x axis is time.

                                Click image for larger version

Name:	teste2.png
Views:	1
Size:	13.0 KB
ID:	1720267

                                Comment

                                Working...
                                X