Announcement

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

  • DID with multiple treatment times

    Hello

    I am new to the forum and I am editing my last post in which I posted a picture of the data only to realise later that I shouldn't be doing it in that manner.

    I am trying to use the "csdid" command in stata which is for treatment with multiple time periods and I have a dataset of about 64 countries of which 38 are treated and 26 are never treated. While I do have treatment year for the "treated group" but nothing for the "never-treated/control group". So, for the treated group I have taken 3 years for each post and pre-treatment year (so for each country it's 6 years in total), while I have taken data for the control group from 1987-2021. Hence, whenever I run my estimation, I'm getting a very high standard error.

    I was hoping to get some help regarding this issue wherein if there is a way to accurately decide which years should be used for the control group so that I run the code correctly.

    I would be very grateful if someone can help me out with this, I will put a glimpse of how my data looks.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str3 country int year float hcpi_a byte treat
    "ALB" 2006    2.41 0
    "ALB" 2007    2.91 0
    "ALB" 2008    3.41 0
    "ALB" 2009    2.29 1
    "ALB" 2010    3.57 1
    "ALB" 2011    3.41 1
    "ALB" 2012    2.03 1
    "ARM" 2003    4.54 0
    "ARM" 2004    5.93 0
    "ARM" 2005     .72 0
    "ARM" 2006    3.43 1
    "ARM" 2007    4.55 1
    "ARM" 2008    9.02 1
    "ARM" 2009    3.54 1
    "AFG" 1987    18.4 0
    "AFG" 1988    27.5 0
    "AFG" 1989    71.5 0
    "AFG" 1990    47.4 0
    "AFG" 1991    43.8 0
    "AFG" 1992   58.19 0
    "AFG" 1993   33.99 0
    "AFG" 1994   20.01 0
    "AFG" 1995      14 0
    "AFG" 1996   14.01 0
    "AFG" 1997   14.01 0
    "AFG" 1998   14.01 0
    "AFG" 1999   14.01 0
    "AFG" 2000       0 0
    "AFG" 2001   -43.4 0
    "AFG" 2002   51.93 0
    "AFG" 2003   35.66 0
    "AFG" 2004   16.36 0
    "AFG" 2005   10.57 0
    "AFG" 2006    6.78 0
    "AFG" 2007    8.68 0
    "AFG" 2008   26.42 0
    "AFG" 2009   -6.81 0
    "AFG" 2010    2.18 0
    "AFG" 2011    11.8 0
    "AFG" 2012    6.44 0
    "AFG" 2013    7.39 0
    "AFG" 2014    4.67 0
    "AFG" 2015    -.66 0
    "AFG" 2016    4.38 0
    "AFG" 2017    4.98 0
    "AFG" 2018     .63 0
    "AFG" 2019     2.3 0
    "AFG" 2020    5.44 0
    "AFG" 2021    5.06 0
    "AGO" 1987    1.83 0
    "AGO" 1988    1.83 0
    "AGO" 1989    1.83 0
    "AGO" 1990    1.83 0
    "AGO" 1991   85.26 0
    "AGO" 1992   299.1 0
    "AGO" 1993 1379.48 0
    "AGO" 1994  949.77 0
    "AGO" 1995 2672.23 0
    "AGO" 1996 4146.01 0
    "AGO" 1997  221.49 0
    "AGO" 1998  107.43 0
    "AGO" 1999  248.25 0
    "AGO" 2000  325.03 0
    "AGO" 2001  152.59 0
    "AGO" 2002  108.89 0
    "AGO" 2003   98.22 0
    "AGO" 2004   43.53 0
    "AGO" 2005   22.96 0
    "AGO" 2006   13.31 0
    "AGO" 2007   12.25 0
    "AGO" 2008   12.47 0
    "AGO" 2009   13.72 0
    "AGO" 2010   14.48 0
    "AGO" 2011   13.48 0
    "AGO" 2012   10.28 0
    "AGO" 2013    8.78 0
    "AGO" 2014     7.3 0
    "AGO" 2015    9.16 0
    "AGO" 2016   32.38 0
    "AGO" 2017   29.84 0
    "AGO" 2018   19.63 0
    "AGO" 2019   17.08 0
    "AGO" 2020   21.02 0
    "AGO" 2021   23.85 0
    end

    Thank you

  • #2
    Hey Sharma Swati. Perhaps FernandoRios may comment on the matter. Thank you for a more reproducible example! Oh, could you please share the code you've tried so far?

    Comment


    • #3
      Hey Jared Greathouse, Thanks for the response. This is the code I have so far:

      //creating country codes first:
      cap egen country_code=group(country)

      //sorting and creating the same years for all countries. There are some treated countries for which the data isn't 6 years but maybe 4 and 5 so this I did so that things looks more or less the same:
      sort country_code year
      bysort country_code: gen order=_n


      //Then creating gvar:
      egen gvar = csgvar(treat), tvar(year) ivar(country_code)
      gen gvar1=4 if gvar != 0
      replace gvar1=0 if gvar1 == .

      //then running csdid command:
      csdid hcpi_a, ivar(country_code) time(order) gvar(gvar1)

      //for combined results
      estat all

      Comment


      • #4
        Hi Sharma
        not sure why you have the line
        gvar1=4 if gvar!=0
        Are you assuming all units are treated in period 4?
        Also can you tabulate the following:
        tab order gvar
        tab order gvar1
        to have an idea of the sample size
        Thank you

        Comment


        • #5
          FernandoRios Hello. Thanks for the response.

          I have that line because I have taken 3 years of pre and post-treatment data for the treated countries so I want Stata to establish that they were treated in period 4. Also, since I have treatment time for the treatment group, I am able to figure out how to decide which years to consider for the treatment group.

          But I am not able to decide which and how many years of data to take for the control group (never treated countries). When I take the entire period of data from 1987-2021 for the control group, I get insignificant results. So, I am not sure what I am doing wrong and I also have an unbalanced panel. This is what I am getting so far with the result:

          Code:
          csdid hcpi_a, ivar(country_code) time(order) gvar(gvar1)
          Panel is not balanced
          Will use observations with Pair balanced (observed at t0 and t1)
          .......xxxxxxxxxxxxxxxxxxxxxxxxxxx
          Difference-in-difference with Multiple Time Periods
          
                                                                     Number of obs = 503
          Outcome model  : regression adjustment
          Treatment model: none
          Code:
          estat all
          Pretrend Test. H0 All Pre-treatment are equal to 0
          chi2(2) =     5.0482
          p-value  =     0.0801
          Average Treatment Effect on Treated
          ------------------------------------------------------------------------------
                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                   ATT |  -130.4196   88.13105    -1.48   0.139    -303.1533    42.31409
          ------------------------------------------------------------------------------
          ATT by group
          ------------------------------------------------------------------------------
                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
              GAverage |  -130.4196   88.13105    -1.48   0.139    -303.1533    42.31409
                    G4 |  -130.4196   88.13105    -1.48   0.139    -303.1533    42.31409
          ------------------------------------------------------------------------------
          ATT by Calendar Period
          ------------------------------------------------------------------------------
                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
              CAverage |  -326.7768   258.6283    -1.26   0.206     -833.679    180.1254
                    T4 |  -.1367779   3.699745    -0.04   0.971    -7.388144    7.114588
                    T5 |  -94.52455   83.54023    -1.13   0.258    -258.2604    69.21129
                    T6 |  -223.3121   166.9911    -1.34   0.181    -550.6087    103.9844
                    T7 |  -189.6526   102.3811    -1.85   0.064    -390.3159    11.01063
                    T8 |  -1126.258   964.4507    -1.17   0.243    -3016.546    764.0307
          ------------------------------------------------------------------------------
          ATT by Periods Before and After treatment
          Event Study:Dynamic effects
          ------------------------------------------------------------------------------
                       | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
               Pre_avg |   .3881388   3.231397     0.12   0.904    -5.945283     6.72156
              Post_avg |  -326.7768   258.6283    -1.26   0.206     -833.679    180.1254
                   Tm2 |   6.790333   6.370562     1.07   0.286    -5.695739    19.27641
                   Tm1 |  -6.014055   2.807048    -2.14   0.032    -11.51577   -.5123425
                   Tp0 |  -.1367779   3.699745    -0.04   0.971    -7.388144    7.114588
                   Tp1 |  -94.52455   83.54023    -1.13   0.258    -258.2604    69.21129
                   Tp2 |  -223.3121   166.9911    -1.34   0.181    -550.6087    103.9844
                   Tp3 |  -189.6526   102.3811    -1.85   0.064    -390.3159    11.01063
                   Tp4 |  -1126.258   964.4507    -1.17   0.243    -3016.546    764.0307
          ------------------------------------------------------------------------------
          
          .
          Thank you!

          Comment


          • #6
            Well if you have country level data you probably have just a few (5? 10? Observations in the treatment group
            so precisión is a problem
            I still don’t understand your idea of changing gvar
            can you tab year gvar
            and year gvar1?

            Comment


            • #7
              FernandoRios

              Here are the results you wanted to see:

              Code:
               tab year gvar
              
                         |            Group Variable based on treat  
                    year |         0       1990       1991       1992       1993 |     Total
              -----------+-------------------------------------------------------+----------
                    1987 |        24          1          0          0          0 |        25
                    1988 |        24          1          2          0          0 |        27
                    1989 |        24          1          2          1          0 |        28
                    1990 |        24          1          2          1          1 |        29
                    1991 |        24          1          2          1          1 |        29
                    1992 |        24          1          2          1          1 |        30
                    1993 |        24          1          2          1          1 |        30
                    1994 |        24          0          2          1          1 |        31
                    1995 |        24          0          1          1          1 |        31
                    1996 |        24          0          0          0          1 |        32
                    1997 |        24          0          0          0          0 |        33
                    1998 |        24          0          0          0          0 |        37
                    1999 |        24          0          0          0          0 |        38
                    2000 |        24          0          0          0          0 |        38
                    2001 |        24          0          0          0          0 |        36
                    2002 |        24          0          0          0          0 |        39
                    2003 |        24          0          0          0          0 |        38
                    2004 |        24          0          0          0          0 |        37
                    2005 |        24          0          0          0          0 |        33
                    2006 |        24          0          0          0          0 |        34
                    2007 |        24          0          0          0          0 |        35
                    2008 |        24          0          0          0          0 |        36
                    2009 |        24          0          0          0          0 |        33
                    2010 |        24          0          0          0          0 |        34
                    2011 |        24          0          0          0          0 |        34
                    2012 |        24          0          0          0          0 |        36
                    2013 |        24          0          0          0          0 |        34
                    2014 |        24          0          0          0          0 |        34
                    2015 |        24          0          0          0          0 |        34
                    2016 |        24          0          0          0          0 |        34
                    2017 |        24          0          0          0          0 |        33
                    2018 |        24          0          0          0          0 |        32
                    2019 |        24          0          0          0          0 |        30
                    2020 |        24          0          0          0          0 |        29
                    2021 |        24          0          0          0          0 |        28
              -----------+-------------------------------------------------------+----------
                   Total |       840          7         15          7          7 |     1,151
              
              
                         |            Group Variable based on treat  
                    year |      1995       1997       1998       1999       2000 |     Total
              -----------+-------------------------------------------------------+----------
                    1987 |         0          0          0          0          0 |        25
                    1988 |         0          0          0          0          0 |        27
                    1989 |         0          0          0          0          0 |        28
                    1990 |         0          0          0          0          0 |        29
                    1991 |         0          0          0          0          0 |        29
                    1992 |         1          0          0          0          0 |        30
                    1993 |         1          0          0          0          0 |        30
                    1994 |         1          2          0          0          0 |        31
                    1995 |         1          2          1          0          0 |        31
                    1996 |         1          2          1          3          0 |        32
                    1997 |         1          2          1          3          2 |        33
                    1998 |         1          2          1          3          2 |        37
                    1999 |         0          2          1          3          2 |        38
                    2000 |         0          2          1          3          2 |        38
                    2001 |         0          0          1          3          2 |        36
                    2002 |         0          0          0          3          2 |        39
                    2003 |         0          0          0          0          2 |        38
                    2004 |         0          0          0          0          0 |        37
                    2005 |         0          0          0          0          0 |        33
                    2006 |         0          0          0          0          0 |        34
                    2007 |         0          0          0          0          0 |        35
                    2008 |         0          0          0          0          0 |        36
                    2009 |         0          0          0          0          0 |        33
                    2010 |         0          0          0          0          0 |        34
                    2011 |         0          0          0          0          0 |        34
                    2012 |         0          0          0          0          0 |        36
                    2013 |         0          0          0          0          0 |        34
                    2014 |         0          0          0          0          0 |        34
                    2015 |         0          0          0          0          0 |        34
                    2016 |         0          0          0          0          0 |        34
                    2017 |         0          0          0          0          0 |        33
                    2018 |         0          0          0          0          0 |        32
                    2019 |         0          0          0          0          0 |        30
                    2020 |         0          0          0          0          0 |        29
                    2021 |         0          0          0          0          0 |        28
              -----------+-------------------------------------------------------+----------
                   Total |         7         14          7         21         14 |     1,151
              
              
                         |            Group Variable based on treat  
                    year |      2001       2002       2005       2006       2007 |     Total
              -----------+-------------------------------------------------------+----------
                    1987 |         0          0          0          0          0 |        25
                    1988 |         0          0          0          0          0 |        27
                    1989 |         0          0          0          0          0 |        28
                    1990 |         0          0          0          0          0 |        29
                    1991 |         0          0          0          0          0 |        29
                    1992 |         0          0          0          0          0 |        30
                    1993 |         0          0          0          0          0 |        30
                    1994 |         0          0          0          0          0 |        31
                    1995 |         0          0          0          0          0 |        31
                    1996 |         0          0          0          0          0 |        32
                    1997 |         0          0          0          0          0 |        33
                    1998 |         4          0          0          0          0 |        37
                    1999 |         4          2          0          0          0 |        38
                    2000 |         4          2          0          0          0 |        38
                    2001 |         4          2          0          0          0 |        36
                    2002 |         4          2          4          0          0 |        39
                    2003 |         4          2          4          2          0 |        38
                    2004 |         4          2          4          2          1 |        37
                    2005 |         0          2          4          2          1 |        33
                    2006 |         0          0          4          2          1 |        34
                    2007 |         0          0          4          2          1 |        35
                    2008 |         0          0          4          2          1 |        36
                    2009 |         0          0          0          2          1 |        33
                    2010 |         0          0          0          0          1 |        34
                    2011 |         0          0          0          0          0 |        34
                    2012 |         0          0          0          0          0 |        36
                    2013 |         0          0          0          0          0 |        34
                    2014 |         0          0          0          0          0 |        34
                    2015 |         0          0          0          0          0 |        34
                    2016 |         0          0          0          0          0 |        34
                    2017 |         0          0          0          0          0 |        33
                    2018 |         0          0          0          0          0 |        32
                    2019 |         0          0          0          0          0 |        30
                    2020 |         0          0          0          0          0 |        29
                    2021 |         0          0          0          0          0 |        28
              -----------+-------------------------------------------------------+----------
                   Total |        28         14         28         14          7 |     1,151
              
              
                         |            Group Variable based on treat  
                    year |      2009       2010       2011       2012       2013 |     Total
              -----------+-------------------------------------------------------+----------
                    1987 |         0          0          0          0          0 |        25
                    1988 |         0          0          0          0          0 |        27
                    1989 |         0          0          0          0          0 |        28
                    1990 |         0          0          0          0          0 |        29
                    1991 |         0          0          0          0          0 |        29
                    1992 |         0          0          0          0          0 |        30
                    1993 |         0          0          0          0          0 |        30
                    1994 |         0          0          0          0          0 |        31
                    1995 |         0          0          0          0          0 |        31
                    1996 |         0          0          0          0          0 |        32
                    1997 |         0          0          0          0          0 |        33
                    1998 |         0          0          0          0          0 |        37
                    1999 |         0          0          0          0          0 |        38
                    2000 |         0          0          0          0          0 |        38
                    2001 |         0          0          0          0          0 |        36
                    2002 |         0          0          0          0          0 |        39
                    2003 |         0          0          0          0          0 |        38
                    2004 |         0          0          0          0          0 |        37
                    2005 |         0          0          0          0          0 |        33
                    2006 |         3          0          0          0          0 |        34
                    2007 |         3          1          0          0          0 |        35
                    2008 |         3          1          1          0          0 |        36
                    2009 |         3          1          1          1          0 |        33
                    2010 |         3          1          1          1          3 |        34
                    2011 |         3          1          1          1          3 |        34
                    2012 |         3          1          1          1          3 |        36
                    2013 |         0          1          1          1          3 |        34
                    2014 |         0          0          1          1          3 |        34
                    2015 |         0          0          0          1          3 |        34
                    2016 |         0          0          0          0          3 |        34
                    2017 |         0          0          0          0          0 |        33
                    2018 |         0          0          0          0          0 |        32
                    2019 |         0          0          0          0          0 |        30
                    2020 |         0          0          0          0          0 |        29
                    2021 |         0          0          0          0          0 |        28
              -----------+-------------------------------------------------------+----------
                   Total |        21          7          7          7         21 |     1,151
              
              
                         |            Group Variable based on treat  
                    year |      2014       2015       2016       2017       2018 |     Total
              -----------+-------------------------------------------------------+----------
                    1987 |         0          0          0          0          0 |        25
                    1988 |         0          0          0          0          0 |        27
                    1989 |         0          0          0          0          0 |        28
                    1990 |         0          0          0          0          0 |        29
                    1991 |         0          0          0          0          0 |        29
                    1992 |         0          0          0          0          0 |        30
                    1993 |         0          0          0          0          0 |        30
                    1994 |         0          0          0          0          0 |        31
                    1995 |         0          0          0          0          0 |        31
                    1996 |         0          0          0          0          0 |        32
                    1997 |         0          0          0          0          0 |        33
                    1998 |         0          0          0          0          0 |        37
                    1999 |         0          0          0          0          0 |        38
                    2000 |         0          0          0          0          0 |        38
                    2001 |         0          0          0          0          0 |        36
                    2002 |         0          0          0          0          0 |        39
                    2003 |         0          0          0          0          0 |        38
                    2004 |         0          0          0          0          0 |        37
                    2005 |         0          0          0          0          0 |        33
                    2006 |         0          0          0          0          0 |        34
                    2007 |         0          0          0          0          0 |        35
                    2008 |         0          0          0          0          0 |        36
                    2009 |         0          0          0          0          0 |        33
                    2010 |         0          0          0          0          0 |        34
                    2011 |         1          0          0          0          0 |        34
                    2012 |         1          2          0          0          0 |        36
                    2013 |         1          2          1          0          0 |        34
                    2014 |         1          2          1          1          0 |        34
                    2015 |         1          2          1          1          1 |        34
                    2016 |         1          2          1          1          1 |        34
                    2017 |         1          2          1          1          1 |        33
                    2018 |         0          2          1          1          1 |        32
                    2019 |         0          0          1          1          1 |        30
                    2020 |         0          0          0          1          1 |        29
                    2021 |         0          0          0          0          1 |        28
              -----------+-------------------------------------------------------+----------
                   Total |         7         14          7          7          7 |     1,151
              
              
                         | Group Variable based
                         |      on treat  
                    year |      2019       2020 |     Total
              -----------+----------------------+----------
                    1987 |         0          0 |        25
                    1988 |         0          0 |        27
                    1989 |         0          0 |        28
                    1990 |         0          0 |        29
                    1991 |         0          0 |        29
                    1992 |         0          0 |        30
                    1993 |         0          0 |        30
                    1994 |         0          0 |        31
                    1995 |         0          0 |        31
                    1996 |         0          0 |        32
                    1997 |         0          0 |        33
                    1998 |         0          0 |        37
                    1999 |         0          0 |        38
                    2000 |         0          0 |        38
                    2001 |         0          0 |        36
                    2002 |         0          0 |        39
                    2003 |         0          0 |        38
                    2004 |         0          0 |        37
                    2005 |         0          0 |        33
                    2006 |         0          0 |        34
                    2007 |         0          0 |        35
                    2008 |         0          0 |        36
                    2009 |         0          0 |        33
                    2010 |         0          0 |        34
                    2011 |         0          0 |        34
                    2012 |         0          0 |        36
                    2013 |         0          0 |        34
                    2014 |         0          0 |        34
                    2015 |         0          0 |        34
                    2016 |         1          0 |        34
                    2017 |         1          2 |        33
                    2018 |         1          2 |        32
                    2019 |         1          2 |        30
                    2020 |         1          2 |        29
                    2021 |         1          2 |        28
              -----------+----------------------+----------
                   Total |         6         10 |     1,151
              Code:
               tab year gvar1
              
                         |         gvar1
                    year |         0          4 |     Total
              -----------+----------------------+----------
                    1987 |        24          1 |        25
                    1988 |        24          3 |        27
                    1989 |        24          4 |        28
                    1990 |        24          5 |        29
                    1991 |        24          5 |        29
                    1992 |        24          6 |        30
                    1993 |        24          6 |        30
                    1994 |        24          7 |        31
                    1995 |        24          7 |        31
                    1996 |        24          8 |        32
                    1997 |        24          9 |        33
                    1998 |        24         13 |        37
                    1999 |        24         14 |        38
                    2000 |        24         14 |        38
                    2001 |        24         12 |        36
                    2002 |        24         15 |        39
                    2003 |        24         14 |        38
                    2004 |        24         13 |        37
                    2005 |        24          9 |        33
                    2006 |        24         10 |        34
                    2007 |        24         11 |        35
                    2008 |        24         12 |        36
                    2009 |        24          9 |        33
                    2010 |        24         10 |        34
                    2011 |        24         10 |        34
                    2012 |        24         12 |        36
                    2013 |        24         10 |        34
                    2014 |        24         10 |        34
                    2015 |        24         10 |        34
                    2016 |        24         10 |        34
                    2017 |        24          9 |        33
                    2018 |        24          8 |        32
                    2019 |        24          6 |        30
                    2020 |        24          5 |        29
                    2021 |        24          4 |        28
              -----------+----------------------+----------
                   Total |       840        311 |     1,151
              
              .
              Thank you!
              Last edited by Sharma Swati; 31 Jan 2023, 09:02.

              Comment


              • #8
                FernandoRios I also went ahead and ran another estimation with same number of years 1970-2021 for both treatment and control and this was the result I got:

                Code:
                cap egen country_code=group(country)
                egen gvar = csgvar(treat), tvar(year) ivar(country_code)
                csdid hcpi_a, ivar(country_code) time(year) gvar(gvar)
                estat all
                
                Pretrend Test. H0 All Pre-treatment are equal to 0
                chi2(827) =   541.7032
                p-value  =     1.0000
                Average Treatment Effect on Treated
                ------------------------------------------------------------------------------
                             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                         ATT |    62.9059   65.35104     0.96   0.336    -65.17978    190.9916
                ------------------------------------------------------------------------------
                ATT by group
                ------------------------------------------------------------------------------
                             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                    GAverage |   41.09904   32.67828     1.26   0.209     -22.9492    105.1473
                       G1990 |  -61.03784   43.04066    -1.42   0.156     -145.396    23.32031
                       G1991 |  -72.55083   45.76367    -1.59   0.113     -162.246    17.14431
                       G1992 |   29.27408   45.72005     0.64   0.522    -60.33556    118.8837
                       G1993 |   169.5871   130.6458     1.30   0.194    -86.47392    425.6481
                       G1995 |   1114.613   964.0204     1.16   0.248    -774.8323    3004.058
                       G1997 |   188.4318   166.9256     1.13   0.259    -138.7363    515.5999
                       G1998 |   9.036424   9.040214     1.00   0.318     -8.68207    26.75492
                       G1999 |  -5.904457   6.299251    -0.94   0.349    -18.25076    6.441849
                       G2000 |     28.045   16.37739     1.71   0.087    -4.054095     60.1441
                       G2001 |   32.77095   24.62034     1.33   0.183    -15.48402    81.02592
                       G2002 |   13.85375    15.7584     0.88   0.379    -17.03215    44.73965
                       G2005 |  -.1448775    3.04216    -0.05   0.962    -6.107401    5.817646
                       G2006 |  -.4506775   4.194899    -0.11   0.914    -8.672528    7.771173
                       G2007 |  -1.909167    2.00383    -0.95   0.341    -5.836601    2.018267
                       G2011 |  -7.359811   3.412909    -2.16   0.031    -14.04899   -.6706325
                       G2012 |  -13.84854   4.190469    -3.30   0.001    -22.06171   -5.635373
                       G2013 |  -3.394213   4.886921    -0.69   0.487     -12.9724    6.183975
                       G2014 |  -7.565938   4.718611    -1.60   0.109    -16.81425    1.682371
                       G2015 |  -10.44298   5.421553    -1.93   0.054    -21.06903    .1830726
                       G2016 |  -47.63882   6.478195    -7.35   0.000    -60.33585   -34.94179
                       G2017 |  -5.122583   7.772451    -0.66   0.510    -20.35631    10.11114
                       G2018 |  -7.650521   9.524497    -0.80   0.422    -26.31819    11.01715
                       G2019 |  -11.47292   12.03943    -0.95   0.341    -35.06977    12.12393
                       G2020 |  -4.415001   3.624434    -1.22   0.223    -11.51876     2.68876
                ------------------------------------------------------------------------------
                ATT by Calendar Period
                ------------------------------------------------------------------------------
                             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                    CAverage |   25.97741   54.53331     0.48   0.634    -80.90591    132.8607
                       T1990 |      1.715   3.597128     0.48   0.634    -5.335241    8.765241
                       T1991 |    -95.905   84.09624    -1.14   0.254    -260.7306    68.92061
                       T1992 |  -203.6742   148.4918    -1.37   0.170    -494.7127     87.3644
                       T1993 |  -128.8366   79.97284    -1.61   0.107    -285.5805     27.9073
                       T1994 |  -1066.917   916.0087    -1.16   0.244    -2862.262    728.4267
                       T1995 |   73.35208   270.2832     0.27   0.786    -456.3932    603.0974
                       T1996 |   43.51292    297.779     0.15   0.884    -540.1233    627.1491
                       T1997 |   217.1151   199.3116     1.09   0.276    -173.5284    607.7586
                       T1998 |   203.4359   184.5882     1.10   0.270    -158.3502    565.2221
                       T1999 |   124.6636   132.3954     0.94   0.346    -134.8267    384.1539
                       T2000 |   100.6788   105.9849     0.95   0.342    -107.0478    308.4054
                       T2001 |   99.83852   89.69424     1.11   0.266    -75.95897     275.636
                       T2002 |   100.8789   91.49064     1.10   0.270    -78.43945    280.1973
                       T2003 |   101.2228   91.97372     1.10   0.271    -79.04235     281.488
                       T2004 |   100.7355   92.98356     1.08   0.279    -81.50892    282.9799
                       T2005 |   89.45083   77.19858     1.16   0.247     -61.8556    240.7573
                       T2006 |   85.08211   74.67067     1.14   0.255     -61.2697    231.4339
                       T2007 |   84.91783   71.67423     1.18   0.236    -55.56108    225.3968
                       T2008 |   74.14469   72.39845     1.02   0.306    -67.75365     216.043
                       T2009 |   82.96053   70.65014     1.17   0.240    -55.51121    221.4323
                       T2010 |   83.60328   71.39216     1.17   0.242    -56.32279    223.5294
                       T2011 |   76.45048    69.1813     1.11   0.269    -59.14238    212.0433
                       T2012 |   74.85397   67.12038     1.12   0.265    -56.69956    206.4075
                       T2013 |   70.98715   60.72698     1.17   0.242    -48.03554    190.0098
                       T2014 |   69.66828   58.82309     1.18   0.236    -45.62286    184.9594
                       T2015 |   65.70079   57.16977     1.15   0.250     -46.3499    177.7515
                       T2016 |   60.03322    54.9273     1.09   0.274    -47.62231    167.6888
                       T2017 |   57.19268   52.93666     1.08   0.280    -46.56127    160.9466
                       T2018 |   57.55121    51.7382     1.11   0.266     -43.8538    158.9562
                       T2019 |   47.10187   52.59455     0.90   0.370    -55.98156    150.1853
                       T2020 |   30.07287    55.3401     0.54   0.587    -78.39172    138.5375
                       T2021 |   49.68945   49.96679     0.99   0.320    -48.24367    147.6226
                ------------------------------------------------------------------------------
                ATT by Periods Before and After treatment
                Event Study:Dynamic effects
                ------------------------------------------------------------------------------
                             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                     Pre_avg |  -2.011448   1.338421    -1.50   0.133    -4.634705    .6118082
                    Post_avg |   80.95919   79.72332     1.02   0.310    -75.29564     237.214
                        Tm49 |  -2.130833   .9170647    -2.32   0.020    -3.928247   -.3334195
                        Tm48 |   .9070832   1.333403     0.68   0.496    -1.706339    3.520505
                        Tm47 |   .4211112    1.68956     0.25   0.803    -2.890366    3.732589
                        Tm46 |  -6.710104     2.4648    -2.72   0.006    -11.54102   -1.879184
                        Tm45 |  -.5246666   1.754476    -0.30   0.765    -3.963377    2.914044
                        Tm44 |   2.506528   3.688743     0.68   0.497    -4.723275    9.736331
                        Tm43 |  -2.870595   1.907337    -1.51   0.132    -6.608908    .8677176
                        Tm42 |  -.6038333   2.171301    -0.28   0.781    -4.859505    3.651839
                        Tm41 |  -.3540154   1.946547    -0.18   0.856    -4.169177    3.461147
                        Tm40 |  -2.505278   3.201093    -0.78   0.434    -8.779305     3.76875
                        Tm39 |   3.758194   2.686343     1.40   0.162    -1.506941     9.02333
                        Tm38 |   1.587257   4.298801     0.37   0.712    -6.838238    10.01275
                        Tm37 |  -6.143055    4.45213    -1.38   0.168    -14.86907    2.582959
                        Tm36 |   5.120448    6.90574     0.74   0.458    -8.414553    18.65545
                        Tm35 |  -38.89726   45.89738    -0.85   0.397    -128.8545    51.05995
                        Tm34 |  -2.304305   35.99187    -0.06   0.949    -72.84707    68.23846
                        Tm33 |   4.360532   35.65364     0.12   0.903    -65.51931    74.24038
                        Tm32 |   3.227963   35.54617     0.09   0.928    -66.44126    72.89718
                        Tm31 |  -.2792288   31.66627    -0.01   0.993    -62.34397    61.78552
                        Tm30 |  -.3560765   26.97297    -0.01   0.989    -53.22212    52.50997
                        Tm29 |  -8.162532   25.62939    -0.32   0.750    -58.39522    42.07015
                        Tm28 |  -40.22509   42.51757    -0.95   0.344     -123.558    43.10781
                        Tm27 |   27.81881   43.57747     0.64   0.523    -57.59147    113.2291
                        Tm26 |  -27.33851   47.32297    -0.58   0.563    -120.0898    65.41281
                        Tm25 |   6.614049   47.00337     0.14   0.888    -85.51086    98.73896
                        Tm24 |  -4.720012    41.2967    -0.11   0.909    -85.66006    76.22004
                        Tm23 |   140.5501   146.1046     0.96   0.336    -145.8096    426.9098
                        Tm22 |  -91.71714   148.4759    -0.62   0.537    -382.7245    199.2903
                        Tm21 |  -45.62209   41.10098    -1.11   0.267    -126.1785    34.93435
                        Tm20 |  -54.40152   64.67518    -0.84   0.400    -181.1625     72.3595
                        Tm19 |   1.319333   87.11912     0.02   0.988     -169.431    172.0697
                        Tm18 |   59.13375   74.00754     0.80   0.424    -85.91836    204.1859
                        Tm17 |  -18.21914    48.0655    -0.38   0.705    -112.4258     75.9875
                        Tm16 |    4.20649   52.40962     0.08   0.936    -98.51447    106.9275
                        Tm15 |   28.28388   38.97038     0.73   0.468    -48.09667    104.6644
                        Tm14 |  -7.843564   33.66968    -0.23   0.816    -73.83492    58.14779
                        Tm13 |   64.01538    90.5722     0.71   0.480    -113.5029    241.5336
                        Tm12 |   99.40555   111.8777     0.89   0.374    -119.8707    318.6818
                        Tm11 |  -234.3602   205.3693    -1.14   0.254    -636.8767    168.1563
                        Tm10 |   98.98806   105.1269     0.94   0.346    -107.0568    305.0329
                         Tm9 |   34.05945   44.99406     0.76   0.449    -54.12728    122.2462
                         Tm8 |  -129.6993   92.62671    -1.40   0.161    -311.2443    51.84574
                         Tm7 |  -48.67272   79.53105    -0.61   0.541    -204.5507    107.2053
                         Tm6 |   56.02313   89.45392     0.63   0.531    -119.3033    231.3496
                         Tm5 |  -7.664837   64.45431    -0.12   0.905     -133.993    118.6633
                         Tm4 |   31.22552   78.65729     0.40   0.691    -122.9399     185.391
                         Tm3 |  -22.15034   49.08369    -0.45   0.652    -118.3526    74.05192
                         Tm2 |   59.36011   61.28007     0.97   0.333    -60.74662    179.4668
                         Tm1 |  -26.97747   37.83961    -0.71   0.476    -101.1417    47.18681
                         Tp0 |   27.05846   34.56058     0.78   0.434    -40.67902    94.79595
                         Tp1 |  -5.883016   36.65741    -0.16   0.872    -77.73021    65.96418
                         Tp2 |  -1.943683   43.13043    -0.05   0.964    -86.47778    82.59041
                         Tp3 |  -27.36722   58.33096    -0.47   0.639    -141.6938    86.95936
                         Tp4 |   6.268892   47.72799     0.13   0.896    -87.27625    99.81404
                         Tp5 |   39.98546   52.20576     0.77   0.444    -62.33595    142.3069
                         Tp6 |   52.42726   54.50252     0.96   0.336    -54.39572    159.2502
                         Tp7 |    58.8359   57.44224     1.02   0.306    -53.74882    171.4206
                         Tp8 |   63.36763   58.63225     1.08   0.280    -51.54946    178.2847
                         Tp9 |   69.39687   64.67634     1.07   0.283    -57.36642    196.1602
                        Tp10 |   75.23026   67.50617     1.11   0.265    -57.07941    207.5399
                        Tp11 |    79.6586    71.0814     1.12   0.262    -59.65837    218.9756
                        Tp12 |   81.27575   71.64461     1.13   0.257    -59.14511    221.6966
                        Tp13 |    80.6041   71.75564     1.12   0.261    -60.03438    221.2426
                        Tp14 |   79.74509   72.07657     1.11   0.269    -61.52238    221.0126
                        Tp15 |   81.25273   75.01978     1.08   0.279    -65.78333    228.2888
                        Tp16 |   87.78573    77.4691     1.13   0.257    -64.05093    239.6224
                        Tp17 |   104.8085   92.58647     1.13   0.258    -76.65768    286.2746
                        Tp18 |   100.9381   93.09789     1.08   0.278    -81.53044    283.4066
                        Tp19 |   99.41531    93.3117     1.07   0.287    -83.47225    282.3029
                        Tp20 |   110.3511   102.0234     1.08   0.279    -89.61108    310.3132
                        Tp21 |   132.1253   125.0951     1.06   0.291    -113.0566    377.3073
                        Tp22 |   152.3616   142.9237     1.07   0.286    -127.7638    432.4869
                        Tp23 |    203.902   186.5174     1.09   0.274    -161.6653    569.4694
                        Tp24 |   231.1841   206.3152     1.12   0.262    -173.1863    635.5544
                        Tp25 |   241.3163   261.5724     0.92   0.356    -271.3562    753.9889
                        Tp26 |   242.3092   263.3582     0.92   0.358    -273.8635    758.4818
                        Tp27 |   60.70008   64.77644     0.94   0.349     -66.2594    187.6596
                        Tp28 |   58.23658   67.89376     0.86   0.391    -74.83274    191.3059
                        Tp29 |   10.36458   38.54395     0.27   0.788    -65.18017    85.90933
                        Tp30 |  -9.508751   13.13676    -0.72   0.469    -35.25633    16.23883
                        Tp31 |    4.49125   7.531753     0.60   0.551    -10.27071    19.25321
                ------------------------------------------------------------------------------
                
                .
                Thank you very much for your help!

                Comment


                • #9
                  Ok. thank you
                  so couple of comments.
                  1. So you have macro data, and as suspected, you have only few observations per cohort (1 or 2?) . So precision IS a problem. There is nothing you can do about that
                  2. I find it very odd that you see treated units only for few periods. Anything that explains that? So say country 132 Bolivia, is treated in 2015 and you have data from 2012 to 2018. What happens after that?
                  3. This creates another weird problem. You should only be able to see about 3 or 4 pre and post periods. Not sure why you have so many more.

                  Can you share some of the data with me? i want try and see what may be happening
                  Thank you
                  F

                  Comment


                  • #10
                    FernandoRios Hello

                    1. I have data for headline CPI from 1970-2021, but I just took 3 years pre and post to see how the command works. I can send you my whole data but not sure how to do that. Can you guide me through the procedure?
                    2. I actually did not anticipate that I just had to put all the years for the treated countries as 1. What I was doing was putting all years pre-treatment year as 0 and the treatment year onwards as 1. I guess I now realize my mistake.

                    Please do let me know how I can share my data with you. I am desperately looking for a solution.

                    Thank you so much.

                    Swati

                    Comment


                    • #11
                      See my email on the helpfile from csdid. you can use that email to share the data with me along with your code to replicate what you just did.
                      Thank you

                      Comment


                      • #12
                        FernandoRios okay, I will send it by end of the day today. I will be using this email: [email protected]

                        Also, does it matter if I have an unbalanced panel? In the sense that there are more years for control group than treatment group?

                        Thank you so much.

                        Comment

                        Working...
                        X