Announcement

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

  • Problem with csdid command

    I have the following dataset:

    Code:
    id_municipio    ano    uf    munic    imposto_renda    taxpayers    ano_3g    ano_4g    treatment_3g
    1200013    2013    AC    Acrelândia    430014    128    2011    2018    2011
    1200054    2013    AC    Assis Brasil    205203    97    2015    2021    0
    1200104    2013    AC    Brasiléia    1708153    361    2015    2017    0
    1200138    2013    AC    Bujari    243841    89    2010    2017    2010
    1200179    2013    AC    Capixaba    236769    102    2015    2019    0
    1200203    2013    AC    Cruzeiro do Sul    8797109    1031    2008    2016    2008
    1200252    2013    AC    Epitaciolândia    2199140    252    2013    2017    2013
    1200302    2013    AC    Feijó    447522    282    2015    2017    0
    1200328    2013    AC    Jordão    36289    35    2016    2020    0
    1200336    2013    AC    Mâncio Lima    597157    91    2011    2017    2011
    1200344    2013    AC    Manoel Urbano    105124    66    2016    2021    0
    1200351    2013    AC    Marechal Thaumaturgo    47086    20    2016    2020    0
    1200385    2013    AC    Plácido de Castro    262876    146    2015    2019    0
    1200807    2013    AC    Porto Acre    145717    87    2014    2018    0
    1200393    2013    AC    Porto Walter    23606    15    2016    2021    0
    1200401    2013    AC    Rio Branco    1.594e+08    10252    2008    2014    2008
    1200427    2013    AC    Rodrigues Alves    54578    63    2015    2018    0
    1200435    2013    AC    Santa Rosa do Purus    51197    34    2016    2020    0
    1200500    2013    AC    Sena Madureira    1006259    347    2015    2017    0
    1200450    2013    AC    Senador Guiomard    1706722    327    2011    2017    2011
    I am trying to obtain a did estimator a la Callaway and Sant'anna running the following command:

    Code:
    clear
    
    import delimited "C:\Users\mateu\OneDrive\Documentos\base_tax.csv"
    
    keep if ano >= 2004 & ano <= 2013
    
    generate treatment_3g = 0
    replace treatment_3g = ano_3g if ano >= ano_3g
    
    xtset id_municipio ano
    
    csdid imposto_renda , ivar(id_municipio) time(ano) gvar(treatment_3g) method(dripw)
    However, I obtain the following result:

    Code:
     csdid imposto_renda , ivar(id_municipio) time(ano) gvar(treatment_3g) method(dripw)
    Panel is not balanced
    Will use observations with Pair balanced (observed at t0 and t1)
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxx
    Difference-in-difference with Multiple Time Periods
    
                                                                 Number of obs = 0
    Outcome model  : least squares
    Treatment model: inverse probability
    ------------------------------------------------------------------------------
                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    g2008        |
     t_2004_2005 |          0  (omitted)
     t_2005_2006 |          0  (omitted)
     t_2006_2007 |          0  (omitted)
     t_2007_2008 |          0  (omitted)
     t_2007_2009 |          0  (omitted)
     t_2007_2010 |          0  (omitted)
     t_2007_2011 |          0  (omitted)
     t_2007_2012 |          0  (omitted)
     t_2007_2013 |          0  (omitted)
    -------------+----------------------------------------------------------------
    g2009        |
     t_2004_2005 |          0  (omitted)
     t_2005_2006 |          0  (omitted)
     t_2006_2007 |          0  (omitted)
     t_2007_2008 |          0  (omitted)
     t_2008_2009 |          0  (omitted)
     t_2008_2010 |          0  (omitted)
     t_2008_2011 |          0  (omitted)
     t_2008_2012 |          0  (omitted)
     t_2008_2013 |          0  (omitted)
    -------------+----------------------------------------------------------------
    g2010        |
     t_2004_2005 |          0  (omitted)
     t_2005_2006 |          0  (omitted)
     t_2006_2007 |          0  (omitted)
     t_2007_2008 |          0  (omitted)
     t_2008_2009 |          0  (omitted)
     t_2009_2010 |          0  (omitted)
     t_2009_2011 |          0  (omitted)
     t_2009_2012 |          0  (omitted)
     t_2009_2013 |          0  (omitted)
    -------------+----------------------------------------------------------------
    g2011        |
     t_2004_2005 |          0  (omitted)
     t_2005_2006 |          0  (omitted)
     t_2006_2007 |          0  (omitted)
     t_2007_2008 |          0  (omitted)
     t_2008_2009 |          0  (omitted)
     t_2009_2010 |          0  (omitted)
     t_2010_2011 |          0  (omitted)
     t_2010_2012 |          0  (omitted)
     t_2010_2013 |          0  (omitted)
    -------------+----------------------------------------------------------------
    g2012        |
     t_2004_2005 |          0  (omitted)
     t_2005_2006 |          0  (omitted)
     t_2006_2007 |          0  (omitted)
     t_2007_2008 |          0  (omitted)
     t_2008_2009 |          0  (omitted)
     t_2009_2010 |          0  (omitted)
     t_2010_2011 |          0  (omitted)
     t_2011_2012 |          0  (omitted)
     t_2011_2013 |          0  (omitted)
    -------------+----------------------------------------------------------------
    g2013        |
     t_2004_2005 |          0  (omitted)
     t_2005_2006 |          0  (omitted)
     t_2006_2007 |          0  (omitted)
     t_2007_2008 |          0  (omitted)
     t_2008_2009 |          0  (omitted)
     t_2009_2010 |          0  (omitted)
     t_2010_2011 |          0  (omitted)
     t_2011_2012 |          0  (omitted)
     t_2012_2013 |          0  (omitted)
    ------------------------------------------------------------------------------
    Control: Never Treated
    
    See Callaway and Sant'Anna (2021) for details
    
    . 
    end of do-file
    I would appreciate if FernandoRios could help me.




  • #2
    First things first
    Show a cross tab between year and gvar

    Comment


    • #3
      Thanks for helping, Fernando. Here is the tab:

      Code:
       tab ano treatment_3g
      Code:
                 |                           treatment_3g
             ano |         0       2008       2009       2010       2011       2012 |     Total
      -----------+------------------------------------------------------------------+----------
            2004 |     4,770          0          0          0          0          0 |     4,770 
            2005 |     4,906          0          0          0          0          0 |     4,906 
            2006 |     4,960          0          0          0          0          0 |     4,960 
            2007 |     5,085          0          0          0          0          0 |     5,085 
            2008 |     4,750        440          0          0          0          0 |     5,190 
            2009 |     4,523        440        262          0          0          0 |     5,225 
            2010 |     4,060        440        262        566          0          0 |     5,328 
            2011 |     2,768        440        262        566      1,322          0 |     5,358 
            2012 |     2,169        440        262        566      1,327        643 |     5,407 
            2013 |     1,893        440        262        566      1,326        642 |     5,410 
      -----------+------------------------------------------------------------------+----------
           Total |    39,884      2,640      1,310      2,264      3,975      1,285 |    51,639

      Comment


      • #4
        That’s the problem
        you don’t see your treated cohorts before they are treated
        min other words your construction of gvar is incorrect

        Comment


        • #5
          Dear Fernando, I think I understand your point. Nevertheless, would you mind giving me a hint regarding the "gvar" construction?

          I do have information about the year when wich one of my units were treated. To build the "gvar", I used the following command:

          Code:
           
           generate treatment_3g = 0 replace treatment_3g = ano_3g if ano >= ano_3g
          Meaning that the unit received 1 if the year in the panel is equal to or bigger than the year when the unit was treated, and 0 otherwise.

          Comment


          • #6
            Never mind, Fernando. I found a way to solve it.

            Thank you so much for helping me.

            Comment


            • #7
              Glad you saw how to fix it

              Comment

              Working...
              X