-------------------------------------------------------------------------------- log: C:\Documents and Settings\Patricia_Anderson\My Documents\ECON 20\In > Class\oct25.log log type: text opened on: 25 Oct 2002, 11:11:28 . use smoke . reg cigs income educ age, robust Regression with robust standard errors Number of obs = 807 F( 3, 803) = 3.09 Prob > F = 0.0265 R-squared = 0.0104 Root MSE = 13.675 ------------------------------------------------------------------------------ | Robust cigs | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0001171 .0000536 2.18 0.029 .0000118 .0002224 educ | -.3775954 .1653381 -2.28 0.023 -.7021413 -.0530496 age | -.0416932 .0238304 -1.75 0.081 -.0884706 .0050841 _cons | 12.85394 2.38822 5.38 0.000 8.166053 17.54184 ------------------------------------------------------------------------------ . reg cigs income educ age agesq, robust Regression with robust standard errors Number of obs = 807 F( 4, 802) = 13.81 Prob > F = 0.0000 R-squared = 0.0442 Root MSE = 13.448 ------------------------------------------------------------------------------ | Robust cigs | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0000406 .0000538 0.75 0.451 -.0000651 .0001463 educ | -.5052437 .1642086 -3.08 0.002 -.8275732 -.1829143 age | .7954476 .1402336 5.67 0.000 .5201793 1.070716 agesq | -.0092679 .0014853 -6.24 0.000 -.0121835 -.0063523 _cons | -.1541676 3.235243 -0.05 0.962 -6.504712 6.196376 ------------------------------------------------------------------------------ . test age agesq ( 1) age = 0.0 ( 2) agesq = 0.0 F( 2, 802) = 24.07 Prob > F = 0.0000 . **estimate model . reg cigs income educ age agesq Source | SS df MS Number of obs = 807 -------------+------------------------------ F( 4, 802) = 9.27 Model | 6705.89914 4 1676.47479 Prob > F = 0.0000 Residual | 145047.784 802 180.857586 R-squared = 0.0442 -------------+------------------------------ Adj R-squared = 0.0394 Total | 151753.683 806 188.280003 Root MSE = 13.448 ------------------------------------------------------------------------------ cigs | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0000406 .0000568 0.71 0.475 -.000071 .0001521 educ | -.5052437 .1685298 -3.00 0.003 -.8360553 -.1744322 age | .7954476 .1597405 4.98 0.000 .4818887 1.109006 agesq | -.0092679 .0017405 -5.32 0.000 -.0126844 -.0058514 _cons | -.1541676 3.519319 -0.04 0.965 -7.062331 6.753996 ------------------------------------------------------------------------------ . **get residuals . predict uhat, r . **square them to get a variance estimate . gen uhatsq=uhat^2 . **want to run a log model . gen lnuhatsq=ln(uhatsq) . reg lnuhatsq income educ age agesq Source | SS df MS Number of obs = 807 -------------+------------------------------ F( 4, 802) = 58.39 Model | 480.683715 4 120.170929 Prob > F = 0.0000 Residual | 1650.43545 802 2.05789956 R-squared = 0.2256 -------------+------------------------------ Adj R-squared = 0.2217 Total | 2131.11916 806 2.64406844 Root MSE = 1.4345 ------------------------------------------------------------------------------ lnuhatsq | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0000145 6.06e-06 2.38 0.017 2.56e-06 .0000264 educ | -.0897424 .0179771 -4.99 0.000 -.1250302 -.0544546 age | .2071226 .0170396 12.16 0.000 .1736752 .24057 agesq | -.0024545 .0001857 -13.22 0.000 -.0028189 -.00209 _cons | 1.423476 .375407 3.79 0.000 .6865796 2.160372 ------------------------------------------------------------------------------ . **get predicted ln variance . predict ghat (option xb assumed; fitted values) . **need to exponentiate . gen hhat=exp(ghat) . *rerun model using WLS . reg cigs income educ age agesq [w=1/hhat] (analytic weights assumed) (sum of wgt is 1.9675e+01) Source | SS df MS Number of obs = 807 -------------+------------------------------ F( 4, 802) = 21.56 Model | 9044.04632 4 2261.01158 Prob > F = 0.0000 Residual | 84094.4307 802 104.855899 R-squared = 0.0971 -------------+------------------------------ Adj R-squared = 0.0926 Total | 93138.477 806 115.556423 Root MSE = 10.24 ------------------------------------------------------------------------------ cigs | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0001218 .000042 2.90 0.004 .0000395 .0002042 educ | -.5394262 .1229404 -4.39 0.000 -.7807491 -.2981034 age | .4153371 .0958882 4.33 0.000 .2271156 .6035587 agesq | -.0048907 .0009011 -5.43 0.000 -.0066595 -.003122 _cons | 4.996887 2.430517 2.06 0.040 .2259619 9.767813 ------------------------------------------------------------------------------ . reg cigs income educ age agesq,robust Regression with robust standard errors Number of obs = 807 F( 4, 802) = 13.81 Prob > F = 0.0000 R-squared = 0.0442 Root MSE = 13.448 ------------------------------------------------------------------------------ | Robust cigs | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0000406 .0000538 0.75 0.451 -.0000651 .0001463 educ | -.5052437 .1642086 -3.08 0.002 -.8275732 -.1829143 age | .7954476 .1402336 5.67 0.000 .5201793 1.070716 agesq | -.0092679 .0014853 -6.24 0.000 -.0121835 -.0063523 _cons | -.1541676 3.235243 -0.05 0.962 -6.504712 6.196376 ------------------------------------------------------------------------------ . *do WLS with robust std errors . reg cigs income educ age agesq [w=1/hhat], robust (analytic weights assumed) (sum of wgt is 1.9675e+01) Regression with robust standard errors Number of obs = 807 F( 4, 802) = 25.91 Prob > F = 0.0000 R-squared = 0.0971 Root MSE = 10.24 ------------------------------------------------------------------------------ | Robust cigs | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0001218 .0000648 1.88 0.060 -5.33e-06 .000249 educ | -.5394262 .1900021 -2.84 0.005 -.9123864 -.1664661 age | .4153371 .111767 3.72 0.000 .1959467 .6347275 agesq | -.0048907 .001122 -4.36 0.000 -.0070931 -.0026883 _cons | 4.996887 3.135511 1.59 0.111 -1.15789 11.15166 ------------------------------------------------------------------------------ . use wage2, clear . reg lwage educ exper Source | SS df MS Number of obs = 935 -------------+------------------------------ F( 2, 932) = 70.16 Model | 21.6776647 2 10.8388324 Prob > F = 0.0000 Residual | 143.97863 932 .154483508 R-squared = 0.1309 -------------+------------------------------ Adj R-squared = 0.1290 Total | 165.656294 934 .177362199 Root MSE = .39304 ------------------------------------------------------------------------------ lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- educ | .077782 .0065769 11.83 0.000 .0648748 .0906892 exper | .0197768 .0033025 5.99 0.000 .0132956 .026258 _cons | 5.502709 .112037 49.12 0.000 5.282835 5.722584 ------------------------------------------------------------------------------ . reg lwage educ exper IQ Source | SS df MS Number of obs = 935 -------------+------------------------------ F( 3, 931) = 60.10 Model | 26.876773 3 8.95892434 Prob > F = 0.0000 Residual | 138.779521 931 .149065007 R-squared = 0.1622 -------------+------------------------------ Adj R-squared = 0.1595 Total | 165.656294 934 .177362199 Root MSE = .38609 ------------------------------------------------------------------------------ lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- educ | .057108 .007348 7.77 0.000 .0426876 .0715285 exper | .0195249 .0032444 6.02 0.000 .0131579 .025892 IQ | .0057856 .0009797 5.91 0.000 .003863 .0077082 _cons | 5.198085 .1215426 42.77 0.000 4.959556 5.436614 ------------------------------------------------------------------------------ . log close log: C:\Documents and Settings\Patricia_Anderson\My Documents\ECON 20\I > nClass\oct25.log log type: text closed on: 25 Oct 2002, 12:23:47 -------------------------------------------------------------------------------