Announcement

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

  • Detrending state panel data

    Dear All,

    I have quarterly data for 27 quarters for the 50 U.S. states. The dependent variable 'y' trends downwards across most states, for reasons exogenous to my model, but the downward trend differs by states. My data looks as follows:

    Code:
     
     * Example generated by -dataex-. To install: ssc install dataex clear input float(y x1 x2 x3 x4 x5 x6) byte(treated stateFIPS) float qtr 1.5559138  7.733333 0  7.7 0 27.7 0 1 2  1 1.6127143  7.566667 0  7.7 0 27.7 0 1 2  2 1.7659954       7.5 0  7.7 0 27.7 0 1 2  3  1.692289  7.466667 0  7.7 0 27.7 0 1 2  4 1.5172564  7.333333 0  7.7 0 27.7 0 1 2  5 1.6035068  7.166667 0  7.7 0 27.7 0 1 2  6 1.2022197  7.033333 0  7.7 0 27.7 0 1 2  7 1.4228586         7 0  7.7 0 27.7 0 1 2  8 1.2361064         7 0  7.7 0 27.7 0 1 2  9 1.2747653         7 0  7.7 0 27.7 0 1 2 10 1.4483876         7 0  7.7 0 27.7 0 1 2 11  1.568398         7 0  7.7 0 27.7 0 1 2 12  .9668907         7 0  7.7 0 27.7 0 1 2 13  1.449154         7 0  7.7 0 27.7 0 1 2 14  1.449154  6.866667 0  7.7 0 27.7 0 1 2 15  1.480541       6.6 0  7.7 0 27.7 0 1 2 16  1.595735       6.5 0  7.7 0 27.7 0 1 2 17 1.5391836       6.5 0  7.7 0 27.7 0 1 2 18 1.0161722       6.5 0  7.7 0 27.7 0 1 2 19 1.4154757  6.633333 0  7.7 0 27.7 0 1 2 20 1.6449387  6.766667 0  7.7 0 27.7 0 1 2 21  1.231831  6.866667 0  7.7 0 27.7 0 1 2 22 1.5349833         7 0  7.7 0 27.7 0 1 2 23 1.3075814         7 0  7.7 0 27.7 0 1 2 24  1.507301  7.033333 0  7.7 0 27.7 0 1 2 25  1.646811  7.133333 0  7.7 0 27.7 0 1 2 26 1.0142392       7.2 0  7.7 0 27.7 0 1 2 27 1.2666522  5.833333 0 15.2 0   31 0 0 1 23 1.6315258       8.2 0 15.2 0   31 0 0 1  6  1.326853  5.266667 0 15.2 0   31 0 0 1 25 1.4991608       7.1 0 15.2 0   31 0 0 1 10 1.3814398  5.833333 0 15.2 0   31 0 0 1 22  1.571409        10 0 15.2 0   31 0 0 1  2  1.344622  5.966667 0 15.2 0   31 0 0 1 21 1.5037733  7.133333 0 15.2 0   31 0 0 1 11 1.0092516         4 0 15.2 0   31 0 0 1 27 1.3229584       5.8 0 15.2 0   31 0 0 1 24  1.515344         8 0 15.2 0   31 0 0 1  5  1.308136  6.166667 0 15.2 0   31 0 0 1 18 1.2208875       6.1 0 15.2 0   31 0 0 1 17 1.5226165  9.666667 0 15.2 0   31 0 0 1  3 1.3463856       6.1 0 15.2 0   31 0 0 1 19  1.293655 4.5666666 0 15.2 0   31 0 0 1 26 1.4713204  8.633333 0 15.2 0   31 0 0 1  4 1.5424006       6.6 0 15.2 0   31 0 0 1 15 1.3848766  6.233333 0 15.2 0   31 0 0 1 16  1.459566  7.233333 0 15.2 0   31 0 0 1 13 1.6085333       7.4 0 15.2 0   31 0 0 1  9  1.647645  8.066667 0 15.2 0   31 0 0 1  7 1.3517323         6 0 15.2 0   31 0 0 1 20 1.6233677  7.666667 0 15.2 0   31 0 0 1  8 1.6054567 10.166667 0 15.2 0   31 0 0 1  1 1.5083646  7.233333 0 15.2 0   31 0 0 1 12 1.4547566         7 0 15.2 0   31 0 0 1 14 1.3759344       8.5 0 14.8 0 34.7 0 1 5  1  1.340967  8.466666 0 14.8 0 34.7 0 1 5  2   1.39297       8.3 0 14.8 0 34.7 0 1 5  3 1.2671355       7.9 0 14.8 0 34.7 0 1 5  4  1.355654  7.633333 0 14.8 0 34.7 0 1 5  5  1.264284       7.6 0 14.8 0 34.7 0 1 5  6  1.329109  7.566667 0 14.8 0 34.7 0 1 5  7  1.389986       7.5 0 14.8 0 34.7 0 1 5  8 1.3710886       7.4 0 14.8 0 34.7 0 1 5  9 1.3964932  7.366667 0 14.8 0 34.7 0 1 5 10 1.4844826       7.2 0 14.8 0 34.7 0 1 5 11  1.461243       6.9 0 14.8 0 34.7 0 1 5 12 1.3860266  6.466667 0 14.8 0 34.7 0 1 5 13 1.4975384       6.1 0 14.8 0 34.7 0 1 5 14 1.3944175  5.866667 0 14.8 0 34.7 0 1 5 15 1.3775647  5.666667 0 14.8 0 34.7 0 1 5 16  1.440593  5.566667 0 14.8 0 34.7 0 1 5 17 1.5603316       5.3 0 14.8 0 34.7 0 1 5 18 1.6085224  4.833333 0 14.8 0 34.7 0 1 5 19  1.487191       4.4 0 14.8 0 34.7 0 1 5 20 1.3886967  4.133333 0 14.8 0 34.7 0 1 5 21 1.5917844         4 0 14.8 0 34.7 0 1 5 22  1.535788       3.9 0 14.8 0 34.7 0 1 5 23 1.3547676  3.766667 0 14.8 0 34.7 0 1 5 24 1.2802128 3.6333334 0 14.8 0 34.7 0 1 5 25 1.4500685 3.6333334 0 14.8 0 34.7 0 1 5 26 1.0170058       3.7 0 14.8 0 34.7 0 1 5 27 1.9711658  9.733334 0 13.8 0 24.3 0 1 4  1 2.0133007       9.7 0 13.8 0 24.3 0 1 4  2 1.9733152  9.566667 0 13.8 0 24.3 0 1 4  3 1.9450053         9 0 13.8 0 24.3 0 1 4  4  1.844171  8.666667 0 13.8 0 24.3 0 1 4  5 1.9472215  8.533334 0 13.8 0 24.3 0 1 4  6 1.8656484       8.2 0 13.8 0 24.3 0 1 4  7  1.827142  7.933333 0 13.8 0 24.3 0 1 4  8 1.8857902       7.9 0 13.8 0 24.3 0 1 4  9  1.826929  7.833333 0 13.8 0 24.3 0 1 4 10 1.8903527  7.733333 0 13.8 0 24.3 0 1 4 11 1.7461482       7.5 0 13.8 0 24.3 0 1 4 12 1.7260584  7.133333 0 13.8 0 24.3 0 1 4 13 1.7974557  6.833333 0 13.8 0 24.3 0 1 4 14  1.850183  6.633333 0 13.8 0 24.3 0 1 4 15 1.7900453  6.533333 0 13.8 0 24.3 0 1 4 16 1.6980425  6.333333 0 13.8 0 24.3 0 1 4 17 1.7348562       6.1 0 13.8 0 24.3 0 1 4 18 1.6200815  5.966667 0 13.8 0 24.3 0 1 4 19 end

    The dependent variable trends as follows:

    Click image for larger version

Name:	AAPCC_state_specific_trends_CT1.png
Views:	1
Size:	20.0 KB
ID:	1503857
    Click image for larger version

Name:	AAPCC_state_specific_trends_CT2.png
Views:	1
Size:	16.4 KB
ID:	1503858


    I want to estimate the effect of a policy change, which occurred at different calendar times in different states, on this dependent variable. However, I am concerned that the downward trend in the dependent variable will confound my policy impact. So I want to detrend the dependent variable for state specific trends. Would something like this work:


    Code:
     
     . reg y i.stateFIPS#(c.qtr c.qtrsq)        Source |       SS           df       MS      Number of obs   =     1,377 -------------+----------------------------------   F(102, 1274)    =     46.27        Model |  102.154207       102  1.00151183   Prob > F        =    0.0000     Residual |  27.5753612     1,274  .021644711   R-squared       =    0.7874 -------------+----------------------------------   Adj R-squared   =    0.7704        Total |  129.729568     1,376  .094280209   Root MSE        =    .14712  -----------------------------------------------------------------------------------                 y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval] ------------------+----------------------------------------------------------------   stateFIPS#c.qtr |                1  |   .0101869   .0073169     1.39   0.164    -.0041676    .0245413                2  |  -.0096054   .0073169    -1.31   0.189    -.0239599     .004749                4  |   .0615533   .0073169     8.41   0.000     .0471989    .0759077                5  |  -.0083491   .0073169    -1.14   0.254    -.0227035    .0060054                6  |  -.0028259   .0073169    -0.39   0.699    -.0171804    .0115285                8  |   .0016657   .0073169     0.23   0.820    -.0126888    .0160201                9  |  -.0262667   .0073169    -3.59   0.000    -.0406211   -.0119122               10  |  -.1717266   .0073169   -23.47   0.000    -.1860811   -.1573722               11  |   .0168328   .0073169     2.30   0.022     .0024784    .0311872               12  |  -.0233691   .0073169    -3.19   0.001    -.0377235   -.0090146               13  |   .0146922   .0073169     2.01   0.045     .0003378    .0290467               15  |  -.0332974   .0073169    -4.55   0.000    -.0476519    -.018943               16  |   .0100183   .0073169     1.37   0.171    -.0043362    .0243727               17  |  -.0219212   .0073169    -3.00   0.003    -.0362757   -.0075668               18  |   .0282955   .0073169     3.87   0.000      .013941    .0426499               19  |   .0118876   .0073169     1.62   0.104    -.0024668    .0262421               20  |      .0001   .0073169     0.01   0.989    -.0142544    .0144545               21  |   .0496271   .0073169     6.78   0.000     .0352726    .0639815               22  |  -.0031451   .0073169    -0.43   0.667    -.0174995    .0112094               23  |   .0341882   .0073169     4.67   0.000     .0198337    .0485426               24  |   .0336763   .0073169     4.60   0.000     .0193219    .0480307               25  |  -.0777745   .0073169   -10.63   0.000    -.0921289     -.06342               26  |   .0188694   .0073169     2.58   0.010     .0045149    .0332238               27  |   .0282355   .0073169     3.86   0.000     .0138811      .04259               28  |  -.0189353   .0073169    -2.59   0.010    -.0332897   -.0045809               29  |   .0217946   .0073169     2.98   0.003     .0074402    .0361491               30  |  -.0228429   .0073169    -3.12   0.002    -.0371974   -.0084885               31  |  -.0234632   .0073169    -3.21   0.001    -.0378177   -.0091088               32  |   .0075364   .0073169     1.03   0.303    -.0068181    .0218908               33  |   -.005729   .0073169    -0.78   0.434    -.0200835    .0086254               34  |   -.040529   .0073169    -5.54   0.000    -.0548834   -.0261745               35  |   .0641529   .0073169     8.77   0.000     .0497985    .0785074               36  |   -.035125   .0073169    -4.80   0.000    -.0494795   -.0207706               37  |   .0234468   .0073169     3.20   0.001     .0090924    .0378013               38  |  -.0141182   .0073169    -1.93   0.054    -.0284727    .0002362               39  |  -.0265678   .0073169    -3.63   0.000    -.0409223   -.0122134               40  |   .0513108   .0073169     7.01   0.000     .0369564    .0656653               41  |   .0457489   .0073169     6.25   0.000     .0313944    .0601033               42  |  -.0320307   .0073169    -4.38   0.000    -.0463851   -.0176762               44  |  -.0445802   .0073169    -6.09   0.000    -.0589346   -.0302257               45  |  -.0463253   .0073169    -6.33   0.000    -.0606798   -.0319709               46  |   .0274279   .0073169     3.75   0.000     .0130734    .0417823               47  |  -.0078333   .0073169    -1.07   0.285    -.0221878    .0065211               48  |  -.0124892   .0073169    -1.71   0.088    -.0268436    .0018652               49  |   .0583917   .0073169     7.98   0.000     .0440372    .0727461               50  |  -.0453945   .0073169    -6.20   0.000    -.0597489     -.03104               51  |   .0268364   .0073169     3.67   0.000      .012482    .0411909               53  |   .0082139   .0073169     1.12   0.262    -.0061406    .0225683               54  |   .0627968   .0073169     8.58   0.000     .0484424    .0771513               55  |  -.0163769   .0073169    -2.24   0.025    -.0307314   -.0020225               56  |   .0180831   .0073169     2.47   0.014     .0037287    .0324375                   | stateFIPS#c.qtrsq |                1  |  -.0008639    .000337    -2.56   0.010    -.0015251   -.0002027                2  |   .0001878    .000337     0.56   0.578    -.0004734     .000849                4  |  -.0025389    .000337    -7.53   0.000    -.0032001   -.0018777                5  |   .0001467    .000337     0.44   0.663    -.0005145     .000808                6  |  -.0004973    .000337    -1.48   0.140    -.0011585    .0001639                8  |  -.0004861    .000337    -1.44   0.149    -.0011473    .0001751                9  |   .0003765    .000337     1.12   0.264    -.0002847    .0010377               10  |   .0049926    .000337    14.81   0.000     .0043314    .0056538               11  |  -.0012253    .000337    -3.64   0.000    -.0018865   -.0005641               12  |   .0002879    .000337     0.85   0.393    -.0003733    .0009491               13  |     -.0008    .000337    -2.37   0.018    -.0014613   -.0001388               15  |   .0007371    .000337     2.19   0.029     .0000759    .0013983               16  |  -.0003933    .000337    -1.17   0.243    -.0010545    .0002679               17  |   .0005376    .000337     1.60   0.111    -.0001236    .0011988               18  |  -.0014073    .000337    -4.18   0.000    -.0020685   -.0007461               19  |  -.0006573    .000337    -1.95   0.051    -.0013185    3.97e-06               20  |  -.0001804    .000337    -0.54   0.593    -.0008416    .0004808               21  |  -.0022882    .000337    -6.79   0.000    -.0029494    -.001627               22  |  -.0003891    .000337    -1.15   0.248    -.0010504    .0002721               23  |  -.0020724    .000337    -6.15   0.000    -.0027337   -.0014112               24  |  -.0015277    .000337    -4.53   0.000     -.002189   -.0008665               25  |   .0016399    .000337     4.87   0.000     .0009786    .0023011               26  |  -.0011828    .000337    -3.51   0.000    -.0018441   -.0005216               27  |  -.0012708    .000337    -3.77   0.000     -.001932   -.0006096               28  |   .0004139    .000337     1.23   0.220    -.0002473    .0010752               29  |  -.0009446    .000337    -2.80   0.005    -.0016058   -.0002834               30  |   .0002965    .000337     0.88   0.379    -.0003647    .0009577               31  |   .0004801    .000337     1.42   0.155    -.0001811    .0011413               32  |  -.0006448    .000337    -1.91   0.056     -.001306    .0000164               33  |  -.0005403    .000337    -1.60   0.109    -.0012016    .0001209               34  |   .0006858    .000337     2.03   0.042     .0000246    .0013471               35  |  -.0024695    .000337    -7.33   0.000    -.0031307   -.0018083               36  |   .0004838    .000337     1.44   0.151    -.0001774     .001145               37  |  -.0012028    .000337    -3.57   0.000     -.001864   -.0005416               38  |   .0000357    .000337     0.11   0.916    -.0006255     .000697               39  |   .0003739    .000337     1.11   0.268    -.0002873    .0010351               40  |  -.0026394    .000337    -7.83   0.000    -.0033007   -.0019782               41  |  -.0019212    .000337    -5.70   0.000    -.0025824     -.00126               42  |   .0004942    .000337     1.47   0.143     -.000167    .0011554               44  |   .0006863    .000337     2.04   0.042     .0000251    .0013476               45  |   .0011171    .000337     3.31   0.001     .0004559    .0017783               46  |  -.0011357    .000337    -3.37   0.001    -.0017969   -.0004745               47  |  -.0000664    .000337    -0.20   0.844    -.0007276    .0005948               48  |  -.0004354    .000337    -1.29   0.197    -.0010966    .0002258               49  |  -.0021941    .000337    -6.51   0.000    -.0028553   -.0015329               50  |   .0010612    .000337     3.15   0.002        .0004    .0017224               51  |   -.001372    .000337    -4.07   0.000    -.0020332   -.0007108               53  |  -.0007298    .000337    -2.17   0.031     -.001391   -.0000685               54  |  -.0032287    .000337    -9.58   0.000      -.00389   -.0025675               55  |   6.24e-06    .000337     0.02   0.985     -.000655    .0006675               56  |  -.0010164    .000337    -3.02   0.003    -.0016776   -.0003552                   |             _cons |    1.50572   .0128329   117.33   0.000     1.480544    1.530896 -----------------------------------------------------------------------------------  . predict residual (option xb assumed; fitted values)

    Then my difference in difference model on the detrended y yields a significant negative effect of the policy (post coef = -.0386):

    Code:
     
     . reg residual x1 x2 x3 x4 x5 x6 post i.stateFIPS i.qtr note: x2 omitted because of collinearity note: x6 omitted because of collinearity note: 11.stateFIPS omitted because of collinearity note: 55.stateFIPS omitted because of collinearity note: 56.stateFIPS omitted because of collinearity        Source |       SS           df       MS      Number of obs   =     1,377 -------------+----------------------------------   F(78, 1298)     =    133.01        Model |  90.7949725        78  1.16403811   Prob > F        =    0.0000     Residual |  11.3592347     1,298  .008751336   R-squared       =    0.8888 -------------+----------------------------------   Adj R-squared   =    0.8821        Total |  102.154207     1,376  .074239976   Root MSE        =    .09355  ------------------------------------------------------------------------------     residual |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval] -------------+----------------------------------------------------------------           x1 |   .0035849   .0039518     0.91   0.364    -.0041676    .0113375           x2 |          0  (omitted)           x3 |   .0118283   .0034257     3.45   0.001     .0051077    .0185488           x4 |  -2.731964   .3172617    -8.61   0.000    -3.354366   -2.109562           x5 |  -.0938331   .0106236    -8.83   0.000    -.1146744   -.0729917           x6 |          0  (omitted)         post |  -.0386808   .0099583    -3.88   0.000    -.0582169   -.0191447              |    stateFIPS |           2  |  -.2268543   .0370268    -6.13   0.000    -.2994932   -.1542154           4  |  -.3231626   .0750945    -4.30   0.000    -.4704826   -.1758427           5  |   .3593828   .0456977     7.86   0.000     .2697333    .4490323           6  |  -1.099535   .1196842    -9.19   0.000    -1.334331   -.8647392           8  |  -.8164939    .095571    -8.54   0.000    -1.003984   -.6290034           9  |  -.4645109   .0411922   -11.28   0.000    -.5453214   -.3837004          10  |  -.9502182   .0229396   -41.42   0.000    -.9952209   -.9052155          11  |          0  (omitted)          12  |  -.3138271     .02854   -11.00   0.000    -.3698166   -.2578376          13  |  -.1578921   .0400929    -3.94   0.000    -.2365462   -.0792381          15  |  -.4124152   .0352231   -11.71   0.000    -.4815156   -.3433147          16  |  -.1337408   .0378564    -3.53   0.000    -.2080073   -.0594743          17  |  -.4724284   .0507404    -9.31   0.000    -.5719705   -.3728862          18  |   .4740916   .0421783    11.24   0.000     .3913465    .5568367          19  |   .2522985   .0275205     9.17   0.000     .1983089    .3062881          20  |  -.3061665   .0467358    -6.55   0.000    -.3978525   -.2144804          21  |   .4305158   .0350614    12.28   0.000     .3617327     .499299          22  |   .2269841   .0399822     5.68   0.000     .1485473    .3054208          23  |   .3208386   .0372314     8.62   0.000     .2477983    .3938789          24  |  -.3060908    .059287    -5.16   0.000    -.4223997    -.189782          25  |   -1.05629   .0619034   -17.06   0.000    -1.177732   -.9348483          26  |  -.0326161   .0244002    -1.34   0.182    -.0804842    .0152521          27  |  -.2442294   .0537343    -4.55   0.000     -.349645   -.1388139          28  |  -.1595395    .030748    -5.19   0.000    -.2198607   -.0992184          29  |   .2018182    .021303     9.47   0.000     .1600261    .2436103          30  |  -.1746438   .0237416    -7.36   0.000    -.2212199   -.1280676          31  |  -.4193474   .0429293    -9.77   0.000    -.5035658    -.335129          32  |   -.221543   .0396223    -5.59   0.000    -.2992738   -.1438123          33  |  -.2716373   .0304933    -8.91   0.000    -.3314588   -.2118158          34  |  -.5154921   .0345198   -14.93   0.000    -.5832128   -.4477714          35  |  -.0600308   .0575068    -1.04   0.297    -.1728472    .0527856          36  |   -.681392   .0550147   -12.39   0.000    -.7893194   -.5734646          37  |  -.3158125   .0542029    -5.83   0.000    -.4221473   -.2094776          38  |  -.3476213   .0388321    -8.95   0.000    -.4238019   -.2714407          39  |   .1349002   .0395289     3.41   0.001     .0573527    .2124478          40  |   .2245536   .0241773     9.29   0.000     .1771228    .2719844          41  |  -.3779333   .0744882    -5.07   0.000    -.5240638   -.2318028          42  |   .2885267   .0605207     4.77   0.000     .1697977    .4072557          44  |  -.6484624   .0415649   -15.60   0.000    -.7300042   -.5669206          45  |  -.4069094   .0286922   -14.18   0.000    -.4631975   -.3506213          46  |   .2403485   .0228723    10.51   0.000     .1954778    .2852193          47  |   .1612768   .0307361     5.25   0.000      .100979    .2215746          48  |  -.7860045    .073861   -10.64   0.000    -.9309044   -.6411046          49  |  -.3052601   .0805196    -3.79   0.000    -.4632229   -.1472973          50  |  -.2701797    .023664   -11.42   0.000    -.3166035   -.2237559          51  |  -.4430127   .0694176    -6.38   0.000    -.5791958   -.3068297          53  |  -.6836086   .0840446    -8.13   0.000    -.8484866   -.5187305          54  |    1.05769   .1030456    10.26   0.000     .8555356    1.259844          55  |          0  (omitted)          56  |          0  (omitted)              |          qtr |           2  |  -.0016093   .0185319    -0.09   0.931    -.0379651    .0347466           3  |  -.0043002   .0185427    -0.23   0.817    -.0406771    .0320767           4  |  -.0071332   .0186285    -0.38   0.702    -.0436786    .0294121           5  |  -.0100458   .0188005    -0.53   0.593    -.0469286    .0268369           6  |  -.0153749   .0188762    -0.81   0.416    -.0524062    .0216563           7  |  -.0184755   .0190116    -0.97   0.331    -.0557723    .0188214           8  |  -.0254947    .019144    -1.33   0.183    -.0630511    .0120618           9  |  -.0335697   .0192495    -1.74   0.081    -.0713332    .0041938          10  |  -.0422743    .019455    -2.17   0.030     -.080441   -.0041076          11  |  -.0495603   .0197447    -2.51   0.012    -.0882952   -.0108253          12  |  -.0590254   .0201436    -2.93   0.003    -.0985429   -.0195078          13  |  -.0701244   .0205911    -3.41   0.001    -.1105199    -.029729          14  |  -.0822513   .0210276    -3.91   0.000    -.1235031   -.0409995          15  |  -.0938398   .0215002    -4.36   0.000    -.1360187    -.051661          16  |  -.1078958   .0219422    -4.92   0.000    -.1509418   -.0648497          17  |  -.1230193   .0223146    -5.51   0.000     -.166796   -.0792426          18  |  -.1384379   .0226342    -6.12   0.000    -.1828415   -.0940344          19  |  -.1545704   .0230916    -6.69   0.000    -.1998714   -.1092694          20  |  -.1688398   .0235017    -7.18   0.000    -.2149454   -.1227343          21  |  -.1872645    .023678    -7.91   0.000    -.2337158   -.1408132          22  |  -.2074262   .0237811    -8.72   0.000    -.2540799   -.1607726          23  |  -.2277191   .0239327    -9.51   0.000      -.27467   -.1807682          24  |  -.2495076   .0241732   -10.32   0.000    -.2969304   -.2020848          25  |    -.26958   .0247675   -10.88   0.000    -.3181688   -.2209912          26  |  -.2922181   .0252109   -11.59   0.000    -.3416767   -.2427595          27  |   -.316041   .0254653   -12.41   0.000    -.3659987   -.2660834              |        _cons |   4.240146   .3139534    13.51   0.000     3.624234    4.856057 ------------------------------------------------------------------------------

    Is this correct? I would greatly appreciate any help.
    Sincerely,
    Sumedha.

  • #2
    This type of modeling does not direct itself to your stated concern. You have a downward largely linear trend in each state (or most of them), but with differing slopes. But your model doesn't touch that: your model tries to deal with a single quadratic trend applied to all states!

    I would do this as a mixed-effects model with a random slope at the state level. Something like this:

    Code:
    mixed y c.qtr x1-x6 i.policy_in_effect || stateFIPS: qtr
    where policy_in_effect is 1 in those observations where that state has already adopted the policy, and 0 in any observation where the state has not yet adopted the policy (and maybe never will). Perhaps this is the same as the variable post you already have but didn't describe.

    Added: Also, it looks like your outcome variable is a rate of poisonings. If you have in your data not just the rate but the actual numerator and denominator, you might be better off using a Poisson model with -mepoisson- instead of -mixed-, the numerator as the outcome, and the denominator as the -exposure()- option.
    Last edited by Clyde Schechter; 18 Jun 2019, 18:05.

    Comment


    • #3
      Thank you Prof. Schechter for your response. I was not aware of the mixed-effects model and thank you for bringing it to my attention. From what I understand from the help file, mixed-effects model is a random effects model. But for my generalized diff-in-diff model (you rightly noted that the post variable is the generalized diff-in-diff estimate of the policy I want to evaluate), I want to include state and quarter fixed effects. So a regression like:

      Code:
      local controlvars x1 x2 x3 x4 x5 x6
      
      reg y post `controlvars'  i.qtr i.stateFIPS   [weight=popestimate],    vce(cluster stateFIPS)
      But because of the downward state-specific trend in y, my post is going to overestimate the effect of the policy. Can you please help me understand what the mixed effects regression is equivalent to using the 'reg' command. That way I can follow how it controlling for the state specific time trends in y. I am sorry for not following it right away and would greatly appreciate your clarification.

      Sincerely,
      Sumedha.

      P.S. I unfortunately don't have an actual rate. I can calculate the rate artifically using state population estimates but those will also seem to be declining due to the downward trend in the numerator (y).

      Comment


      • #4
        Can you please help me understand what the mixed effects regression is equivalent to using the 'reg' command.
        They are not equivalent.

        If you want to do this using fixed-effects modeling, it would look like this:

        Code:
        xtset stateFIPS qrtr
        xtreg i.stateFIPS##c.qrtr x1-x6 i.policy_in_effect, fe
        The i.stateFIPS##c.qrtr term will detrend the data separately in each state (and also generate a lot of output you will want to ignore). If you feel it is necessary to also adjust for quarterly shocks on top of detrending, then add i.qrtr to the model as well. This would be the closest analog to the mixed effects model I suggested in #2.

        Comment

        Working...
        X