The data files used for the examples in this text can be downloaded in a zip file from the Stata Web site. You can then use a program such as zip to unzip the data files.
Example 4.1 on page 59 using the data set mroz.dta.
use mroz, clear
reg lwage exper expersq educ age kidslt6 kidsge6
Source | SS df MS Number of obs = 428
-------------+------------------------------ F( 6, 421) = 13.19
Model | 35.3398089 6 5.88996815 Prob > F = 0.0000
Residual | 187.987632 421 .446526442 R-squared = 0.1582
-------------+------------------------------ Adj R-squared = 0.1462
Total | 223.327441 427 .523015084 Root MSE = .66823
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .039819 .013393 2.97 0.003 .0134936 .0661444
expersq | -.0007812 .0004022 -1.94 0.053 -.0015718 9.37e-06
educ | .1078319 .0144021 7.49 0.000 .079523 .1361409
age | -.0014653 .0052925 -0.28 0.782 -.0118682 .0089377
kidslt6 | -.0607106 .0887626 -0.68 0.494 -.2351836 .1137625
kidsge6 | -.014591 .0278981 -0.52 0.601 -.069428 .0402459
_cons | -.4209078 .316905 -1.33 0.185 -1.043821 .2020053
------------------------------------------------------------------------------
test age kidslt6 kidsge6
( 1) age = 0
( 2) kidslt6 = 0
( 3) kidsge6 = 0
F( 3, 421) = 0.24
Prob > F = 0.8705
reg lwage exper expersq educ age kidslt6 kidsge6, robust
Regression with robust standard errors Number of obs = 428
F( 6, 421) = 13.78
Prob > F = 0.0000
R-squared = 0.1582
Root MSE = .66823
------------------------------------------------------------------------------
| Robust
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .039819 .0152578 2.61 0.009 .0098281 .06981
expersq | -.0007812 .0004097 -1.91 0.057 -.0015865 .0000241
educ | .1078319 .0136235 7.92 0.000 .0810533 .1346106
age | -.0014653 .0059351 -0.25 0.805 -.0131313 .0102008
kidslt6 | -.0607106 .1061006 -0.57 0.567 -.2692635 .1478423
kidsge6 | -.014591 .0293505 -0.50 0.619 -.0722829 .0431009
_cons | -.4209078 .3183346 -1.32 0.187 -1.046631 .2048154
------------------------------------------------------------------------------
The command above shows how to get robust standard errors for the parameter estimates. There is a discrepency between the results here and the results in the book. This is because that Stata does finite sample correction to the standard error. We can convert the robust standard error shown in the book to the results above by multiplying the robust standard error in the book with sqrt(N/(N-k)), where N is the total number of observations and k is the degree of freedom of the model. For example, the robust standard error for the intercept in the book is .316. We can convert it to the robust standard error shown in the table above as follows.
di .316*(428/(428-6))^.5 .31823852
We show how to get LM statistic and LM test below following the description of the process in the book.
reg lwage exper expersq educ
Source | SS df MS Number of obs = 428
-------------+------------------------------ F( 3, 424) = 26.29
Model | 35.0222967 3 11.6740989 Prob > F = 0.0000
Residual | 188.305144 424 .444115906 R-squared = 0.1568
-------------+------------------------------ Adj R-squared = 0.1509
Total | 223.327441 427 .523015084 Root MSE = .66642
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .0415665 .0131752 3.15 0.002 .0156697 .0674633
expersq | -.0008112 .0003932 -2.06 0.040 -.0015841 -.0000382
educ | .1074896 .0141465 7.60 0.000 .0796837 .1352956
_cons | -.5220406 .1986321 -2.63 0.009 -.9124667 -.1316144
------------------------------------------------------------------------------
predict res, res
(325 missing values generated)
reg res exper expersq educ age kidslt6 kidsge6
Source | SS df MS Number of obs = 428
-------------+------------------------------ F( 6, 421) = 0.12
Model | .317512266 6 .052918711 Prob > F = 0.9942
Residual | 187.98763 421 .446526438 R-squared = 0.0017
-------------+------------------------------ Adj R-squared = -0.0125
Total | 188.305143 427 .44099565 Root MSE = .66823
------------------------------------------------------------------------------
res | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | -.0017475 .013393 -0.13 0.896 -.0280729 .0245779
expersq | .00003 .0004022 0.07 0.941 -.0007606 .0008206
educ | .0003423 .0144021 0.02 0.981 -.0279666 .0286512
age | -.0014653 .0052925 -0.28 0.782 -.0118682 .0089377
kidslt6 | -.0607106 .0887626 -0.68 0.494 -.2351836 .1137625
kidsge6 | -.014591 .0278981 -0.52 0.601 -.069428 .0402459
_cons | .1011327 .316905 0.32 0.750 -.5217804 .7240458
------------------------------------------------------------------------------
di 428*.0017
.7276
di chi2tail(3, .728)
.86659913
Example 41 (continued) on page 60.
reg lwage exper expersq educ
Source | SS df MS Number of obs = 428
-------------+------------------------------ F( 3, 424) = 26.29
Model | 35.0222967 3 11.6740989 Prob > F = 0.0000
Residual | 188.305144 424 .444115906 R-squared = 0.1568
-------------+------------------------------ Adj R-squared = 0.1509
Total | 223.327441 427 .523015084 Root MSE = .66642
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .0415665 .0131752 3.15 0.002 .0156697 .0674633
expersq | -.0008112 .0003932 -2.06 0.040 -.0015841 -.0000382
educ | .1074896 .0141465 7.60 0.000 .0796837 .1352956
_cons | -.5220406 .1986321 -2.63 0.009 -.9124667 -.1316144
------------------------------------------------------------------------------
predict u, res
(325 missing values generated)
reg age exper expersq educ
Source | SS df MS Number of obs = 753
-------------+------------------------------ F( 3, 749) = 48.91
Model | 8027.34887 3 2675.78296 Prob > F = 0.0000
Residual | 40977.8224 749 54.7100433 R-squared = 0.1638
-------------+------------------------------ Adj R-squared = 0.1605
Total | 49005.1713 752 65.1664512 Root MSE = 7.3966
------------------------------------------------------------------------------
age | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | -.1424069 .096921 -1.47 0.142 -.332676 .0478621
expersq | .016711 .0031269 5.34 0.000 .0105724 .0228496
educ | -.4363879 .1192663 -3.66 0.000 -.670524 -.2022518
_cons | 46.43838 1.521431 30.52 0.000 43.4516 49.42515
------------------------------------------------------------------------------
predict r1, res
reg kidslt6 exper expersq educ
Source | SS df MS Number of obs = 753
-------------+------------------------------ F( 3, 749) = 13.85
Model | 10.8498698 3 3.61662327 Prob > F = 0.0000
Residual | 195.599001 749 .261146864 R-squared = 0.0526
-------------+------------------------------ Adj R-squared = 0.0488
Total | 206.448871 752 .274533073 Root MSE = .51103
------------------------------------------------------------------------------
kidslt6 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | -.0145597 .0066962 -2.17 0.030 -.0277052 -.0014142
expersq | .0000493 .000216 0.23 0.819 -.0003748 .0004734
educ | .0282583 .00824 3.43 0.001 .0120821 .0444345
_cons | .0365076 .1051141 0.35 0.728 -.1698457 .2428609
------------------------------------------------------------------------------
predict r2, res
reg kidsge6 exper expersq educ
Source | SS df MS Number of obs = 753
-------------+------------------------------ F( 3, 749) = 26.14
Model | 124.144723 3 41.3815742 Prob > F = 0.0000
Residual | 1185.88981 749 1.58329747 R-squared = 0.0948
-------------+------------------------------ Adj R-squared = 0.0911
Total | 1310.03453 752 1.74206719 Root MSE = 1.2583
------------------------------------------------------------------------------
kidsge6 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | -.0221468 .0164879 -1.34 0.180 -.0545148 .0102212
expersq | -.0009084 .0005319 -1.71 0.088 -.0019526 .0001359
educ | -.0264995 .0202892 -1.31 0.192 -.06633 .013331
_cons | 2.07601 .2588212 8.02 0.000 1.567909 2.584111
------------------------------------------------------------------------------
predict r3, res
gen one = 1
gen rage = u*r1
(325 missing values generated)
gen rle6 = u*r2
(325 missing values generated)
gen rge6 = u*r3
(325 missing values generated)
reg one rage rle6 rge6, nocons
Source | SS df MS Number of obs = 428
-------------+------------------------------ F( 3, 425) = 0.17
Model | .521511721 3 .17383724 Prob > F = 0.9147
Residual | 427.478488 425 1.00583174 R-squared = 0.0012
-------------+------------------------------ Adj R-squared = -0.0058
Total | 428 428 1 Root MSE = 1.0029
------------------------------------------------------------------------------
one | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
rage | -.0028426 .0109138 -0.26 0.795 -.0242943 .018609
rle6 | -.0940857 .1710924 -0.55 0.583 -.4303782 .2422068
rge6 | -.0266196 .059492 -0.45 0.655 -.1435548 .0903155
------------------------------------------------------------------------------
di 428*0.0012 .5136 di chi2tail(3, .5136) .91589355
Example 4.3 on page 63 using nls80.dta.
use nls80, clear
reg lwage exper tenure married south urban black educ
Source | SS df MS Number of obs = 935
-------------+------------------------------ F( 7, 927) = 44.75
Model | 41.8377619 7 5.97682312 Prob > F = 0.0000
Residual | 123.818521 927 .133569063 R-squared = 0.2526
-------------+------------------------------ Adj R-squared = 0.2469
Total | 165.656283 934 .177362188 Root MSE = .36547
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .014043 .0031852 4.41 0.000 .007792 .020294
tenure | .0117473 .002453 4.79 0.000 .0069333 .0165613
married | .1994171 .0390502 5.11 0.000 .1227801 .276054
south | -.0909036 .0262485 -3.46 0.001 -.142417 -.0393903
urban | .1839121 .0269583 6.82 0.000 .1310056 .2368185
black | -.1883499 .0376666 -5.00 0.000 -.2622717 -.1144281
educ | .0654307 .0062504 10.47 0.000 .0531642 .0776973
_cons | 5.395497 .113225 47.65 0.000 5.17329 5.617704
------------------------------------------------------------------------------
reg lwage exper tenure married south urban black educ iq
Source | SS df MS Number of obs = 935
-------------+------------------------------ F( 8, 926) = 41.27
Model | 43.5360162 8 5.44200202 Prob > F = 0.0000
Residual | 122.120267 926 .131879338 R-squared = 0.2628
-------------+------------------------------ Adj R-squared = 0.2564
Total | 165.656283 934 .177362188 Root MSE = .36315
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .0141458 .0031651 4.47 0.000 .0079342 .0203575
tenure | .0113951 .0024394 4.67 0.000 .0066077 .0161825
married | .1997644 .0388025 5.15 0.000 .1236134 .2759154
south | -.0801695 .0262529 -3.05 0.002 -.1316916 -.0286473
urban | .1819463 .0267929 6.79 0.000 .1293645 .2345281
black | -.1431253 .0394925 -3.62 0.000 -.2206304 -.0656202
educ | .0544106 .0069285 7.85 0.000 .0408133 .068008
iq | .0035591 .0009918 3.59 0.000 .0016127 .0055056
_cons | 5.176439 .1280006 40.44 0.000 4.925234 5.427644
------------------------------------------------------------------------------
Example 4.4 on page 66 using jtrain1.dta.
gen scrap88 = (year==1988 & scrap~=.)
reg lscrap grant if scrap88
Source | SS df MS Number of obs = 54
-------------+------------------------------ F( 1, 52) = 0.02
Model | .039451758 1 .039451758 Prob > F = 0.8895
Residual | 105.323208 52 2.02544631 R-squared = 0.0004
-------------+------------------------------ Adj R-squared = -0.0188
Total | 105.36266 53 1.98797472 Root MSE = 1.4232
------------------------------------------------------------------------------
lscrap | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
grant | .0566004 .4055519 0.14 0.890 -.757199 .8703997
_cons | .408526 .2405616 1.70 0.095 -.0741962 .8912482
------------------------------------------------------------------------------
reg lscrap grant lscrap_1 if scrap88
Source | SS df MS Number of obs = 54
-------------+------------------------------ F( 2, 51) = 174.94
Model | 91.9584791 2 45.9792396 Prob > F = 0.0000
Residual | 13.4041809 51 .262827077 R-squared = 0.8728
-------------+------------------------------ Adj R-squared = 0.8678
Total | 105.36266 53 1.98797472 Root MSE = .51267
------------------------------------------------------------------------------
lscrap | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
grant | -.2539697 .1470311 -1.73 0.090 -.5491469 .0412076
lscrap_1 | .8311606 .0444444 18.70 0.000 .7419347 .9203865
_cons | .021237 .0890967 0.24 0.813 -.1576321 .2001061
------------------------------------------------------------------------------
Example 4.5 on page 69 using nls80.dta.
use nls80, clear
gen educ_iq = educ*iq
reg lwage exper tenure married south urban black educ iq educ_iq
Source | SS df MS Number of obs = 935
-------------+------------------------------ F( 9, 925) = 36.76
Model | 43.6401231 9 4.84890256 Prob > F = 0.0000
Residual | 122.01616 925 .131909362 R-squared = 0.2634
-------------+------------------------------ Adj R-squared = 0.2563
Total | 165.656283 934 .177362188 Root MSE = .36319
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
exper | .0139072 .0031768 4.38 0.000 .0076725 .0201418
tenure | .0113929 .0024397 4.67 0.000 .0066049 .0161808
married | .2008658 .0388267 5.17 0.000 .1246671 .2770644
south | -.0802354 .026256 -3.06 0.002 -.1317637 -.0287072
urban | .1835758 .0268586 6.83 0.000 .1308649 .2362867
black | -.1466989 .0397013 -3.70 0.000 -.2246139 -.0687839
educ | .0184559 .0410608 0.45 0.653 -.0621272 .0990391
iq | -.0009418 .0051625 -0.18 0.855 -.0110734 .0091899
educ_iq | .0003399 .0003826 0.89 0.375 -.0004109 .0010907
_cons | 5.648248 .5462963 10.34 0.000 4.576124 6.720372
------------------------------------------------------------------------------
test iq educ_iq
( 1) iq = 0
( 2) educ_iq = 0
F( 2, 925) = 6.83
Prob > F = 0.0011
