------------------------------------------------------------------------------- log: /afs/uncg.edu/html/bae/people/rosenbaum/643/lab5.log log type: text opened on: 20 Sep 2006, 12:55:52 . . /*********************************************************** > LAB5.DO is a STATA do-file that for Lab 5, which runs > differences in differences and fixed effect models. > - written by Dan Rosenbaum, 2006 > > Located at my web-site for this course > (http://www.uncg.edu/bae/people/rosenbaum) is a file > containing state-level means for various groups > of single women from the 1985-1997 March CPS. The file is > named welfare.raw and is stored space-delimited ASCII. > Here is a short description of the variables in the order > that they are found in the data. > > YEAR = four-digit year > STATE = state of residence, alphabetical order (1-51) > STCODE = state of residence, postal abbreviation > KIDS = 1 if single mothers, 0 otherwise > BEYONDHS = 1 if more than a high school education, 0 otherwise > HOURS = average hours worked last year > UR = state unemployment rate (in percentage points) > WELFARE = average AFDC and Food Stamp benefits in 1996 dollars > per year > TAXES = average federal and state income taxes in 1996 dollars > per year > POP = population of group > **********************************************************/ . . /*********************************************************** > Here I change the matsize (short for matrix size, I believe, > to allow more variables to be read into STATA). > > Note also that "set mem 200m" sets RAM allocation equal > to 200 MB in case you every get an error message that says > that you need more memory. > ***********************************************************/ . . set matsize 100 . . /*********************************************************** > Here I read in the data and keep only the observations > from 1984-1986 and 1988-1990. > ***********************************************************/ . . infile year state str2 stcode kids beyondhs hours ur welfare taxes pop /// > using welfare (2652 observations read) . drop if year>1990 | year==1987 (1428 observations deleted) . sum Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- year | 1224 1987 2.16113 1984 1990 state | 1224 26 14.72562 1 51 stcode | 0 kids | 1224 .5 .5002044 0 1 beyondhs | 1224 .5 .5002044 0 1 -------------+-------------------------------------------------------- hours | 1224 1523.304 330.5826 386.7925 2544.458 ur | 1224 6.244444 2.021451 2.2 15 welfare | 1224 3779.166 3894.672 0 13047.06 taxes | 1224 2133.257 944.0152 482.228 3969.244 pop | 1224 76671.69 104566.2 1243.39 976340.8 . . /*********************************************************** > Here I regress hours onto post86 using only single > mothers with a high school education or less. > ***********************************************************/ . . gen post86=year>1986 . reg hours post86 [aweight=pop] if beyondhs==0 & kids==1 (sum of wgt is 2.2505e+07) Source | SS df MS Number of obs = 306 -------------+------------------------------ F( 1, 304) = 7.29 Model | 395007.493 1 395007.493 Prob > F = 0.0073 Residual | 16475288.6 304 54195.0282 R-squared = 0.0234 -------------+------------------------------ Adj R-squared = 0.0202 Total | 16870296.1 305 55312.4461 Root MSE = 232.8 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- post86 | 71.86772 26.62018 2.70 0.007 19.48459 124.2509 _cons | 1011.046 18.9816 53.26 0.000 973.6943 1048.398 ------------------------------------------------------------------------------ . . /*********************************************************** > Here I run differences in differences. Note that I am > restricting the sample to single women with a high > school education or less. Our key variable is the > kids86 interaction. > ***********************************************************/ . . gen kids86=kids*post86 . reg hours kids post86 kids86 [aweight=pop] if beyondhs==0 (sum of wgt is 4.7776e+07) Source | SS df MS Number of obs = 612 -------------+------------------------------ F( 3, 608) = 271.88 Model | 32515744.4 3 10838581.5 Prob > F = 0.0000 Residual | 24237905.8 608 39864.9767 R-squared = 0.5729 -------------+------------------------------ Adj R-squared = 0.5708 Total | 56753650.3 611 92886.498 Root MSE = 199.66 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- kids | -489.149 23.16681 -21.11 0.000 -534.6457 -443.6524 post86 | 12.41263 22.20859 0.56 0.576 -31.20222 56.02749 kids86 | 59.45509 32.34977 1.84 0.067 -4.075762 122.9859 _cons | 1500.195 15.98079 93.87 0.000 1468.811 1531.579 ------------------------------------------------------------------------------ . . /*********************************************************** > We can also include regressors. Here I include the > state unemployment rate and its interaction with single > mothers. > ***********************************************************/ . . gen urkids=ur*kids . reg hours kids post86 kids86 ur urkids [aweight=pop] if beyondhs==0 (sum of wgt is 4.7776e+07) Source | SS df MS Number of obs = 612 -------------+------------------------------ F( 5, 606) = 211.58 Model | 36083582.6 5 7216716.51 Prob > F = 0.0000 Residual | 20670067.7 606 34109.0226 R-squared = 0.6358 -------------+------------------------------ Adj R-squared = 0.6328 Total | 56753650.3 611 92886.498 Root MSE = 184.69 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- kids | -563.6651 74.93214 -7.52 0.000 -710.8233 -416.5069 post86 | -87.19895 24.0021 -3.63 0.000 -134.3364 -40.06155 kids86 | 79.13242 34.76217 2.28 0.023 10.86347 147.4014 ur | -55.5048 6.916931 -8.02 0.000 -69.08886 -41.92073 urkids | 11.22556 9.828826 1.14 0.254 -8.077136 30.52825 _cons | 1901.455 52.14356 36.47 0.000 1799.051 2003.859 ------------------------------------------------------------------------------ . . /*********************************************************** > Here I run the model on single women with more than a high > school education. I would expect the EITC effects to be > smaller for this group. > ***********************************************************/ . . reg hours kids post86 kids86 ur urkids [aweight=pop] if beyondhs==1 (sum of wgt is 4.6070e+07) Source | SS df MS Number of obs = 612 -------------+------------------------------ F( 5, 606) = 56.55 Model | 4679087.46 5 935817.492 Prob > F = 0.0000 Residual | 10027740.5 606 16547.4265 R-squared = 0.3182 -------------+------------------------------ Adj R-squared = 0.3125 Total | 14706827.9 611 24070.0948 Root MSE = 128.64 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- kids | -221.8902 63.17123 -3.51 0.000 -345.9513 -97.82906 post86 | 10.16309 13.93138 0.73 0.466 -17.19655 37.52274 kids86 | 11.39524 28.4688 0.40 0.689 -44.51424 67.30471 ur | -18.08752 4.182939 -4.32 0.000 -26.30233 -9.872701 urkids | 4.325498 8.387111 0.52 0.606 -12.14583 20.79683 _cons | 1938.576 30.92416 62.69 0.000 1877.845 1999.308 ------------------------------------------------------------------------------ . . /*********************************************************** > Here instead of using the interaction, I use a variable > that gives total taxes. > ***********************************************************/ . . replace taxes=taxes/1000 (1224 real changes made) . replace welfare=welfare/1000 (612 real changes made) . reg hours taxes [aweight=pop] if beyondhs==0 (sum of wgt is 4.7776e+07) Source | SS df MS Number of obs = 612 -------------+------------------------------ F( 1, 610) = 420.08 Model | 23144731.3 1 23144731.3 Prob > F = 0.0000 Residual | 33608918.9 610 55096.5884 R-squared = 0.4078 -------------+------------------------------ Adj R-squared = 0.4068 Total | 56753650.3 611 92886.498 Root MSE = 234.73 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- taxes | 215.0506 10.49245 20.50 0.000 194.4449 235.6563 _cons | 843.6298 23.77325 35.49 0.000 796.9425 890.3172 ------------------------------------------------------------------------------ . . /*********************************************************** > The regression above gives strange results if we do not > control for kids and post86. > ***********************************************************/ . . reg hours taxes kids post86 [aweight=pop] if beyondhs==0 (sum of wgt is 4.7776e+07) Source | SS df MS Number of obs = 612 -------------+------------------------------ F( 3, 608) = 275.00 Model | 32674158 3 10891386 Prob > F = 0.0000 Residual | 24079492.2 608 39604.428 R-squared = 0.5757 -------------+------------------------------ Adj R-squared = 0.5736 Total | 56753650.3 611 92886.498 Root MSE = 199.01 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- taxes | -54.92262 20.19005 -2.72 0.007 -94.57332 -15.27192 kids | -547.8484 36.53434 -15.00 0.000 -619.5973 -476.0996 post86 | 34.72669 16.23153 2.14 0.033 2.850023 66.60336 _cons | 1644.73 60.0839 27.37 0.000 1526.733 1762.727 ------------------------------------------------------------------------------ . . /*********************************************************** > Now I am going to start look at fixed effect models. First, > I clear the data and read it in again, so that I have all > of the years. I then regress hours onto my welfare variable. > ***********************************************************/ . . clear . infile year state str2 stcode kids beyondhs hours ur welfare taxes pop /// > using welfare (2652 observations read) . sum Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- year | 2652 1990 3.742363 1984 1996 state | 2652 26 14.72238 1 51 stcode | 0 kids | 2652 .5 .5000943 0 1 beyondhs | 2652 .5 .5000943 0 1 -------------+-------------------------------------------------------- hours | 2652 1517.938 336.4249 386.7925 2544.458 ur | 2652 6.125641 1.830981 2.2 15 welfare | 2652 3727.296 3840.953 0 13047.06 taxes | 2652 1995.441 1161.382 -652.0446 3969.244 pop | 2652 81211.87 108762.6 1243.39 1024355 . . reg hours welfare [aweight=pop] if beyondhs==0 & kids==1 (sum of wgt is 5.0187e+07) Source | SS df MS Number of obs = 663 -------------+------------------------------ F( 1, 661) = 56.42 Model | 2752980.15 1 2752980.15 Prob > F = 0.0000 Residual | 32253432.6 661 48794.9056 R-squared = 0.0786 -------------+------------------------------ Adj R-squared = 0.0772 Total | 35006412.8 662 52879.7776 Root MSE = 220.9 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- welfare | -.0613746 .008171 -7.51 0.000 -.0774188 -.0453304 _cons | 1509.465 61.13649 24.69 0.000 1389.42 1629.51 ------------------------------------------------------------------------------ . . /*********************************************************** > Now I add time fixed effects. > ***********************************************************/ . . xi: reg hours welfare i.year [aweight=pop] if beyondhs==0 & kids==1 i.year _Iyear_1984-1996 (naturally coded; _Iyear_1984 omitted) (sum of wgt is 5.0187e+07) Source | SS df MS Number of obs = 663 -------------+------------------------------ F( 13, 649) = 6.41 Model | 3982577.02 13 306352.079 Prob > F = 0.0000 Residual | 31023835.7 649 47802.5204 R-squared = 0.1138 -------------+------------------------------ Adj R-squared = 0.0960 Total | 35006412.8 662 52879.7776 Root MSE = 218.64 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- welfare | -.057566 .0081876 -7.03 0.000 -.0736434 -.0414887 _Iyear_1985 | -45.58863 44.71643 -1.02 0.308 -133.395 42.21772 _Iyear_1986 | -38.0661 44.00367 -0.87 0.387 -124.4728 48.34065 _Iyear_1987 | 14.15134 44.16201 0.32 0.749 -72.56634 100.869 _Iyear_1988 | 8.62195 44.19261 0.20 0.845 -78.1558 95.3997 _Iyear_1989 | 79.14077 44.25734 1.79 0.074 -7.764088 166.0456 _Iyear_1990 | 17.5488 43.69911 0.40 0.688 -68.25991 103.3575 _Iyear_1991 | -22.28003 43.20091 -0.52 0.606 -107.1105 62.55038 _Iyear_1992 | -58.10992 43.54463 -1.33 0.183 -143.6153 27.39545 _Iyear_1993 | -38.68705 43.56805 -0.89 0.375 -124.2384 46.86431 _Iyear_1994 | 14.82698 44.0031 0.34 0.736 -71.57866 101.2326 _Iyear_1995 | 63.21214 43.89783 1.44 0.150 -22.98678 149.4111 _Iyear_1996 | 67.45196 43.67919 1.54 0.123 -18.31762 153.2215 _cons | 1476.505 69.64794 21.20 0.000 1339.742 1613.267 ------------------------------------------------------------------------------ . . /*********************************************************** > Here I absorb the time fixed effects and then include > time and state fixed effects. > ***********************************************************/ . . areg hours welfare [aweight=pop] if beyondhs==0 & kids==1, absorb(year) Number of obs = 663 F( 1, 649) = 49.43 Prob > F = 0.0000 R-squared = 0.1138 Adj R-squared = 0.0960 Root MSE = 218.64 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- welfare | -.057566 .0081876 -7.03 0.000 -.0736434 -.0414887 _cons | 1481.251 61.24614 24.19 0.000 1360.986 1601.515 -------------+---------------------------------------------------------------- year | F(12, 649) = 2.144 0.013 (13 categories) . xi: areg hours welfare i.year [aweight=pop] if beyondhs==0 & kids==1, absorb( > stcode) i.year _Iyear_1984-1996 (naturally coded; _Iyear_1984 omitted) Number of obs = 663 F( 13, 599) = 5.42 Prob > F = 0.0000 R-squared = 0.5723 Adj R-squared = 0.5274 Root MSE = 158.09 ------------------------------------------------------------------------------ hours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- welfare | -.0416999 .0155774 -2.68 0.008 -.0722929 -.0111069 _Iyear_1985 | -46.14179 32.36743 -1.43 0.155 -109.7092 17.42565 _Iyear_1986 | -34.42594 31.84701 -1.08 0.280 -96.9713 28.11942 _Iyear_1987 | 22.75995 31.96097 0.71 0.477 -40.00922 85.52911 _Iyear_1988 | 15.34094 31.99564 0.48 0.632 -47.49633 78.17822 _Iyear_1989 | 82.54536 32.14093 2.57 0.010 19.42276 145.668 _Iyear_1990 | 21.52812 31.65558 0.68 0.497 -40.64128 83.69752 _Iyear_1991 | -18.69449 31.31892 -0.60 0.551 -80.20272 42.81375 _Iyear_1992 | -51.26636 31.58571 -1.62 0.105 -113.2986 10.76584 _Iyear_1993 | -26.99794 31.70583 -0.85 0.395 -89.26603 35.27015 _Iyear_1994 | 30.21423 32.07725 0.94 0.347 -32.78331 93.21177 _Iyear_1995 | 74.10623 32.22279 2.30 0.022 10.82286 137.3896 _Iyear_1996 | 77.91653 32.27185 2.41 0.016 14.53681 141.2963 _cons | 1352.373 119.8332 11.29 0.000 1117.029 1587.717 -------------+---------------------------------------------------------------- stcode | F(50, 599) = 12.846 0.000 (51 categories) . . /*********************************************************** > Here I run a random effects model. > ***********************************************************/ . . xi: xtreg hours welfare i.year if kids==1 & beyondhs==0, re i(state) i.year _Iyear_1984-1996 (naturally coded; _Iyear_1984 omitted) Random-effects GLS regression Number of obs = 663 Group variable (i): state Number of groups = 51 R-sq: within = 0.0819 Obs per group: min = 13 between = 0.0060 avg = 13.0 overall = 0.0263 max = 13 Random effects u_i ~ Gaussian Wald chi2(13) = 49.75 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ hours | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- welfare | -.0309538 .0122616 -2.52 0.012 -.0549862 -.0069215 _Iyear_1985 | -26.14742 40.43379 -0.65 0.518 -105.3962 53.10136 _Iyear_1986 | -34.33047 40.42592 -0.85 0.396 -113.5638 44.90288 _Iyear_1987 | 59.58897 40.42853 1.47 0.140 -19.6495 138.8274 _Iyear_1988 | 49.33301 40.42213 1.22 0.222 -29.89292 128.5589 _Iyear_1989 | 84.12019 40.5784 2.07 0.038 4.587996 163.6524 _Iyear_1990 | 47.4937 40.43177 1.17 0.240 -31.75111 126.7385 _Iyear_1991 | -26.60594 40.42215 -0.66 0.510 -105.8319 52.62001 _Iyear_1992 | -90.24664 40.4526 -2.23 0.026 -169.5323 -10.961 _Iyear_1993 | -18.0357 40.45766 -0.45 0.656 -97.33127 61.25986 _Iyear_1994 | 35.02884 40.56011 0.86 0.388 -44.46751 114.5252 _Iyear_1995 | 69.72376 40.68675 1.71 0.087 -10.0208 149.4683 _Iyear_1996 | 56.32859 40.61721 1.39 0.165 -23.27969 135.9369 _cons | 1352.115 101.9673 13.26 0.000 1152.262 1551.967 -------------+---------------------------------------------------------------- sigma_u | 162.84182 sigma_e | 203.46981 rho | .39043677 (fraction of variance due to u_i) ------------------------------------------------------------------------------ . . . . . . end of do-file