Calculation from page 142 to page 143 based on data file duncan.
use https://stats.idre.ucla.edu/stat/stata/examples/ara/duncan, clear (From Fox, Applied Regression Analysis. Use 'notes' command for source of data) regress prestige educ income Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 2, 42) = 101.22 Model | 36180.9458 2 18090.4729 Prob > F = 0.0000 Residual | 7506.69865 42 178.73092 R-squared = 0.8282 ---------+------------------------------ Adj R-squared = 0.8200 Total | 43687.6444 44 992.90101 Root MSE = 13.369 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- educ | .5458339 .0982526 5.555 0.000 .3475521 .7441158 income | .5987328 .1196673 5.003 0.000 .3572343 .8402313 _cons | -6.064663 4.271941 -1.420 0.163 -14.68579 2.556463 ------------------------------------------------------------------------------ sort occ_type by occ_type: summarize(prestige) -> occ_type= bc Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- prestige | 21 22.7619 18.05521 3 67 -> occ_type= prof Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- prestige | 18 80.44444 14.10558 45 97 -> occ_type= wc Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- prestige | 6 36.66667 11.79265 16 52 gen d1=0 gen d2=0 replace d1=1 if (occ_type==2) (18 real changes made) replace d2=1 if (occ_type==3) (6 real changes made) regress prestige income educ d1 d2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 4, 40) = 105.03 Model | 39889.6897 4 9972.42242 Prob > F = 0.0000 Residual | 3797.95474 40 94.9488686 R-squared = 0.9131 ---------+------------------------------ Adj R-squared = 0.9044 Total | 43687.6444 44 992.90101 Root MSE = 9.7442 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .5975465 .0893553 6.687 0.000 .4169527 .7781403 educ | .3453193 .1136089 3.040 0.004 .1157071 .5749315 d1 | 16.65751 6.993007 2.382 0.022 2.52412 30.79091 d2 | -14.66113 6.108774 -2.400 0.021 -27.00743 -2.314841 _cons | -.1850278 3.713771 -0.050 0.961 -7.690838 7.320782 ------------------------------------------------------------------------------ test d1 d2 ( 1) d1 = 0.0 ( 2) d2 = 0.0 F( 2, 40) = 19.53 Prob > F = 0.0000
Calculation on page 150, Table 7.1 and Table 7.2 on page 151 based on data file duncan. In Table 7.2, the column of Sum of Squares come from the difference between the sum of squares of the models contrasted. The results from Stata for F-values in Table 7.2 is different from the book since the degree of freedom for residuals used in calculating the F-values is always 36 in the book whereas in Stata it depends on different models.
gen incd1=income*d1 gen incd2=income*d2 gen edud1=educ*d1 gen edud2=educ*d2 regress prestige income educ d1 d2 incd1 edud1 incd2 edud2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 8, 36) = 54.17 Model | 40336.9993 8 5042.12491 Prob > F = 0.0000 Residual | 3350.64519 36 93.0734776 R-squared = 0.9233 ---------+------------------------------ Adj R-squared = 0.9063 Total | 43687.6444 44 992.90101 Root MSE = 9.6475 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .7834109 .1307364 5.992 0.000 .5182653 1.048557 educ | .3196229 .2797922 1.142 0.261 -.247822 .8870677 d1 | 32.00781 14.10923 2.269 0.029 3.39296 60.62265 d2 | -7.043203 20.63835 -0.341 0.735 -48.89971 34.81331 incd1 | -.3691426 .2038801 -1.811 0.079 -.7826306 .0443455 edud1 | .0185911 .3183687 0.058 0.954 -.6270905 .6642727 incd2 | -.3603084 .2595728 -1.388 0.174 -.8867465 .1661297 edud2 | .1067709 .3621628 0.295 0.770 -.6277293 .8412711 _cons | -3.950543 6.794024 -0.581 0.565 -17.72946 9.828376 ------------------------------------------------------------------------------ regress prestige income educ d1 d2 incd1 incd2 edud1 edud2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 8, 36) = 54.17 Model | 40336.9993 8 5042.12491 Prob > F = 0.0000 Residual | 3350.64519 36 93.0734776 R-squared = 0.9233 ---------+------------------------------ Adj R-squared = 0.9063 Total | 43687.6444 44 992.90101 Root MSE = 9.6475 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .7834109 .1307364 5.992 0.000 .5182653 1.048557 educ | .3196229 .2797922 1.142 0.261 -.247822 .8870677 d1 | 32.00781 14.10923 2.269 0.029 3.39296 60.62265 d2 | -7.043203 20.63835 -0.341 0.735 -48.89971 34.81331 incd1 | -.3691426 .2038801 -1.811 0.079 -.7826306 .0443455 incd2 | -.3603084 .2595728 -1.388 0.174 -.8867465 .1661297 edud1 | .0185911 .3183687 0.058 0.954 -.6270905 .6642727 edud2 | .1067709 .3621628 0.295 0.770 -.6277293 .8412711 _cons | -3.950543 6.794024 -0.581 0.565 -17.72946 9.828376 ------------------------------------------------------------------------------ testparm edud1 edud2 ( 1) edud1 = 0.0 ( 2) edud2 = 0.0 F( 2, 36) = 0.06 Prob > F = 0.9399 testparm incd1 incd2 ( 1) incd1 = 0.0 ( 2) incd2 = 0.0 F( 2, 36) = 2.00 Prob > F = 0.1502 regress prestige income educ d1 d2 edud1 edud2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 6, 38) = 67.99 Model | 39964.8263 6 6660.80439 Prob > F = 0.0000 Residual | 3722.81811 38 97.9688976 R-squared = 0.9148 ---------+------------------------------ Adj R-squared = 0.9013 Total | 43687.6444 44 992.90101 Root MSE = 9.8979 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .5968503 .0939507 6.353 0.000 .406657 .7870436 educ | .4843067 .2743359 1.765 0.086 -.0710574 1.039671 d1 | 26.56871 13.97144 1.902 0.065 -1.714991 54.85241 d2 | -17.30707 17.34143 -0.998 0.325 -52.41295 17.79881 edud1 | -.2172445 .3015031 -0.721 0.476 -.8276055 .3931165 edud2 | -.0384071 .3634739 -0.106 0.916 -.7742216 .6974073 _cons | -3.689497 6.969121 -0.529 0.600 -17.79774 10.41875 ------------------------------------------------------------------------------ testparm income ( 1) income = 0.0 F( 1, 38) = 40.36 Prob > F = 0.0000 regress prestige income educ d1 d2 incd1 incd2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 6, 38) = 75.96 Model | 40325.4393 6 6720.90655 Prob > F = 0.0000 Residual | 3362.20513 38 88.4790824 R-squared = 0.9230 ---------+------------------------------ Adj R-squared = 0.9109 Total | 43687.6444 44 992.90101 Root MSE = 9.4063 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .7761539 .1181297 6.570 0.000 .5370128 1.015295 educ | .3572765 .1125671 3.174 0.003 .1293962 .5851567 d1 | 31.71204 10.1657 3.120 0.003 11.13265 52.29142 d2 | -1.637165 13.22173 -0.124 0.902 -28.40317 25.12884 incd1 | -.3697649 .183357 -2.017 0.051 -.7409517 .0014219 incd2 | -.3604304 .2486993 -1.449 0.155 -.8638958 .143035 _cons | -4.731993 4.157457 -1.138 0.262 -13.14832 3.684338 ------------------------------------------------------------------------------ test educ ( 1) educ = 0.0 F( 1, 38) = 10.07 Prob > F = 0.0030 regress prestige income educ d1 d2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 4, 40) = 105.03 Model | 39889.6897 4 9972.42242 Prob > F = 0.0000 Residual | 3797.95474 40 94.9488686 R-squared = 0.9131 ---------+------------------------------ Adj R-squared = 0.9044 Total | 43687.6444 44 992.90101 Root MSE = 9.7442 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .5975465 .0893553 6.687 0.000 .4169527 .7781403 educ | .3453193 .1136089 3.040 0.004 .1157071 .5749315 d1 | 16.65751 6.993007 2.382 0.022 2.52412 30.79091 d2 | -14.66113 6.108774 -2.400 0.021 -27.00743 -2.314841 _cons | -.1850278 3.713771 -0.050 0.961 -7.690838 7.320782 ------------------------------------------------------------------------------ test d1 d2 ( 1) x = 0.0 ( 2) x1 = 0.0 F( 2, 40) = 19.53 Prob > F = 0.0000 regress prestige educ income Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 2, 42) = 101.22 Model | 36180.9458 2 18090.4729 Prob > F = 0.0000 Residual | 7506.69865 42 178.73092 R-squared = 0.8282 ---------+------------------------------ Adj R-squared = 0.8200 Total | 43687.6444 44 992.90101 Root MSE = 13.369 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- educ | .5458339 .0982526 5.555 0.000 .3475521 .7441158 income | .5987328 .1196673 5.003 0.000 .3572343 .8402313 _cons | -6.064663 4.271941 -1.420 0.163 -14.68579 2.556463 ------------------------------------------------------------------------------ regress prestige educ d1 d2 edud1 edud2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 5, 39) = 36.59 Model | 36010.99 5 7202.198 Prob > F = 0.0000 Residual | 7676.65446 39 196.837294 R-squared = 0.8243 ---------+------------------------------ Adj R-squared = 0.8018 Total | 43687.6444 44 992.90101 Root MSE = 14.03 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- educ | 1.011168 .3706646 2.728 0.010 .2614281 1.760908 d1 | 42.66032 19.47572 2.190 0.035 3.26697 82.05367 d2 | 16.21902 23.41483 0.693 0.493 -31.14193 63.57998 edud1 | -.5115146 .4222935 -1.211 0.233 -1.365684 .3426546 edud2 | -.6322738 .4978774 -1.270 0.212 -1.639326 .3747783 _cons | -2.854351 9.876664 -0.289 0.774 -22.83179 17.12309 ------------------------------------------------------------------------------ regress prestige income d1 d2 incd1 incd2 Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 5, 39) = 72.31 Model | 39434.1346 5 7886.82691 Prob > F = 0.0000 Residual | 4253.50988 39 109.064356 R-squared = 0.9026 ---------+------------------------------ Adj R-squared = 0.8902 Total | 43687.6444 44 992.90101 Root MSE = 10.443 ------------------------------------------------------------------------------ prestige | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- income | .8450123 .1289228 6.554 0.000 .5842414 1.105783 d1 | 44.48683 10.36413 4.292 0.000 23.52339 65.45027 d2 | 14.85314 13.49857 1.100 0.278 -12.45029 42.15657 incd1 | -.2909451 .2016964 -1.442 0.157 -.6989147 .1170244 incd2 | -.4674322 .2735699 -1.709 0.095 -1.02078 .0859151 _cons | 2.682804 3.81815 0.703 0.486 -5.040133 10.40574 ------------------------------------------------------------------------------