Announcement

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

  • Interrupted Timeseries with different Intervention Periods

    Dear Stata members,

    I am working on a project that required me to run Interrupted Timeseries on my dataset. My dataset is a panel data with 2400 schools during a school year (from Sep 2021 - June 2022). I am trying to see the effect of mask mandate lifting on the positivity rate. But different schools may have different time for lifting mask mandate. I was wondering if there is a way to automatically calculate lifting mask mandate time for each school?

    Also, I run the ITS considering a fixed intervention time but the coefficients are very tiny. Could anyone help me on this?

    Thanks,
    Anseh




    Code:
    xtset pannel_var weeks_from_start
    
    Panel variable: pannel_var (unbalanced)
     Time variable: weeks_from_start, -26 to 16, but with gaps
             Delta: 1 unit
    
    
    
    xtitsa positivity_rate, single trperiod(0) posttrend figure replace
    
    
    
    Iteration 1: tolerance = .0001032
    Iteration 2: tolerance = .00002017
    Iteration 3: tolerance = 3.907e-06
    Iteration 4: tolerance = 7.556e-07
    
    GEE population-averaged model                       Number of obs    = 117,047
    Group variable: pannel_var                          Number of groups =  94,706
    Family: Gaussian                                    Obs per group:  
    Link:   Identity                                                 min =       1
    Correlation: exchangeable                                        avg =     1.2
                                                                     max =      10
                                                        Wald chi2(3)     = 9060.45
    Scale parameter = .0011721                          Prob > chi2      =  0.0000
    
    
    ------------------------------------------------------------------------------
    _positivit~e | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
              _t |     .00068   .0000295    23.05   0.000     .0006221    .0007378
             _x0 |  -.0330523   .0003803   -86.90   0.000    -.0337977   -.0323068
           _x_t0 |   .0025498   .0000379    67.35   0.000     .0024756     .002624
           _cons |   .0456366   .0001318   346.36   0.000     .0453783    .0458948
    ------------------------------------------------------------------------------
    
    
      Postintervention Linear Trend: 0
    
    Treated: _b[_t]+_b[_x_t0]
    ------------------------------------------------------------------------------
    Linear Trend |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         Treated |   .0032298   .0000444    72.78   0.000     .0031428    .0033168
    ------------------------------------------------------------------------------
    
    
    xtitsa positivity_rate i.weeks_from_start_pos i._x0#c.cases_norm i._x0#c.full_high_porportion i._x0#c.consent_rate i._x0#c.black i._x0#c.white  i._x0#c.hispanic  i._x0#c.other i._x0#i.rural i._x0#i.title1 i._x0#i.charter i._x0#i.surv_group  i._x0#i.masking_policy i._x0#i.school_category, single trperiod(0) posttrend figure replace
    
    
    
    Panel variable: pannel_var (unbalanced)
     Time variable: weeks_from_start, -26 to 16, but with gaps
             Delta: 1 unit
    note: 40.weeks_from_start_pos omitted because of collinearity.
    note: 42.weeks_from_start_pos omitted because of collinearity.
    note: 1._x0#1.rural omitted because of collinearity.
    note: 1._x0#1.title1 omitted because of collinearity.
    note: 1._x0#1.charter omitted because of collinearity.
    note: 1._x0#1.surv_group omitted because of collinearity.
    note: 0._x0#0.masking_policy identifies no observations in the sample.
    note: 0._x0#1.masking_policy omitted because of collinearity.
    note: 1._x0#1.masking_policy omitted because of collinearity.
    note: 1._x0#2.school_category omitted because of collinearity.
    
    Iteration 1: tolerance = 1.008e-11
    
    GEE population-averaged model                        Number of obs    = 18,040
    Group variable: pannel_var                           Number of groups = 14,450
    Family: Gaussian                                     Obs per group:  
    Link:   Identity                                                  min =      1
    Correlation: exchangeable                                         avg =    1.2
                                                                      max =     10
                                                         Wald chi2(0)     =      .
    Scale parameter = 6.04e-27                           Prob > chi2      =      .
    
    --------------------------------------------------------------------------------------------
              _positivity_rate | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    ---------------------------+----------------------------------------------------------------
                            _t |  -9.15e-17   1.82e-16    -0.50   0.615    -4.48e-16    2.65e-16
                           _x0 |   .0330016   5.14e-14  6.4e+11   0.000     .0330016    .0330016
                         _x_t0 |  -.0005241   3.00e-15 -1.7e+11   0.000    -.0005241   -.0005241
                               |
          weeks_from_start_pos |
                            2  |   .0002655   2.27e-14  1.2e+10   0.000     .0002655    .0002655
                            4  |  -.0010981   2.21e-14 -5.0e+10   0.000    -.0010981   -.0010981
                            6  |    .001252   2.18e-14  5.7e+10   0.000      .001252     .001252
                            8  |  -.0002997   2.17e-14 -1.4e+10   0.000    -.0002997   -.0002997
                           10  |   .0045453   2.17e-14  2.1e+11   0.000     .0045453    .0045453
                           12  |   .0069284   2.17e-14  3.2e+11   0.000     .0069284    .0069284
                           14  |   .0117606   2.17e-14  5.4e+11   0.000     .0117606    .0117606
                           16  |   .0137507   2.17e-14  6.3e+11   0.000     .0137507    .0137507
                           18  |   .1267677   2.17e-14  5.8e+12   0.000     .1267677    .1267677
                           20  |   .0732221   2.18e-14  3.4e+12   0.000     .0732221    .0732221
                           22  |   .0328057   2.19e-14  1.5e+12   0.000     .0328057    .0328057
                           24  |   .0118361   2.20e-14  5.4e+11   0.000     .0118361    .0118361
                           26  |  -.0300916   4.40e-14 -6.8e+11   0.000    -.0300916   -.0300916
                           28  |  -.0313611   3.79e-14 -8.3e+11   0.000    -.0313611   -.0313611
                           30  |  -.0232862   3.19e-14 -7.3e+11   0.000    -.0232862   -.0232862
                           32  |  -.0135734   2.60e-14 -5.2e+11   0.000    -.0135734   -.0135734
                           34  |  -.0087684   2.01e-14 -4.4e+11   0.000    -.0087684   -.0087684
                           36  |   .0170497   1.41e-14  1.2e+12   0.000     .0170497    .0170497
                           38  |   .0175999   8.47e-15  2.1e+12   0.000     .0175999    .0175999
                           40  |          0  (omitted)
                           42  |          0  (omitted)
                               |
              _x0#c.cases_norm |
                            0  |  -5.01e-13   2.46e-14   -20.39   0.000    -5.49e-13   -4.53e-13
                            1  |   1.64e-13   3.13e-14     5.22   0.000     1.02e-13    2.25e-13
                               |
    _x0#c.full_high_porportion |
                            0  |  -9.33e-14   4.55e-15   -20.49   0.000    -1.02e-13   -8.43e-14
                            1  |   2.42e-15   7.13e-15     0.34   0.735    -1.16e-14    1.64e-14
                               |
            _x0#c.consent_rate |
                            0  |  -3.23e-14   3.82e-15    -8.46   0.000    -3.98e-14   -2.48e-14
                            1  |   8.81e-15   5.51e-15     1.60   0.110    -1.99e-15    1.96e-14
                               |
                   _x0#c.black |
                            0  |  -9.78e-16   7.27e-17   -13.46   0.000    -1.12e-15   -8.36e-16
                            1  |   3.84e-16   1.15e-16     3.34   0.001     1.59e-16    6.08e-16
                               |
                   _x0#c.white |
                            0  |  -8.53e-16   4.91e-17   -17.37   0.000    -9.50e-16   -7.57e-16
                            1  |   3.65e-16   7.22e-17     5.05   0.000     2.23e-16    5.07e-16
                               |
                _x0#c.hispanic |
                            0  |  -1.06e-15   6.05e-17   -17.56   0.000    -1.18e-15   -9.43e-16
                            1  |   3.06e-16   8.79e-17     3.48   0.000     1.34e-16    4.78e-16
                               |
                   _x0#c.other |
                            0  |  -9.16e-16   8.07e-17   -11.36   0.000    -1.07e-15   -7.58e-16
                            1  |   2.74e-16   1.17e-16     2.34   0.019     4.50e-17    5.03e-16
                               |
                     _x0#rural |
                          0 1  |  -5.81e-15   2.56e-15    -2.27   0.023    -1.08e-14   -7.96e-16
                          1 0  |  -2.36e-16   3.85e-15    -0.06   0.951    -7.79e-15    7.31e-15
                          1 1  |          0  (omitted)
                               |
                    _x0#title1 |
                          0 1  |   3.51e-15   2.46e-15     1.43   0.153    -1.31e-15    8.33e-15
                          1 0  |   9.56e-16   3.69e-15     0.26   0.795    -6.27e-15    8.18e-15
                          1 1  |          0  (omitted)
                               |
                   _x0#charter |
                          0 1  |   1.74e-14   4.68e-15     3.71   0.000     8.19e-15    2.66e-14
                          1 0  |  -3.22e-17   6.53e-15    -0.00   0.996    -1.28e-14    1.28e-14
                          1 1  |          0  (omitted)
                               |
                _x0#surv_group |
                          0 1  |  -7.88e-15   1.56e-15    -5.04   0.000    -1.09e-14   -4.82e-15
                          1 0  |  -3.75e-16   2.15e-15    -0.17   0.862    -4.59e-15    3.84e-15
                          1 1  |          0  (omitted)
                               |
            _x0#masking_policy |
                          0 0  |          0  (empty)
                          0 1  |          0  (omitted)
                          1 0  |   1.36e-14   3.79e-15     3.59   0.000     6.19e-15    2.10e-14
                          1 1  |          0  (omitted)
                               |
           _x0#school_category |
                     0#public  |  -2.07e-15   2.20e-15    -0.94   0.346    -6.37e-15    2.24e-15
                    1#private  |   8.46e-15   3.25e-15     2.60   0.009     2.09e-15    1.48e-14
                     1#public  |          0  (omitted)
                               |
                         _cons |   .0100908   2.23e-14  4.5e+11   0.000     .0100908    .0100908
    --------------------------------------------------------------------------------------------
    
    
                        Postintervention Linear Trend: 0
    
    Treated: _b[_t]+_b[_x_t0]
    ------------------------------------------------------------------------------
    Linear Trend |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         Treated |  -.0005241   3.00e-15 -1.7e+11   0.000    -.0005241   -.0005241
    ------------------------------------------------------------------------------
    
    . 
    end of do-file

  • #2
    Uhhhhhhh is the time = 0 for each school that lifted it at a given time? This is a problem of staggered implementation, I don't see why the current ITSA couldn't handle this.

    Comment


    • #3
      Thank you for your response, Jared. Week 0 is Feb 28, 2022, the time that schools can lift the mask mandate. Some schools lifted at that time, and some of them lifted later (for example on March 15). Even using Feb 28 as one fixed intervention, the coefficients are really small. Also, I tried running the code for different school categories (elementary, middle, high), and the slope before, at, and after the intervention as well as the coefficients for all of them are exactly the same as the above results.
      Last edited by Anseh Danesharasteh; 25 Oct 2022, 19:06.

      Comment


      • #4
        May I make a suggestion?

        Comment


        • #5
          Sure. Yes please.

          Comment


          • #6
            Here's my beef with ITSA: implicitly, you're presuming that every untreated units is a good comparison unit for the treated unit in question. Well, I don't care what you control for, this is false.

            My recommendation to you, is to use allsynth by Justin Wiltshire. SCM constructs a weighted average of your untreated units using the covariates and outcomes you specify. It handles staggered adoption well, and is a far more principled method than ITSA, as useful as ITSA can sometimes be!

            You can also use my method too. If you need help with these, just post back and I'll advise

            Comment


            • #7
              Thank you, Jared. I will look at the methods you provided and get back to you.

              Comment


              • #8
                I want to add covariates to ITS model. Below is my code. Do you know how to add covariates to itsa command? Thanks.

                itsa SUDSR1000 , single trperiod(2018-01; 2019-07;2020-03;2021-02) lag(1) replace posttr figure

                Comment

                Working...
                X