100 likes | 403 Views
Michigan.do. . * construct new variables; . gen mi=state==26; . * michigan dummy; . gen hike=month>=33; . * treatment period dummy; . gen treatment=hike*mi;. . * get means of smoking rates for the 2x2 box; . sort mi hike; . by mi hike: sum smoked;. . by mi hike: sum smoked;
E N D
. * construct new variables; • . gen mi=state==26; • . * michigan dummy; • . gen hike=month>=33; • . * treatment period dummy; • . gen treatment=hike*mi;
. * get means of smoking rates for the 2x2 box; • . sort mi hike; • . by mi hike: sum smoked;
. by mi hike: sum smoked; • ------------------------------------------------------------------------------- • -> mi = 0, hike = 0 • Variable | Obs Mean Std. Dev. Min Max • -------------+-------------------------------------------------------- • smoked | 26441 .1950002 .3962083 0 1 • ------------------------------------------------------------------------------- • -> mi = 0, hike = 1 • Variable | Obs Mean Std. Dev. Min Max • -------------+-------------------------------------------------------- • smoked | 18852 .1827923 .3865064 0 1 • ------------------------------------------------------------------------------- • -> mi = 1, hike = 0 • Variable | Obs Mean Std. Dev. Min Max • -------------+-------------------------------------------------------- • smoked | 17790 .1957279 .3967712 0 1 • ------------------------------------------------------------------------------- • -> mi = 1, hike = 1 • Variable | Obs Mean Std. Dev. Min Max • -------------+-------------------------------------------------------- • smoked | 12943 .1783203 .382797 0 1
. * now run the regression; • . reg smoked mi hike treatment; • Source | SS df MS Number of obs = 76026 • -------------+------------------------------ F( 3, 76022) = 8.59 • Model | 3.95288903 3 1.31762968 Prob > F = 0.0000 • Residual | 11663.5888 76022 .153423862 R-squared = 0.0003 • -------------+------------------------------ Adj R-squared = 0.0003 • Total | 11667.5417 76025 .153469803 Root MSE = .39169 • ------------------------------------------------------------------------------ • smoked | Coef. Std. Err. t P>|t| [95% Conf. Interval] • -------------+---------------------------------------------------------------- • mi | .0007277 .0037982 0.19 0.848 -.0067168 .0081723 • hike | -.0122079 .0037337 -3.27 0.001 -.019526 -.0048898 • treatment | -.0051997 .0058668 -0.89 0.375 -.0166985 .0062991 • _cons | .1950002 .0024088 80.95 0.000 .1902789 .1997215 • ------------------------------------------------------------------------------ Notice the estimate for treatment is arithmetically Identical to the number from the 2x2 box
. * now control for observed characteristics; • . * generate dummy variables to control for race, parity, education and age; • . xi i.age i.mrace3 i.meduc6 i.ageg; • . * add these variables to the model; • . reg smoked mi hike treatment _I*;
. reg smoked mi hike treatment _I*; • Source | SS df MS Number of obs = 76026 • -------------+------------------------------ F( 15, 76010) = 474.06 • Model | 998.136229 15 66.5424153 Prob > F = 0.0000 • Residual | 10669.4055 76010 .140368445 R-squared = 0.0855 • -------------+------------------------------ Adj R-squared = 0.0854 • Total | 11667.5417 76025 .153469803 Root MSE = .37466 • ------------------------------------------------------------------------------ • smoked | Coef. Std. Err. t P>|t| [95% Conf. Interval] • -------------+---------------------------------------------------------------- • mi | -.0039841 .0036501 -1.09 0.275 -.0111382 .00317 • hike | -.0030636 .0035745 -0.86 0.391 -.0100696 .0039424 • treatment | -.0051552 .0056122 -0.92 0.358 -.0161551 .0058447 • _Iageg_2 | .105199 .0052283 20.12 0.000 .0949516 .1154464 • Delete some results • _Imeduc6_6 | .0156193 .0145937 1.07 0.284 -.0129844 .044223 • _cons | .1476714 .0092008 16.05 0.000 .1296378 .165705 • ------------------------------------------------------------------------------
. * now control for all time periods and all states; • . * need to define time and state dummies; • . * in the regression, drop the mi and hike variables; • . xi i.age i.mrace3 i.meduc6 i.ageg i.state i.month; • . reg smoked treatment _I*;
. reg smoked treatment _I*; • Source | SS df MS Number of obs = 76026 • -------------+------------------------------ F( 70, 75955) = 102.48 • Model | 1006.80931 70 14.3829901 Prob > F = 0.0000 • Residual | 10660.7324 75955 .140355901 R-squared = 0.0863 • -------------+------------------------------ Adj R-squared = 0.0854 • Total | 11667.5417 76025 .153469803 Root MSE = .37464 • ------------------------------------------------------------------------------ • smoked | Coef. Std. Err. t P>|t| [95% Conf. Interval] • -------------+---------------------------------------------------------------- • treatment | -.0053194 .0056134 -0.95 0.343 -.0163216 .0056828 • _Iageg_2 | .1051191 .0052311 20.10 0.000 .0948663 .115372 • Delete some results • _Istate_26 | -.0046835 .0051651 -0.91 0.365 -.0148071 .0054402 • _Istate_42 | -.0009752 .0045039 -0.22 0.829 -.0098028 .0078525 • _Imonth_2 | .0273311 .0136851 2.00 0.046 .0005083 .0541538 • Delete some results • _Imonth_3 | .0305209 .014018 2.18 0.029 .0030457 .0579961 • _Imonth_56 | .009216 .0148571 0.62 0.535 -.0199038 .0383358 • _cons | .1292655 .0138104 9.36 0.000 .1021972 .1563339 • ------------------------------------------------------------------------------