Announcement

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

  • csdid output varying with the addition of a single variable

    Hi. I am trying to use the csdid command and am struggling to understand the workings of it. My results appear to vary wildly on adding an additional control variable that doesn't have any missing values. My time variable has 48 periods (number of weeks) and my gvar ranges from 3-9.

    In model 1 below, I get very few failed 2x2 estimations. However, when I add just one more variable in model 2 - rate_hospital_beds_total1k which has no missing observations - the number of failed 2x2 estimations increase significantly with all of g9 omitted. I would greatly appreciate understanding:

    1. why the addition of a single variable with no missing values would cause so much fluctuation? My gvar=9 group has 46 treated observations. However, gvar=7 group has 47 treated observations and appears to run fine for that group. I do see that the number of observations has changed with the new variable being added, but fail to understand why it is so.
    2. In the output below, for t_2_46, t_2_47 I understand that the 46 and corresponds to the week number/time variable. However, I am failing to understand what the preceding 2 corresponds to.

    FernandoRios I'm adding you on here given your expertise on this.

    Code:
    Model 1:
    
     csdid rate_con_avg7day pop_perkm2_2019 povertyperct deathrate_2019 infantmortrate_2019 birthr
    > ate_2019 naturalgrwthrate_2019  rate_hospital_total1k, ivar(statenum) time(weeknum) gvar(gvar
    > )
    Panel is not balanced
    Will use observations with Pair balanced (observed at t0 and t1)
    ...............................................x..
    ..................................................
    .........................................x........
    ......................................xxxxx.......
    ...................................xx.............
    ................................
    Difference-in-difference with Multiple Time Periods
    
                                                    Number of obs     =      1,539
    Outcome model  : least squares
    Treatment model: inverse probability
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    g3           |
           t_1_2 |   6.33e-08   1.44e-07     0.44   0.660    -2.19e-07    3.46e-07
           t_2_3 |   6.18e-06   4.04e-06     1.53   0.127    -1.75e-06    .0000141
           t_2_4 |   .0000146   .0000108     1.34   0.179    -6.66e-06    .0000358
    ..................................    
          t_2_46 |   .0033591   .0128041     0.26   0.793    -.0217365    .0284547
          t_2_47 |   .0032703   .0130755     0.25   0.803    -.0223572    .0288979
          t_2_48 |   .0009822   .0038111     0.26   0.797    -.0064875    .0084518
    -------------+----------------------------------------------------------------
    g4           |
           t_1_2 |          0  (omitted)
           t_2_3 |   6.61e-06   2.72e-06     2.43   0.015     1.27e-06    .0000119
           t_3_4 |  -3.00e-06   8.29e-06    -0.36   0.718    -.0000193    .0000133
           t_3_5 |  -2.14e-06   9.60e-06    -0.22   0.823     -.000021    .0000167
           t_3_6 |   2.69e-08   .0000124     0.00   0.998    -.0000243    .0000244
       ..................................    
          t_3_48 |  -.0010156   .0014222    -0.71   0.475     -.003803    .0017718
    -------------+----------------------------------------------------------------
    g5           |
           t_1_2 |   1.62e-08   9.78e-07     0.02   0.987    -1.90e-06    1.93e-06
           t_2_3 |  -8.39e-07   4.56e-06    -0.18   0.854    -9.78e-06    8.10e-06
           t_3_4 |   2.16e-06   .0000205     0.11   0.916    -.0000381    .0000424
           t_4_5 |   5.01e-06   6.49e-06     0.77   0.440    -7.72e-06    .0000177
           t_4_6 |   .0000153   .0000151     1.01   0.311    -.0000143     .000045
         ..................................    
          t_4_46 |    .011131   .0118398     0.94   0.347    -.0120746    .0343366
          t_4_47 |   .0110686   .0111938     0.99   0.323    -.0108709    .0330081
          t_4_48 |   .0031596   .0031183     1.01   0.311    -.0029522    .0092714
    -------------+----------------------------------------------------------------
    g7           |
           t_1_2 |          0  (omitted)
           t_2_3 |   2.15e-07   7.30e-07     0.29   0.769    -1.22e-06    1.65e-06
           t_3_4 |   8.76e-06   8.37e-06     1.05   0.295    -7.64e-06    .0000252
           t_4_5 |   1.43e-06   2.52e-06     0.57   0.571    -3.51e-06    6.37e-06
           t_5_6 |   7.47e-07   1.99e-06     0.38   0.707    -3.15e-06    4.64e-06
           t_6_7 |  -2.21e-06   2.39e-06    -0.92   0.356    -6.90e-06    2.48e-06
           ..................................    
          t_6_47 |  -.0050742   .0030715    -1.65   0.099    -.0110943    .0009459
          t_6_48 |  -.0015361   .0008884    -1.73   0.084    -.0032774    .0002052
    -------------+----------------------------------------------------------------
    g8           |
           t_1_2 |          0  (omitted)
           t_2_3 |          0  (omitted)
           t_3_4 |          0  (omitted)
           t_4_5 |          0  (omitted)
           t_5_6 |          0  (omitted)
           t_6_7 |   4.55e-06   3.46e-06     1.32   0.188    -2.23e-06    .0000113
           t_7_8 |   6.05e-06   5.52e-06     1.10   0.273    -4.76e-06    .0000169
           t_7_9 |   7.19e-07   7.95e-06     0.09   0.928    -.0000149    .0000163
          t_7_10 |  -8.68e-06   .0000171    -0.51   0.612    -.0000422    .0000249
          t_7_11 |  -3.15e-07   .0000265    -0.01   0.991    -.0000523    .0000517
         ..................................    
          t_7_47 |   .0009435   .0025036     0.38   0.706    -.0039635    .0058505
          t_7_48 |   .0002654   .0007203     0.37   0.712    -.0011463    .0016772
    -------------+----------------------------------------------------------------
    g9           |
           t_1_2 |          0  (omitted)
           t_2_3 |          0  (omitted)
           t_3_4 |   1.02e-07   3.67e-06     0.03   0.978    -7.09e-06    7.30e-06
           t_4_5 |   7.45e-07   1.17e-06     0.63   0.526    -1.56e-06    3.05e-06
           t_5_6 |   1.72e-06   8.83e-07     1.95   0.051    -7.42e-09    3.45e-06
           t_6_7 |   3.74e-06   1.71e-06     2.19   0.029     3.90e-07    7.10e-06
           t_7_8 |   8.07e-06   2.39e-06     3.37   0.001     3.37e-06    .0000128
           t_8_9 |   4.16e-06   3.03e-06     1.37   0.170    -1.78e-06    .0000101
          t_8_10 |   .0000124   6.79e-06     1.83   0.067    -8.61e-07    .0000258
          t_8_11 |   .0000224   .0000106     2.13   0.034     1.75e-06    .0000431
          t_8_12 |    .000037   .0000142     2.61   0.009     9.23e-06    .0000649
        ..................................    
          t_8_47 |   .0039992   .0010031     3.99   0.000     .0020332    .0059652
          t_8_48 |   .0011212   .0002918     3.84   0.000     .0005493    .0016931
    ------------------------------------------------------------------------------
    
    
    
    Model 2: 
    
     csdid rate_con_avg7day pop_perkm2_2019 povertyperct deathrate_2019 infantmortrate_2019 birthr
    > ate_2019 naturalgrwthrate_2019  rate_hospital_total1k rate_hospital_beds_total1k, ivar(staten
    > um) time(weeknum) gvar(gvar)
    Panel is not balanced
    Will use observations with Pair balanced (observed at t0 and t1)
    ...............................................x..
    ..................................................
    .........................................x........
    ......................................xxxxx.......
    ...................................xxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Difference-in-difference with Multiple Time Periods
    
                                                    Number of obs     =      1,493
    Outcome model  : least squares
    Treatment model: inverse probability
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    g3           |
           t_1_2 |  -6.62e-07   5.50e-20 -1.2e+13   0.000    -6.62e-07   -6.62e-07
           t_2_3 |  -1.97e-06   2.67e-06    -0.74   0.460    -7.21e-06    3.26e-06
           t_2_4 |  -6.96e-06   8.59e-06    -0.81   0.418    -.0000238    9.87e-06
             ..................................    
          t_2_48 |  -.0026097   .0037858    -0.69   0.491    -.0100298    .0048104
    -------------+----------------------------------------------------------------
    g4           |
           t_1_2 |          0  (omitted)
           t_2_3 |   5.47e-06   2.27e-06     2.41   0.016     1.02e-06    9.91e-06
           t_3_4 |  -2.66e-06   8.64e-06    -0.31   0.758    -.0000196    .0000143
           t_3_5 |  -1.78e-06   8.34e-06    -0.21   0.831    -.0000181    .0000146
           ..................................    
          t_3_48 |    -.00091   .0015944    -0.57   0.568     -.004035     .002215
    -------------+----------------------------------------------------------------
    g5           |
           t_1_2 |   3.81e-06   2.60e-06     1.46   0.143    -1.29e-06    8.90e-06
           t_2_3 |  -2.80e-12   3.70e-07    -0.00   1.000    -7.25e-07    7.25e-07
           t_3_4 |   6.47e-06    .000034     0.19   0.849    -.0000603    .0000732
           t_4_5 |   7.55e-06   7.60e-06     0.99   0.321    -7.36e-06    .0000224
           t_4_6 |   .0000215    .000018     1.20   0.232    -.0000138    .0000569
             ..................................    
          t_4_48 |   .0028758   .0058455     0.49   0.623    -.0085811    .0143326
    -------------+----------------------------------------------------------------
    g7           |
           t_1_2 |          0  (omitted)
           t_2_3 |  -2.21e-08   8.03e-07    -0.03   0.978    -1.60e-06    1.55e-06
           t_3_4 |   .0000107   8.11e-06     1.32   0.186    -5.18e-06    .0000266
           t_4_5 |   1.68e-06   2.57e-06     0.65   0.515    -3.36e-06    6.71e-06
           t_5_6 |  -1.74e-06   2.38e-06    -0.73   0.464    -6.41e-06    2.92e-06
           t_6_7 |  -6.96e-06   4.41e-06    -1.58   0.114    -.0000156    1.67e-06
           t_6_8 |  -.0000214   .0000104    -2.05   0.040    -.0000418   -9.58e-07
              ..................................    
          t_6_48 |  -.0025231    .001737    -1.45   0.146    -.0059275    .0008812
    -------------+----------------------------------------------------------------
    g8           |
           t_1_2 |          0  (omitted)
           t_2_3 |          0  (omitted)
           t_3_4 |          0  (omitted)
           t_4_5 |          0  (omitted)
           t_5_6 |          0  (omitted)
           t_6_7 |   2.34e-06   3.73e-06     0.63   0.530    -4.97e-06    9.66e-06
           t_7_8 |   6.16e-06   6.59e-06     0.93   0.350    -6.76e-06    .0000191
           t_7_9 |   -.000014   9.88e-06    -1.41   0.158    -.0000333    5.40e-06
            ..................................    
          t_7_48 |   .0016771   .0011288     1.49   0.137    -.0005353    .0038895
    -------------+----------------------------------------------------------------
    g9           |
           t_1_2 |          0  (omitted)
           t_2_3 |          0  (omitted)
           t_3_4 |          0  (omitted)
           t_4_5 |          0  (omitted)
           t_5_6 |          0  (omitted)
           t_6_7 |          0  (omitted)
           t_7_8 |          0  (omitted)
           t_8_9 |          0  (omitted)
          t_8_10 |          0  (omitted)
          t_8_11 |          0  (omitted)
          t_8_12 |          0  (omitted)
          t_8_13 |          0  (omitted)
          t_8_14 |          0  (omitted)
          t_8_15 |          0  (omitted)
          t_8_16 |          0  (omitted)
          t_8_17 |          0  (omitted)
          t_8_18 |          0  (omitted)
          t_8_19 |          0  (omitted)
          t_8_20 |          0  (omitted)
          t_8_21 |          0  (omitted)
          t_8_22 |          0  (omitted)
          t_8_23 |          0  (omitted)
          t_8_24 |          0  (omitted)
          t_8_25 |          0  (omitted)
          t_8_26 |          0  (omitted)
          t_8_27 |          0  (omitted)
          t_8_28 |          0  (omitted)
          t_8_29 |          0  (omitted)
          t_8_30 |          0  (omitted)
          t_8_31 |          0  (omitted)
          t_8_32 |          0  (omitted)
          t_8_33 |          0  (omitted)
          t_8_34 |          0  (omitted)
          t_8_35 |          0  (omitted)
          t_8_36 |          0  (omitted)
          t_8_37 |          0  (omitted)
          t_8_38 |          0  (omitted)
          t_8_39 |          0  (omitted)
          t_8_40 |          0  (omitted)
          t_8_41 |          0  (omitted)
          t_8_42 |          0  (omitted)
          t_8_43 |          0  (omitted)
          t_8_44 |          0  (omitted)
          t_8_45 |          0  (omitted)
          t_8_46 |          0  (omitted)
          t_8_47 |          0  (omitted)
          t_8_48 |          0  (omitted)
    ------------------------------------------------------------------------------

  • #2
    Can you tab your time variable va gvar?
    I suspect your effective sample is too small for the number of controls you are using

    Comment


    • #3
      FernandoRios Here's what I get:


      Code:
      
      tab weeknum gvar
      
                 |                               gvar
         weeknum |         0          3          4          5          7          8 |     Total
      -----------+------------------------------------------------------------------+----------
               1 |         8          1          0          3          0          0 |        12 
               2 |        13          2          3          3          1          0 |        22 
               3 |        16          2          3          3          1          1 |        27 
               4 |        17          2          3          5          1          1 |        30 
               5 |        19          2          4          5          1          1 |        33 
               6 |        19          2          4          5          1          2 |        34 
               7 |        19          2          4          5          1          2 |        34 
               8 |        19          2          4          5          1          2 |        34 
               9 |        20          2          4          5          1          2 |        35 
              10 |        20          2          4          5          1          2 |        35 
              11 |        20          2          4          5          1          2 |        35 
              12 |        20          2          4          5          1          2 |        35 
              13 |        20          2          4          5          1          2 |        35 
              14 |        20          2          4          5          1          2 |        35 
              15 |        20          2          4          5          1          2 |        35 
              16 |        20          2          4          5          1          2 |        35 
              17 |        20          2          4          5          1          2 |        35 
              18 |        20          2          4          5          1          2 |        35 
              19 |        20          2          4          5          1          2 |        35 
              20 |        20          2          4          5          1          2 |        35 
              21 |        20          2          4          5          1          2 |        35 
              22 |        20          2          4          5          1          2 |        35 
              23 |        20          2          4          5          1          2 |        35 
              24 |        20          2          4          5          1          2 |        35 
              25 |        20          2          4          5          1          2 |        35 
              26 |        20          2          4          5          1          2 |        35 
              27 |        20          2          4          5          1          2 |        35 
              28 |        20          2          4          5          1          2 |        35 
              29 |        20          2          4          5          1          2 |        35 
              30 |        20          2          4          5          1          2 |        35 
              31 |        20          2          4          5          1          2 |        35 
              32 |        20          2          4          5          1          2 |        35 
              33 |        20          2          4          5          1          2 |        35 
              34 |        20          2          4          5          1          2 |        35 
              35 |        20          2          4          5          1          2 |        35 
              36 |        20          2          4          5          1          2 |        35 
              37 |        20          2          4          5          1          2 |        35 
              38 |        20          2          4          5          1          2 |        35 
              39 |        20          2          4          5          1          2 |        35 
              40 |        20          2          4          5          1          2 |        35 
              41 |        20          2          4          5          1          2 |        35 
              42 |        20          2          4          5          1          2 |        35 
              43 |        20          2          4          5          1          2 |        35 
              44 |        20          2          4          5          1          2 |        35 
              45 |        20          2          4          5          1          2 |        35 
              46 |        20          2          4          5          1          2 |        35 
              47 |        20          2          4          5          1          2 |        35 
              48 |        20          2          4          5          1          2 |        35 
      -----------+------------------------------------------------------------------+----------
           Total |       930         95        185        234         47         89 |     1,626 
      
      
                 |    gvar
         weeknum |         9 |     Total
      -----------+-----------+----------
               1 |         0 |        12 
               2 |         0 |        22 
               3 |         1 |        27 
               4 |         1 |        30 
               5 |         1 |        33 
               6 |         1 |        34 
               7 |         1 |        34 
               8 |         1 |        34 
               9 |         1 |        35 
              10 |         1 |        35 
              11 |         1 |        35 
              12 |         1 |        35 
              13 |         1 |        35 
              14 |         1 |        35 
              15 |         1 |        35 
              16 |         1 |        35 
              17 |         1 |        35 
              18 |         1 |        35 
              19 |         1 |        35 
              20 |         1 |        35 
              21 |         1 |        35 
              22 |         1 |        35 
              23 |         1 |        35 
              24 |         1 |        35 
              25 |         1 |        35 
              26 |         1 |        35 
              27 |         1 |        35 
              28 |         1 |        35 
              29 |         1 |        35 
              30 |         1 |        35 
              31 |         1 |        35 
              32 |         1 |        35 
              33 |         1 |        35 
              34 |         1 |        35 
              35 |         1 |        35 
              36 |         1 |        35 
              37 |         1 |        35 
              38 |         1 |        35 
              39 |         1 |        35 
              40 |         1 |        35 
              41 |         1 |        35 
              42 |         1 |        35 
              43 |         1 |        35 
              44 |         1 |        35 
              45 |         1 |        35 
              46 |         1 |        35 
              47 |         1 |        35 
              48 |         1 |        35 
      -----------+-----------+----------
           Total |        46 |     1,626

      Comment


      • #4
        That explains it
        you see how your sample is very small? 1 2 4 & 5
        so based on the smallest cell size you can’t add any controls
        Adding controls creates problems of perfect fitting with drimp dripw or ipw
        reg will work but the extrapolation may be really bad
        hope it helps

        Comment


        • #5
          Thanks FernandoRios. Does that mean that this model does not work at all given my dataset? If so, is there any other method that you recommend?

          Comment


          • #6
            It works
            you simply can’t use controls on it
            am alternative could be using did2s or did_impute which use more data for the pretreatment identification and extrapolation.
            however even with that you have only minimal room for controls.
            the other option is sdid and use synthetic control did for this
            hyh

            Comment


            • #7
              FernandoRios I apologize, I got sidetracked by another project and just returned to this. I looked up sdid (thank you, I was unaware of this), but since my data is an unbalanced panel it appears I cannot use it.

              I returned to the csdid command to see if changing the time time variable from week to month would help, and get the result below which still has significant omissions. As seen in the tab of time variable va gvar, the previous problem of the sample being very small and the smallest cell size not allowing for any controls still stands. Is there any other approach that you recommend for an unbalanced panel with multiple time periods and different intervention start dates across units?

              Code:
              Output:
              
              sdid rate_con_avg7day pop_perkm2_2019 povertyperct rate_test_avg7day per60_2011 ///
              >litrate_2011 hospital_beds_total1k hospital_total1k htnanddm20181k commoncancers20181k ///
              >hepcases_20181k malariacase2018 mentalillness_20111k  pneumoniatot_case2018    ///
              > stroke20181k tb2018 exphealth_percap1516 typoidtot_case2018, ivar(statenum) time(month) gvar(gvar) 
              Units always treated found. These will be ignored
              Panel is not balanced
              Will use observations with Pair balanced (observed at t0 and t1)
              ....................xxxxxxxxxxx.........xxxxxxxxxx
              
              Difference-in-difference with Multiple Time Periods
              
                                                                         Number of obs = 290
              Outcome model  : least squares
              Treatment model: inverse probability
              ------------------------------------------------------------------------------
                           | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
              -------------+----------------------------------------------------------------
              g4           |
                     t_3_4 |  -4.44e-15   2.06e-15    -2.16   0.031    -8.47e-15   -4.14e-16
                     t_3_5 |  -6.66e-14   3.12e-14    -2.14   0.033    -1.28e-13   -5.48e-15
                     t_3_6 |   2.68e-14   1.65e-14     1.63   0.103    -5.44e-15    5.91e-14
                     t_3_7 |   4.39e-13   2.15e-13     2.04   0.041     1.78e-14    8.61e-13
                     t_3_8 |   1.80e-12   8.41e-13     2.13   0.033     1.47e-13    3.44e-12
                     t_3_9 |   3.26e-12   1.56e-12     2.09   0.037     2.04e-13    6.32e-12
                    t_3_10 |   5.85e-12   2.80e-12     2.09   0.037     3.64e-13    1.13e-11
                    t_3_11 |   5.02e-12   2.38e-12     2.11   0.035     3.46e-13    9.69e-12
                    t_3_12 |   5.01e-12   2.39e-12     2.09   0.036     3.22e-13    9.70e-12
                    t_3_13 |   5.30e-12   2.47e-12     2.14   0.032     4.55e-13    1.01e-11
              -------------+----------------------------------------------------------------
              g5           |
                     t_3_4 |   6.53e-15   1.82e-15     3.59   0.000     2.97e-15    1.01e-14
                     t_4_5 |  -.7811111   .8156601    -0.96   0.338    -2.379775    .8175533
                     t_4_6 |   3.679993   3.234755     1.14   0.255    -2.660009       10.02
                     t_4_7 |   14.33042   12.76803     1.12   0.262    -10.69446     39.3553
                     t_4_8 |   50.88598    38.0864     1.34   0.182    -23.76198    125.5339
                     t_4_9 |   106.4795   76.54976     1.39   0.164    -43.55531    256.5143
                    t_4_10 |   201.3841   143.6211     1.40   0.161    -80.10814    482.8763
                    t_4_11 |   185.7676   133.4797     1.39   0.164     -75.8479     447.383
                    t_4_12 |   193.0112   138.0383     1.40   0.162    -77.53896    463.5613
                    t_4_13 |   205.1946   145.8356     1.41   0.159    -80.63789    491.0271
              -------------+----------------------------------------------------------------
              g7           |
                     t_3_4 |          0  (omitted)
                     t_4_5 |          0  (omitted)
                     t_5_6 |          0  (omitted)
                     t_6_7 |          0  (omitted)
                     t_6_8 |          0  (omitted)
                     t_6_9 |          0  (omitted)
                    t_6_10 |          0  (omitted)
                    t_6_11 |          0  (omitted)
                    t_6_12 |          0  (omitted)
                    t_6_13 |          0  (omitted)
              -------------+----------------------------------------------------------------
              g8           |
                     t_3_4 |          0  (omitted)
                     t_4_5 |  -1.31e-13   3.82e-14    -3.43   0.001    -2.06e-13   -5.62e-14
                     t_5_6 |  -4.861025    2.64531    -1.84   0.066    -10.04574    .3236876
                     t_6_7 |  -7.99e-12   3.33e-12    -2.40   0.016    -1.45e-11   -1.47e-12
                     t_7_8 |   1.75e-11   6.23e-12     2.81   0.005     5.28e-12    2.97e-11
                     t_7_9 |   8.12e-11   2.88e-11     2.83   0.005     2.49e-11    1.38e-10
                    t_7_10 |   1.27e-10   4.48e-11     2.84   0.005     3.92e-11    2.15e-10
                    t_7_11 |   9.62e-11   3.47e-11     2.77   0.006     2.82e-11    1.64e-10
                    t_7_12 |   9.26e-11   3.27e-11     2.83   0.005     2.84e-11    1.57e-10
                    t_7_13 |   8.85e-11   3.17e-11     2.79   0.005     2.64e-11    1.51e-10
              -------------+----------------------------------------------------------------
              g9           |
                     t_3_4 |          0  (omitted)
                     t_4_5 |          0  (omitted)
                     t_5_6 |          0  (omitted)
                     t_6_7 |          0  (omitted)
                     t_7_8 |          0  (omitted)
                     t_8_9 |          0  (omitted)
                    t_8_10 |          0  (omitted)
                    t_8_11 |          0  (omitted)
                    t_8_12 |          0  (omitted)
                    t_8_13 |          0  (omitted)
              ------------------------------------------------------------------------------
              Control: Never Treated
              
              See Callaway and Sant'Anna (2021) for details
              
              
              tab month gvar
              
                         |                          gvar
                   month |         0          3          4          5          7 |     Total
              -----------+-------------------------------------------------------+----------
                       3 |        14          2          3          4          1 |        26 
                       4 |        16          2          4          5          1 |        31 
                       5 |        17          2          4          5          1 |        32 
                       6 |        17          2          4          5          1 |        32 
                       7 |        17          2          4          5          1 |        32 
                       8 |        17          2          4          5          1 |        32 
                       9 |        17          2          4          5          1 |        32 
                      10 |        17          2          4          5          1 |        32 
                      11 |        17          2          4          5          1 |        32 
                      12 |        17          2          4          5          1 |        32 
                      13 |        17          2          4          5          1 |        32 
              -----------+-------------------------------------------------------+----------
                   Total |       183         22         43         54         11 |       345 
              
              
                         |         gvar
                   month |         8          9 |     Total
              -----------+----------------------+----------
                       3 |         1          1 |        26 
                       4 |         2          1 |        31 
                       5 |         2          1 |        32 
                       6 |         2          1 |        32 
                       7 |         2          1 |        32 
                       8 |         2          1 |        32 
                       9 |         2          1 |        32 
                      10 |         2          1 |        32 
                      11 |         2          1 |        32 
                      12 |         2          1 |        32 
                      13 |         2          1 |        32 
              -----------+----------------------+----------
                   Total |        21         11 |       345 
              
              .

              Comment


              • #8
                One that is more flexible in terms of model specification for repeated crossection would be did_imputation.
                It basically models your outcome using only not-treated data. and uses this to extrapolate into the treated units (during treatment).
                Because of this, you can be more flexible adding controls, but only to certain extent.
                HTH

                Comment


                • #9
                  FernandoRios Thanks, Fernando. I did try out did_imputation and would greatly appreciate your guidance on interpreting the output. I've run three specifications of the command:

                  1. In #1 below, A very basic command that allows for lags and leads, but with no controls. I've used the minn(0) option to reduce the threshold for calculating the estimates based on to treated groups to zero. However, since my my pre-treatment parallel trends are conditional on covariates, this basic model with no covariates doesn't work. (Note: my understanding here is that like in csdid, including covariates allows for the “parallel trends assumption to hold potentially only after conditioning on observed covariates". Please do let me know if I have misinterpreted this)
                  2. In #2 below, I included all necessary covariates, but run into omitted output as seen below. Ideally, this would be the specification I would like to run, and so am not sure what to do.
                  3. In #3 below, I included only 2 covariates, but get omitted coefficients even for these two, with the tau coefficient being the same if I ran the specification without the controls.

                  did_imputation is very new to me and I'm having difficulty understanding what exactly is happening here. Does this mean that my sample size is just too small even for this model to include all the covariates? If so, how is it that even paring the specification down to include just two covariates is running into problems. A pared down version with csdid appeared to work fine, and my understanding is that this is a more flexible model.


                  Code:
                  Model 1:
                  did_imputation rate_con_avg7day state weeknum gvar_wk, horizons(0/10) pretrend(
                  > 10) minn(0)
                  
                                                                           Number of obs = 1,152
                  ------------------------------------------------------------------------------
                  rate_con_a~y | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                  -------------+----------------------------------------------------------------
                          tau0 |  -.1664607   .1097231    -1.52   0.129     -.381514    .0485926
                          tau1 |  -.1952425   .1403175    -1.39   0.164    -.4702598    .0797748
                          tau2 |  -.1981032   .1835093    -1.08   0.280    -.5577749    .1615684
                          tau3 |  -.1282566   .2306716    -0.56   0.578    -.5803647    .3238514
                          tau4 |   -.043209   .2815442    -0.15   0.878    -.5950256    .5086076
                          tau5 |   .0676714   .3273894     0.21   0.836        -.574    .7093429
                          tau6 |   .1803828   .3717323     0.49   0.627    -.5481992    .9089647
                          tau7 |   .2567773   .4053272     0.63   0.526    -.5376495    1.051204
                          tau8 |     .32404   .4352558     0.74   0.457    -.5290457    1.177126
                          tau9 |   .3963354   .4695793     0.84   0.399    -.5240232    1.316694
                         tau10 |    .482609   .5089584     0.95   0.343    -.5149311    1.480149
                          pre1 |  -.6511666   .3964881    -1.64   0.101    -1.428269    .1259357
                          pre2 |  -.5971879   .3531467    -1.69   0.091    -1.289343    .0949668
                          pre3 |  -.5550397   .3075969    -1.80   0.071    -1.157919    .0478391
                          pre4 |  -.4942177   .2646653    -1.87   0.062    -1.012952    .0245168
                          pre5 |  -.4695266   .2365316    -1.99   0.047      -.93312   -.0059332
                          pre6 |  -.4570495   .2252221    -2.03   0.042    -.8984767   -.0156223
                          pre7 |   -.328927   .1606409    -2.05   0.041    -.6437773   -.0140767
                          pre8 |  -.3326807   .1495892    -2.22   0.026    -.6258701   -.0394913
                          pre9 |  -.2803194   .1602777    -1.75   0.080    -.5944579    .0338191
                         pre10 |  -.1949567   .1109105    -1.76   0.079    -.4123373    .0224238
                  ------------------------------------------------------------------------------
                  
                  
                  Model 2:
                  did_imputation rate_con_avg7day state weeknum gvar_wk, ///
                  > controls (pop_perkm2_2019 povertyperct rate_test_avg7day per60_2011 litrate_201
                  > 1 ///
                  > hospital_beds_total1k hospital_total1k htnanddm20181k commoncancers20181k      
                  >          ///
                  > hepcases_20181k malariacase2018 mentalillness_20111k stroke20181k ///
                  > pneumoniatot_case2018 tb2018 exphealth_percap1516 typoidtot_case2018), ///
                  
                  end of do-file
                  
                  . did_imputation rate_con_avg7day state weeknum gvar_wk, controls (pop_perkm2_201
                  > 9 povertyperct rate_test_avg7day per60_2011 litrate_2011 hospital_beds_total1k 
                  > hospital_total1k htnanddm20181k commoncancers20181k hepcases_20181k malariacase
                  > 2018 mentalillness_20111k stroke20181k pneumoniatot_case2018 tb2018 exphealth_p
                  > ercap1516 typoidtot_case2018)
                  
                                                                           Number of obs = 1,533
                  --------------------------------------------------------------------------------
                  rate_con_avg~y | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                  ---------------+----------------------------------------------------------------
                             tau |   .1436655   .8182949     0.18   0.861    -1.460163    1.747494
                  pop_perkm~2019 |          0  (omitted)
                    povertyperct |          0  (omitted)
                  rate_test_av~y |   .0676723   .0253258     2.67   0.008     .0180347    .1173099
                      per60_2011 |          0  (omitted)
                    litrate_2011 |          0  (omitted)
                  hospital_be~1k |          0  (omitted)
                  hospital_to~1k |          0  (omitted)
                  htnanddm20181k |          0  (omitted)
                  commonc~20181k |          0  (omitted)
                  hepcase~20181k |          0  (omitted)
                  malariaca~2018 |          0  (omitted)
                  mentali~20111k |          0  (omitted)
                    stroke20181k |          0  (omitted)
                  pne~t_case2018 |          0  (omitted)
                          tb2018 |          0  (omitted)
                  expheal~ap1516 |          0  (omitted)
                  typoidtot_ca~8 |          0  (omitted)
                  --------------------------------------------------------------------------------
                  
                  Model 3
                  
                  did_imputation rate_con_avg7day state weeknum gvar_wk, controls (pop_perkm2_201
                  > 9 povertyperct)
                  
                                                                           Number of obs = 1,533
                  --------------------------------------------------------------------------------
                  rate_con_avg~y | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                  ---------------+----------------------------------------------------------------
                             tau |   .2935677   1.057376     0.28   0.781    -1.778851    2.365987
                  pop_perkm~2019 |          0  (omitted)
                    povertyperct |          0  (omitted)
                  --------------------------------------------------------------------------------
                  
                  . did_imputation rate_con_avg7day state weeknum gvar_wk
                  
                                                                           Number of obs = 1,533
                  ------------------------------------------------------------------------------
                  rate_con_a~y | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                  -------------+----------------------------------------------------------------
                           tau |   .2935677   1.057376     0.28   0.781    -1.778851    2.365987
                  ------------------------------------------------------------------------------

                  Comment


                  • #10
                    Correct
                    you can’t add many covariants because your sample is just small
                    it may be easier to see that if you implement the methods manually

                    Comment


                    • #11
                      FernandoRios Thank you. But it appears to be failing even when I add just two covariates as seen in model 3 in #9. The sample should be large enough for two covariates, I think. Would you also know if there is a guide on how to implement the methods manually?

                      Also, if I may continue to bother you - I've been trying to explore the flexpaneldid command, which appears to work when I use the nearest neighbor matching method. However, I appear to run into trouble on using the CEM matching method within flexpaneldid. Would you have any suggestions on this? I'd posted about it here a while back, but did not find a resolution: https://www.statalist.org/forums/for...o-flexpaneldid
                      Last edited by Scott Rick; 12 Aug 2023, 03:50.

                      Comment


                      • #12
                        If you see the cross tab you show me earlier you will see some cells have 1 or 2 observations
                        that means that you can’t add controls with csdid or just very minimal with did_imputation (1? 2? At most)
                        don’t know flexdid but you can refer to the original papers for manual implementation
                        Asjad Navqi has a blog where he describes implementation for few of the strategies
                        Last edited by FernandoRios; 12 Aug 2023, 04:40.

                        Comment


                        • #13
                          Thanks FernandoRios. I appreciate all the help!

                          Comment

                          Working...
                          X