Announcement

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

  • Dear FernandoRios

    I am carrying out an evaluation of a sectoral legislation implemented in 2020, and I have annual cross section data for a previous period (2019) and all subsequent periods (2021 - 2023). The policy was applied once for all agents in the category.
    In this case, as there is no staggered treatment, to estimate the ATT for all years following implementation, is it preferable to use the csdid, or several 2x2 estimations with the drdid?

    Thank you very much in advance.

    Comment


    • its the same
      csdid carries on several drdid on the background

      Comment


      • Dear FernandoRios ,

        I have daily data concerning around 250 stocks. In my case, I am trying to study the effect of a tax that was first introduced in 2012 for 109 stocks. This list of stocks is updated every year. Therefore, I will have some companies that will no longer be taxed and others that will be newly taxed in 2013, for example, and so on.

        I have two problems.

        The first one concerns the frequency of my data. Using daily data from 2012 to 2023 results in a large number of observations, and the commands (csdid or did_multiplegt) do not work. Would it be better in my case to use monthly data?

        The second problem relates to the number of stocks that enter and exit each year, which varies between 5 and 20. Will this cause issues when I use the models from Callaway & Sant’Anna or the model from De Chaisemartin & D'Haultfœuille?


        Thank you.

        Emna

        Comment


        • Dear FernandoRios

          I hope this message finds you well.
          I am currently working on a DiD analysis using monthly firm-level data and encountered an issue with calculating the ATT.
          Despite trying multiple approaches, I haven't been able to resolve it.

          Here is the code I have been using:


          Code:
          csdid Y X, cluster(firm) time(month) gvar(start_date) method(reg) notyet
          estat all, wboot
          
          Pretrend Test. H0 All Pre-treatment are equal to 0
          chi2(567) = 7.994e+10
          p-value = 0.0000
          Average Treatment Effect on Treated
          ------------------------------------------------------------------------------
          | Coefficient Std. err. z P>|z| [95% conf. interval]
          -------------+----------------------------------------------------------------
          ATT | 0 (omitted)
          ------------------------------------------------------------------------------
          ATT by group
          ------------------------------------------------------------------------------
          | Coefficient Std. err. z P>|z| [95% conf. interval]
          -------------+----------------------------------------------------------------
          GAverage | 0 (omitted)
          ------------------------------------------------------------------------------
          conformability error
          r(503);
          
          end of do-file
          
          r(503);
          The output indicates a conformability error, and the ATT is omitted from the results.
          I'm unsure how to correct this. Could you possibly guide me on what might be causing this issue or suggest any modifications to my approach?

          Thank you very much for your time and help.

          Best regards,
          Xiao

          Comment


          • First thing first. Check how your gvar is constructed. And make sure that when tabulating year and gvar, it looks like what you will find in the example dataset

            Comment


            • Dear @FernandoRios

              Thank you very much for your guidance on checking the gvar and its alignment with the time variable in my dataset.
              Following your advice, I tabulated year and gvar and discovered the issue that was affecting the calculation of the ATT.
              After making the necessary adjustments, the model is now performing as expected.

              I truly appreciate your help in pointing me in the right direction. It was crucial in resolving the issue.

              Best regards,
              Xiao

              Comment


              • Dear FernandoRios ,

                I have a question on the e(gtt) matrix: Is there a list of error codes? I am running csdid on an unbalanced panel of firms, where observations both enter and exit during the observation period (including observations with gaps). The "error" column of e(gtt) therefore contains cohorts with errors 430, 504, 555 and 2000. I would like to investigate closer the source of the errors for the respective cohorts. Using the ado file of drdid (https://github.com/friosavila/csdid_...code/drdid.ado), I have only been able to trace down error code 555 as a failure of the mata function
                Code:
                is2x2()
                I attribute this to the missing data for this cohort. Errors 430 and 2000 only appear if I re-weight observations using a Propensity Score of being treated.

                Thanks tremendously for helping me out in my understanding and for providing the community with this estimator.
                Best wishes,
                Daniel
                Last edited by Daniel Prosi; 24 May 2024, 08:44.

                Comment


                • Dear all,
                  I have a setting with heterogeneous timing of reform introduction, and with the reform being of different intensity in each country. I have data on both years of introduction and intensity of treatment. Is there any way of exploiting both of these sources of information in a meaningful way? I've read work of Fong, Hazlett and Imai [FHI] on "Covariate balancing propensity score for a continuous treatment: application to the efficacy of political advertisements". Is is possible to combine it with CSDID (it has option "iweights")? If not, would you suggest some other approach (e.g. simply recentering data around reform introduction years, running standard DiD, and using weights from [FHI])?

                  Thank you in advance for all the help!

                  Comment


                  • Originally posted by Daniel Prosi View Post
                    Dear FernandoRios ,

                    I have a question on the e(gtt) matrix: Is there a list of error codes? I am running csdid on an unbalanced panel of firms, where observations both enter and exit during the observation period (including observations with gaps). The "error" column of e(gtt) therefore contains cohorts with errors 430, 504, 555 and 2000. I would like to investigate closer the source of the errors for the respective cohorts. Using the ado file of drdid (https://github.com/friosavila/csdid_...code/drdid.ado), I have only been able to trace down error code 555 as a failure of the mata function
                    Code:
                    is2x2()
                    I attribute this to the missing data for this cohort. Errors 430 and 2000 only appear if I re-weight observations using a Propensity Score of being treated.

                    Thanks tremendously for helping me out in my understanding and for providing the community with this estimator.
                    Best wishes,
                    Daniel
                    Hi Daniel
                    Yes, GTT error collects the error that was generated at some point of the estimation.
                    You are correct in that the best approach is to go for each cohort and time, and use drdid to look further. But if you want to explore the errors further, you may need to estimate everything manually.
                    F

                    Comment


                    • Originally posted by Mike Br View Post
                      Dear all,
                      I have a setting with heterogeneous timing of reform introduction, and with the reform being of different intensity in each country. I have data on both years of introduction and intensity of treatment. Is there any way of exploiting both of these sources of information in a meaningful way? I've read work of Fong, Hazlett and Imai [FHI] on "Covariate balancing propensity score for a continuous treatment: application to the efficacy of political advertisements". Is is possible to combine it with CSDID (it has option "iweights")? If not, would you suggest some other approach (e.g. simply recentering data around reform introduction years, running standard DiD, and using weights from [FHI])?

                      Thank you in advance for all the help!
                      csdid does not support iweights. Only pweights. But that should be enough to use weights from other procedures, as long as they are constant across panels (if you are using panel data)

                      Comment


                      • Dear @FernandoRios, and everyone else who can answer,

                        I want to use drdid. However, I have a very basic questions that I cannot seem to find an answer to: - How can I "test" for conditional parallel trends/pre-trends when drdid is used? (If this is not possible, what would one do instead?

                        Thank you in advance for your time and help!

                        Kind regards,

                        J
                        Last edited by Johanne Friedmann; 07 Jun 2024, 13:46.

                        Comment


                        • If you only have two periods parallel trend tests are not applicable.
                          ypu need more time or different groups otherwise

                          Comment


                          • Every time I run the following code in Stata 18.0, I get different results for `t_2010_2013` and `t_2010_2016` when executing the code again, while `t_2007_2010` always gives the same result. This does not happen when I use personal ID (pid) instead of household ID (hhid). What am I doing wrong?

                            csdid fscore i.female_head grade_head hhsize, ivar(hhid) time(year) gvar(first_treat) method(drimp)


                            Code:
                            * Example generated by -dataex-. For more info, type help dataex
                            clear
                            input double fscore float(female_head grade_head hhsize) double hhid int year float first_treat str10 pid
                             5 1 0 2 10101215001 2007 0 "002102"    
                             5 1 0 2 10101215001 2007 0 "002101"    
                             6 1 0 1 10101215001 2010 0 "002101"    
                             6 1 0 1 10101215001 2013 0 "002101"    
                             5 1 0 1 10101215001 2016 0 "002101"    
                             7 0 0 1 10101215004 2007 0 "001701"    
                             5 0 0 6 10101215004 2010 0 "001700106" 
                             5 0 0 6 10101215004 2010 0 "001700105" 
                             5 0 0 6 10101215004 2010 0 "001701"    
                             5 0 0 6 10101215004 2010 0 "001700102" 
                             5 0 0 6 10101215004 2010 0 "001700103" 
                             5 0 0 6 10101215004 2010 0 "001700104" 
                            11 0 4 8 10101215004 2013 0 "001700106" 
                            11 0 4 8 10101215004 2013 0 "001700105" 
                            11 0 4 8 10101215004 2013 0 "001700102" 
                            11 0 4 8 10101215004 2013 0 "3001000107"
                            11 0 4 8 10101215004 2013 0 "001700104" 
                            11 0 4 8 10101215004 2013 0 "3001000108"
                            11 0 4 8 10101215004 2013 0 "001701"    
                            11 0 4 8 10101215004 2013 0 "001700103" 
                            10 0 8 9 10101215004 2016 0 "001700102" 
                            10 0 8 9 10101215004 2016 0 "001700104" 
                            10 0 8 9 10101215004 2016 0 "001701"    
                            10 0 8 9 10101215004 2016 0 "001700106" 
                            10 0 8 9 10101215004 2016 0 "3001000107"
                            10 0 8 9 10101215004 2016 0 "001700103" 
                            10 0 8 9 10101215004 2016 0 "4001000109"
                            10 0 8 9 10101215004 2016 0 "3001000108"
                            10 0 8 9 10101215004 2016 0 "001700105" 
                             7 0 6 9 10101215021 2007 0 "001103"    
                             7 0 6 9 10101215021 2007 0 "001104"    
                             7 0 6 9 10101215021 2007 0 "001101"    
                             7 0 6 9 10101215021 2007 0 "001105"    
                             7 0 6 9 10101215021 2007 0 "001108"    
                             7 0 6 9 10101215021 2007 0 "001106"    
                             7 0 6 9 10101215021 2007 0 "001107"    
                             7 0 6 9 10101215021 2007 0 "001102"    
                             7 0 6 9 10101215021 2007 0 "001109"    
                             7 0 7 9 10101215021 2010 0 "001108"    
                             7 0 7 9 10101215021 2010 0 "001100109" 
                             7 0 7 9 10101215021 2010 0 "001106"    
                             7 0 7 9 10101215021 2010 0 "001105"    
                             7 0 7 9 10101215021 2010 0 "001101"    
                             7 0 7 9 10101215021 2010 0 "001109"    
                             7 0 7 9 10101215021 2010 0 "001103"    
                             7 0 7 9 10101215021 2010 0 "001102"    
                             7 0 7 9 10101215021 2010 0 "001107"    
                             6 0 7 8 10101215021 2013 0 "001108"    
                             6 0 7 8 10101215021 2013 0 "001100109" 
                             6 0 7 8 10101215021 2013 0 "001102"    
                             6 0 7 8 10101215021 2013 0 "3000600110"
                             6 0 7 8 10101215021 2013 0 "001106"    
                             6 0 7 8 10101215021 2013 0 "001107"    
                             6 0 7 8 10101215021 2013 0 "001101"    
                             6 0 7 8 10101215021 2013 0 "001109"    
                             . 0 7 8 10101215021 2016 0 "001106"    
                             . 0 7 8 10101215021 2016 0 "001101"    
                             . 0 7 8 10101215021 2016 0 "3000600110"
                             . 0 7 8 10101215021 2016 0 "001108"    
                             . 0 7 8 10101215021 2016 0 "001107"    
                             . 0 7 8 10101215021 2016 0 "001100109" 
                             . 0 7 8 10101215021 2016 0 "001109"    
                             . 0 7 8 10101215021 2016 0 "001102"    
                             9 0 8 9 10101215022 2007 0 "000509"    
                             9 0 8 9 10101215022 2007 0 "000503"    
                             9 0 8 9 10101215022 2007 0 "000505"    
                             9 0 8 9 10101215022 2007 0 "000508"    
                             9 0 8 9 10101215022 2007 0 "000502"    
                             9 0 8 9 10101215022 2007 0 "000506"    
                             9 0 8 9 10101215022 2007 0 "000501"    
                             9 0 8 9 10101215022 2007 0 "000504"    
                             9 0 8 9 10101215022 2007 0 "000507"    
                             7 0 7 9 10101215022 2010 0 "000505"    
                             7 0 7 9 10101215022 2010 0 "000508"    
                             7 0 7 9 10101215022 2010 0 "000504"    
                             7 0 7 9 10101215022 2010 0 "000507"    
                             7 0 7 9 10101215022 2010 0 "000506"    
                             7 0 7 9 10101215022 2010 0 "000509"    
                             7 0 7 9 10101215022 2010 0 "000502"    
                             7 0 7 9 10101215022 2010 0 "000501"    
                             7 0 7 9 10101215022 2010 0 "000503"    
                             9 0 7 8 10101210022 2013 0 "000506"    
                             9 0 7 8 10101215022 2013 0 "000501"    
                             9 0 7 8 10101215022 2013 0 "000502"    
                             7 0 3 3 10101215022 2013 0 "000503"    
                             9 0 7 8 10101215022 2013 0 "3000300110"
                             9 0 7 8 10101215022 2013 0 "000507"    
                             7 0 3 3 10101210022 2013 0 "3000300301"
                             7 0 3 3 10101215022 2013 0 "3000300303"
                             9 0 7 8 10101215022 2013 0 "000509"    
                             9 0 7 8 10101215022 2013 0 "000505"    
                             9 0 7 8 10101215022 2013 0 "000508"    
                             9 0 7 7 10101215022 2016 0 "4000200111"
                             9 0 7 7 10101215022 2016 0 "000508"    
                             . 0 3 4 10101215022 2016 0 "3000300303"
                             . 0 3 4 10101215022 2016 0 "3000300301"
                             9 0 7 7 10101215022 2016 0 "000509"    
                            10 0 6 3 10101215022 2016 0 "4000200601"
                             6 0 8 2 10101215022 2016 0 "000505"    
                             9 0 7 7 10101215022 2016 0 "4000200110"
                            end


                            Thank you very much in advance for any help!
                            Last edited by Johanne Friedmann; 10 Jun 2024, 11:00.

                            Comment


                            • Two options
                              1) you have an older version of csdid and drdid
                              2) If you use ivar() it means your data is panel. If not, with the older version, it would produce different results (as you report)

                              Comment


                              • Dear Fernando,

                                Thank you very much for your responses; I really appreciate them!

                                I have tried around a lot, and unfortunately, my issue still occurs, and the results change every time I reload the data and run the code again.

                                In regard to your recommendations:

                                1) Stata does still tell me, "Program DRDID is outdated, or not installed," when running csdid.

                                When running "which drdid," stata tells me it's version 1.6. Additionally, when running "ssc install drdid, all replace," it tells me that the file already exists and is up to date. All web pages I checked suggest that 1.6 is the most recent version; however, I am not 100% certain if this is actually up-to date information. When using "which csdid" Stata tells me it's version 1.72. Is there anything else that I should check or have forgotten?

                                Moreover, even if we assume that my drdid is not up-to-date and the error "Program DRDID is outdated, or not installed. " is true, I do not understand how I get the same results every time I run the example code from your webpage and receive the results as you displayed there.

                                2) I assumed that I could use ivar() as I have panel data, which I now think was a bit naive as I could imagine that due to some missings, it's not understood as (at least balanced) panel data. However, when removing all entries that are missing and making sure the panel is balanced the message: "Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1)..." is gone, but the issue of different results persists.

                                I really hope my post is understandable, and I want to thank you very much again!
                                Last edited by Johanne Friedmann; 13 Jun 2024, 05:53.

                                Comment

                                Working...
                                X