ECO311 Stata
ECO311 Stata
ECO311 Stata
use http://fmwww.bc.edu/ec-p/data/wooldridge/FERTIL1
reg kids educ age agesq black east northcen west farm othrural town smcity
y74 y76 y78 y80 y82 y84
-----------------------------------------------------------------------------
-
kids | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | -.1284268 .0183486 -7.00 0.000 -.1644286 -
.092425
age | .5321346 .1383863 3.85 0.000 .2606065
.8036626
agesq | -.005804 .0015643 -3.71 0.000 -.0088733 -
.0027347
black | 1.075658 .1735356 6.20 0.000 .7351631
1.416152
east | .217324 .1327878 1.64 0.102 -.0432192
.4778672
northcen | .363114 .1208969 3.00 0.003 .125902
.6003261
west | .1976032 .1669134 1.18 0.237 -.1298978
.5251041
farm | -.0525575 .14719 -0.36 0.721 -.3413592
.2362443
othrural | -.1628537 .175442 -0.93 0.353 -.5070887
.1813814
town | .0843532 .124531 0.68 0.498 -.1599893
.3286957
smcity | .2118791 .160296 1.32 0.187 -.1026379
.5263961
y74 | .2681825 .172716 1.55 0.121 -.0707039
.6070689
y76 | -.0973795 .1790456 -0.54 0.587 -.448685
.2539261
y78 | -.0686665 .1816837 -0.38 0.706 -.4251483
.2878154
y80 | -.0713053 .1827707 -0.39 0.697 -.42992
.2873093
y82 | -.5224842 .1724361 -3.03 0.003 -.8608214 -
.184147
y84 | -.5451661 .1745162 -3.12 0.002 -.8875846 -
.2027477
_cons | -7.742457 3.051767 -2.54 0.011 -13.73033 -
1.754579
-----------------------------------------------------------------------------
-
test y74 y76 y78 y80 y82 y84
( 1) y74 = 0.0
( 2) y76 = 0.0
( 3) y78 = 0.0
( 4) y80 = 0.0
( 5) y82 = 0.0
( 6) y84 = 0.0
F( 6, 1111) = 5.87
Prob > F = 0.0000
Example 13.2: Changes in the Return to Education and the Gender Wage Gap
use http://fmwww.bc.edu/ec-p/data/wooldridge/CPS78_85
reg lwage y85 educ y85educ exper expersq union female y85fem
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
y85 | .1178062 .1237817 0.95 0.341 -.125075
.3606874
educ | .0747209 .0066764 11.19 0.000 .0616206
.0878212
y85educ | .0184605 .0093542 1.97 0.049 .000106
.036815
exper | .0295843 .0035673 8.29 0.000 .0225846
.036584
expersq | -.0003994 .0000775 -5.15 0.000 -.0005516 -
.0002473
union | .2021319 .0302945 6.67 0.000 .1426888
.2615749
female | -.3167086 .0366215 -8.65 0.000 -.3885663 -
.244851
y85fem | .085052 .051309 1.66 0.098 -.0156251
.185729
_cons | .4589329 .0934485 4.91 0.000 .2755707
.642295
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/KIELMC
-----------------------------------------------------------------------------
-
rprice | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nearinc | -30688.27 5827.709 -5.27 0.000 -42209.97 -
19166.58
_cons | 101307.5 3093.027 32.75 0.000 95192.43
107422.6
-----------------------------------------------------------------------------
-
scalar b1=_b[nearinc]
reg rprice nearinc if year==1978
-----------------------------------------------------------------------------
-
rprice | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nearinc | -18824.37 4744.594 -3.97 0.000 -28187.62 -
9461.118
_cons | 82517.23 2653.79 31.09 0.000 77280.09
87754.37
-----------------------------------------------------------------------------
-
scalar b2=_b[nearinc]
display b1-b2
-11863.903
reg rprice nearinc y81 y81nrinc
-----------------------------------------------------------------------------
-
rprice | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nearinc | -18824.37 4875.322 -3.86 0.000 -28416.45 -
9232.293
y81 | 18790.29 4050.065 4.64 0.000 10821.88
26758.69
y81nrinc | -11863.9 7456.646 -1.59 0.113 -26534.67
2806.866
_cons | 82517.23 2726.91 30.26 0.000 77152.1
87882.36
-----------------------------------------------------------------------------
-
reg rprice nearinc y81 y81nrinc age agesq
Source | SS df MS Number of obs =
321
-------------+------------------------------ F( 5, 315) =
44.59
Model | 1.4547e+11 5 2.9094e+10 Prob > F =
0.0000
Residual | 2.0552e+11 315 652459465 R-squared =
0.4144
-------------+------------------------------ Adj R-squared =
0.4052
Total | 3.5099e+11 320 1.0969e+09 Root MSE =
25543
-----------------------------------------------------------------------------
-
rprice | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nearinc | 9397.936 4812.222 1.95 0.052 -70.22392
18866.1
y81 | 21321.04 3443.631 6.19 0.000 14545.62
28096.47
y81nrinc | -21920.27 6359.745 -3.45 0.001 -34433.22 -
9407.322
age | -1494.424 131.8603 -11.33 0.000 -1753.862 -
1234.986
agesq | 8.691277 .8481268 10.25 0.000 7.022567
10.35999
_cons | 89116.54 2406.051 37.04 0.000 84382.57
93850.5
-----------------------------------------------------------------------------
-
reg rprice nearinc y81 y81nrinc age agesq intst land area rooms baths
-----------------------------------------------------------------------------
-
rprice | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nearinc | 3780.334 4453.415 0.85 0.397 -4982.41
12543.08
y81 | 13928.48 2798.747 4.98 0.000 8421.533
19435.42
y81nrinc | -14177.93 4987.267 -2.84 0.005 -23991.11 -
4364.759
age | -739.451 131.1272 -5.64 0.000 -997.4629 -
481.4391
agesq | 3.45274 .8128214 4.25 0.000 1.853395
5.052084
intst | -.5386353 .1963359 -2.74 0.006 -.9249549 -
.1523158
land | .1414196 .0310776 4.55 0.000 .0802698
.2025693
area | 18.08621 2.306064 7.84 0.000 13.54869
22.62373
rooms | 3304.225 1661.248 1.99 0.048 35.47769
6572.973
baths | 6977.318 2581.321 2.70 0.007 1898.192
12056.44
_cons | 13807.67 11166.59 1.24 0.217 -8164.23
35779.58
-----------------------------------------------------------------------------
-
reg lprice nearinc y81 y81nrinc
-----------------------------------------------------------------------------
-
lprice | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nearinc | -.3399216 .0545554 -6.23 0.000 -.4472581 -
.2325851
y81 | .4569954 .0453207 10.08 0.000 .367828
.5461628
y81nrinc | -.0626505 .0834408 -0.75 0.453 -.2268181
.1015172
_cons | 11.28542 .0305144 369.84 0.000 11.22539
11.34546
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
ldurat | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
afchnge | .0076573 .0447173 0.17 0.864 -.0800058
.0953204
highearn | .2564785 .0474464 5.41 0.000 .1634652
.3494918
afhigh | .1906012 .0685089 2.78 0.005 .0562973
.3249051
_cons | 1.125615 .0307368 36.62 0.000 1.065359
1.185871
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/SLP75_81
-----------------------------------------------------------------------------
-
cslpnap | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
ctotwrk | -.2266694 .036054 -6.29 0.000 -.2977029 -
.1556359
ceduc | -.0244717 48.75938 -0.00 1.000 -96.09007
96.04113
cmarr | 104.2139 92.85536 1.12 0.263 -78.72946
287.1574
cyngkid | 94.6654 87.65252 1.08 0.281 -78.02738
267.3582
cgdhlth | 87.57785 76.59913 1.14 0.254 -63.33758
238.4933
_cons | -92.63404 45.8659 -2.02 0.045 -182.9989 -
2.269154
-----------------------------------------------------------------------------
-
test ceduc cmarr cyngkid cgdhlth
( 1) ceduc = 0.0
( 2) cmarr = 0.0
( 3) cyngkid = 0.0
( 4) cgdhlth = 0.0
F( 4, 233) = 0.86
Prob > F = 0.4857
use http://fmwww.bc.edu/ec-p/data/wooldridge/CRIME3
-----------------------------------------------------------------------------
-
clcrime | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
cclrprc1 | -.0040475 .0047199 -0.86 0.395 -.0135276
.0054326
cclrprc2 | -.0131966 .0051946 -2.54 0.014 -.0236302 -
.0027629
_cons | .0856556 .0637825 1.34 0.185 -.0424553
.2137665
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/TRAFFIC1
-----------------------------------------------------------------------------
-
cdthrte | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
copen | -.4196787 .2055948 -2.04 0.047 -.8330547 -
.0063028
cadmn | -.1506024 .1168223 -1.29 0.204 -.3854894
.0842846
_cons | -.4967872 .0524256 -9.48 0.000 -.6021959 -
.3913784
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/EZUNEM
reg guclms d82 d83 d84 d85 d86 d87 d88 cez
-----------------------------------------------------------------------------
-
guclms | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
d82 | .7787595 .0651444 11.95 0.000 .6501469
.9073721
d83 | -.0331192 .0651444 -0.51 0.612 -.1617318
.0954934
d84 | -.0171382 .0685455 -0.25 0.803 -.1524655
.118189
d85 | .323081 .0666774 4.85 0.000 .1914418
.4547202
d86 | .292154 .0651444 4.48 0.000 .1635413
.4207666
d87 | .0539481 .0651444 0.83 0.409 -.0746645
.1825607
d88 | -.0170526 .0651444 -0.26 0.794 -.1456652
.11156
cez | -.1818775 .0781862 -2.33 0.021 -.3362382 -
.0275169
_cons | -.3216319 .046064 -6.98 0.000 -.4125748 -
.230689
-----------------------------------------------------------------------------
-
bpagan d82 d83 d84 d85 d86 d87 d88 cez
use http://fmwww.bc.edu/ec-p/data/wooldridge/CRIME4
reg clcrmrte d83 d84 d85 d86 d87 clprbarr clprbcon clprbpri clavgsen clpolpc
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .8827385 .0132545 66.60 0.000 .8563895
.9090876
logf | .453977 .0203042 22.36 0.000 .4136136
.4943404
lf | -1.62751 .345302 -4.71 0.000 -2.313948 -
.9410727
_cons | 9.516923 .2292445 41.51 0.000 9.0612
9.972645
-----------------------------------------------------------------------------
-
Table 14.1, Group Means.
egen mq = mean(logq), by(i)
egen mf = mean(logf), by(i)
egen mlf = mean(lf), by(i)
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
mq | .7824569 .1518735 5.15 0.000 .4805424
1.084371
mf | -5.523905 6.253856 -0.88 0.380 -17.95616
6.908349
mlf | -1.751066 3.83042 -0.46 0.649 -9.365689
5.863557
_cons | 85.80811 78.8686 1.09 0.280 -70.97747
242.5937
-----------------------------------------------------------------------------
-
Table 14.1, Firm effects.
xtreg logc logq logf lf, i(i) fe
F(3,81) =
3604.80
corr(u_i, Xb) = -0.3475 Prob > F =
0.0000
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .9192846 .0298901 30.76 0.000 .8598126
.9787565
logf | .4174918 .0151991 27.47 0.000 .3872503
.4477333
lf | -1.070396 .20169 -5.31 0.000 -1.471696 -
.6690963
_cons | 9.713528 .229641 42.30 0.000 9.256614
10.17044
-------------+---------------------------------------------------------------
-
sigma_u | .1320775
sigma_e | .06010514
rho | .82843653 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(5, 81) = 57.73 Prob > F =
0.0000
Table 14.1, a1 ... a6, Method 1.
tabulate i, gen(i)
(output omitted)
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .9192846 .0298901 30.76 0.000 .8598126
.9787565
logf | .4174918 .0151991 27.47 0.000 .3872503
.4477333
lf | -1.070396 .20169 -5.31 0.000 -1.471696 -
.6690963
i2 | -.0412359 .0251839 -1.64 0.105 -.0913441
.0088722
i3 | -.2089211 .0427986 -4.88 0.000 -.2940769 -
.1237652
i4 | .1845557 .0607527 3.04 0.003 .0636769
.3054345
i5 | .0240547 .0799041 0.30 0.764 -.1349293
.1830387
i6 | .0870617 .0841995 1.03 0.304 -.080469
.2545924
_cons | 9.705942 .193124 50.26 0.000 9.321686
10.0902
-----------------------------------------------------------------------------
-
lincom _cons
( 1) _cons = 0.0
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
(1) | 9.705942 .193124 50.26 0.000 9.321686
10.0902
-----------------------------------------------------------------------------
-
lincom _cons + i2
( 1) i2 + _cons = 0.0
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
(1) | 9.664706 .198982 48.57 0.000 9.268794
10.06062
-----------------------------------------------------------------------------
-
lincom _cons + i3
( 1) i3 + _cons = 0.0
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
(1) | 9.497021 .2249584 42.22 0.000 9.049424
9.944618
-----------------------------------------------------------------------------
-
lincom _cons + i4
( 1) i4 + _cons = 0.0
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
(1) | 9.890498 .2417635 40.91 0.000 9.409464
10.37153
-----------------------------------------------------------------------------
-
lincom _cons + i5
( 1) i5 + _cons = 0.0
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
(1) | 9.729997 .2609421 37.29 0.000 9.210804
10.24919
-----------------------------------------------------------------------------
-
lincom _cons + i6
( 1) i6 + _cons = 0.0
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
(1) | 9.793004 .2636622 37.14 0.000 9.268399
10.31761
-----------------------------------------------------------------------------
-
Table 14.1, a1 ... a6, Method 2.
regress logc logq logf lf i1-i6, noconst
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .9192846 .0298901 30.76 0.000 .8598126
.9787565
logf | .4174918 .0151991 27.47 0.000 .3872503
.4477333
lf | -1.070396 .20169 -5.31 0.000 -1.471696 -
.6690963
i1 | 9.705942 .193124 50.26 0.000 9.321686
10.0902
i2 | 9.664706 .198982 48.57 0.000 9.268794
10.06062
i3 | 9.497021 .2249584 42.22 0.000 9.049424
9.944618
i4 | 9.890498 .2417635 40.91 0.000 9.409464
10.37153
i5 | 9.729997 .2609421 37.29 0.000 9.210804
10.24919
i6 | 9.793004 .2636622 37.14 0.000 9.268399
10.31761
-----------------------------------------------------------------------------
-
Table 14.1, Time effects.
xtreg logc logq logf lf, i(t) fe
F(3,72) =
1668.37
corr(u_i, Xb) = -0.1503 Prob > F =
0.0000
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .8677268 .0154082 56.32 0.000 .8370111
.8984424
logf | -.4844835 .3641085 -1.33 0.188 -1.210321
.2413535
lf | -1.954404 .4423777 -4.42 0.000 -2.836268 -
1.07254
_cons | 21.66698 4.624053 4.69 0.000 12.4491
30.88486
-------------+---------------------------------------------------------------
-
sigma_u | .8027907
sigma_e | .12293801
rho | .97708602 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(14, 72) = 1.17 Prob > F =
0.3178
Table 14.1, c1 ... c15, Method 2.
tabulate t, gen(t)
(output omitted)
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .8677268 .0154082 56.32 0.000 .8370111
.8984424
logf | -.4844835 .3641085 -1.33 0.188 -1.210321
.2413535
lf | -1.954404 .4423777 -4.42 0.000 -2.836268 -
1.07254
t1 | 20.4958 4.209528 4.87 0.000 12.10426
28.88735
t2 | 20.57804 4.221526 4.87 0.000 12.16258
28.9935
t3 | 20.65573 4.224177 4.89 0.000 12.23499
29.07647
t4 | 20.74076 4.24575 4.89 0.000 12.27701
29.20451
t5 | 21.19983 4.440331 4.77 0.000 12.34819
30.05147
t6 | 21.41162 4.538621 4.72 0.000 12.36404
30.4592
t7 | 21.50335 4.571397 4.70 0.000 12.39044
30.61626
t8 | 21.65403 4.622886 4.68 0.000 12.43847
30.86958
t9 | 21.82957 4.656906 4.69 0.000 12.5462
31.11294
t10 | 22.1138 4.792648 4.61 0.000 12.55983
31.66777
t11 | 22.46533 4.949909 4.54 0.000 12.59786
32.33279
t12 | 22.65134 5.008592 4.52 0.000 12.66689
32.63578
t13 | 22.61656 4.986139 4.54 0.000 12.67687
32.55624
t14 | 22.55223 4.955942 4.55 0.000 12.67274
32.43172
t15 | 22.53677 4.940532 4.56 0.000 12.688
32.38554
-----------------------------------------------------------------------------
-
Table 14.2, Random effects, Firm effects.
xtreg logc logq logf lf, i(i) re
Random-effects GLS regression Number of obs =
90
Group variable (i) : i Number of groups =
6
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .9066805 .025625 35.38 0.000 .8564565
.9569045
logf | .4227784 .0140248 30.15 0.000 .3952904
.4502665
lf | -1.064499 .2000703 -5.32 0.000 -1.456629 -
.672368
_cons | 9.627909 .210164 45.81 0.000 9.215995
10.03982
-------------+---------------------------------------------------------------
-
sigma_u | .12488859
sigma_e | .06010514
rho | .81193816 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
Table 14.2, Random effects with autocorrelation. Using xtregar we obtain slightly different
values for the autocorrelation, coefficients and standard errors. It should be noted that the latest
version of Greene's Limdep program also computes different values from those found in the
book.
tsset i t
panel variable: i, 1 to 6
time variable: t, 1 to 15
Wald chi2(4) =
3735.11
corr(u_i, Xb) = 0 (assumed) Prob > chi2 =
0.0000
-----------------------------------------------------------------------------
-
logc | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
logq | .9276293 .0287051 32.32 0.000 .8713683
.9838904
logf | .3997841 .017633 22.67 0.000 .3652241
.4343442
lf | -.9870458 .198669 -4.97 0.000 -1.37643 -
.5976618
_cons | 9.902918 .2626146 37.71 0.000 9.388203
10.41763
-------------+---------------------------------------------------------------
-
rho_ar | .69576607 (estimated autocorrelation coefficient)
sigma_u | .10060015
sigma_e | .04720363
rho_fov | .81955952 (fraction of variance due to u_i)
theta | .67082541
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/JTRAIN
iis fcode
tis year
xtreg lscrap d88 d89 grant grant_1, fe
-----------------------------------------------------------------------------
-
lscrap | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
d88 | -.0802157 .1094751 -0.73 0.465 -.2973089
.1368776
d89 | -.2472028 .1332183 -1.86 0.066 -.5113797
.016974
grant | -.2523149 .150629 -1.68 0.097 -.5510178
.046388
grant_1 | -.4215895 .2102 -2.01 0.047 -.8384239 -
.0047551
_cons | .597434 .0677344 8.82 0.000 .4631142
.7317539
-------------+---------------------------------------------------------------
-
sigma_u | 1.438982
sigma_e | .4977442
rho | .89313867 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(53, 104) = 24.66 Prob > F =
0.0000
Change in firm's scrap rate in 1989 if the training grant was received in 1988
display exp(_b[grant_1])-1
-.34399671
xtreg lscrap d88 d89 grant, fe
F(3,105) =
7.18
corr(u_i, Xb) = -0.0109 Prob > F =
0.0002
-----------------------------------------------------------------------------
-
lscrap | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
d88 | -.1400659 .106835 -1.31 0.193 -.3518999
.0717681
d89 | -.42704 .0999338 -4.27 0.000 -.6251903 -
.2288897
grant | -.0822141 .1262632 -0.65 0.516 -.3325706
.1681424
_cons | .597434 .0687024 8.70 0.000 .4612098
.7336583
-------------+---------------------------------------------------------------
-
sigma_u | 1.4283441
sigma_e | .50485773
rho | .88894293 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(53, 105) = 23.90 Prob > F =
0.0000
use http://fmwww.bc.edu/ec-p/data/wooldridge/WAGEPAN
iis nr
tis year
gen edd81 = educ*d81
gen edd82 = educ*d82
gen edd83 = educ*d83
gen edd84 = educ*d84
gen edd85 = educ*d85
gen edd86 = educ*d86
gen edd87 = educ*d87
xtreg lwage expersq union married d81-d87 edd81-edd87, fe
F(17,3798) =
49.49
corr(u_i, Xb) = -0.1732 Prob > F =
0.0000
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
expersq | -.0060437 .0008633 -7.00 0.000 -.0077362 -
.0043512
union | .0789759 .0193328 4.09 0.000 .0410722
.1168796
married | .0474337 .0183277 2.59 0.010 .0115006
.0833668
d81 | .09842 .145999 0.67 0.500 -.187824
.384664
d82 | .2472014 .1493785 1.65 0.098 -.0456685
.5400712
d83 | .4088129 .1557146 2.63 0.009 .1035206
.7141052
d84 | .6399246 .1652396 3.87 0.000 .3159577
.9638916
d85 | .7729394 .1779911 4.34 0.000 .423972
1.121907
d86 | .9699322 .1941747 5.00 0.000 .5892354
1.350629
d87 | 1.188776 .2135856 5.57 0.000 .7700229
1.60753
edd81 | .0049906 .012222 0.41 0.683 -.0189718
.028953
edd82 | .001651 .0123304 0.13 0.893 -.0225239
.0258259
edd83 | -.0026621 .0125098 -0.21 0.831 -.0271886
.0218644
edd84 | -.0098257 .0127593 -0.77 0.441 -.0348414
.01519
edd85 | -.0092145 .0130721 -0.70 0.481 -.0348436
.0164146
edd86 | -.0121382 .0134419 -0.90 0.367 -.0384922
.0142159
edd87 | -.0157891 .013868 -1.14 0.255 -.0429785
.0114002
_cons | 1.436283 .0192766 74.51 0.000 1.398489
1.474076
-------------+---------------------------------------------------------------
-
sigma_u | .39876324
sigma_e | .35114511
rho | .5632436 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(544, 3798) = 8.25 Prob > F =
0.0000
test edd81 edd82 edd83 edd84 edd85 edd86 edd87
( 1) edd81 = 0.0
( 2) edd82 = 0.0
( 3) edd83 = 0.0
( 4) edd84 = 0.0
( 5) edd85 = 0.0
( 6) edd86 = 0.0
( 7) edd87 = 0.0
F( 7, 3798) = 0.52
Prob > F = 0.8202
use http://fmwww.bc.edu/ec-p/data/wooldridge/JTRAIN
iis fcode
tis year
xtreg lscrap d88 d89 grant grant_1 lsales lemploy, fe
F(6,91) =
4.11
corr(u_i, Xb) = -0.2258 Prob > F =
0.0011
-----------------------------------------------------------------------------
-
lscrap | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
d88 | -.0039605 .1195487 -0.03 0.974 -.2414293
.2335083
d89 | -.1321925 .1536863 -0.86 0.392 -.4374715
.1730865
grant | -.2967544 .157086 -1.89 0.062 -.6087866
.0152777
grant_1 | -.5355783 .224206 -2.39 0.019 -.9809359 -
.0902207
lsales | -.0868607 .2596993 -0.33 0.739 -.6027214
.4290001
lemploy | -.0763642 .3502912 -0.22 0.828 -.7721747
.6194462
_cons | 2.115513 3.108438 0.68 0.498 -4.059017
8.290043
-------------+---------------------------------------------------------------
-
sigma_u | 1.4415147
sigma_e | .49149052
rho | .89585684 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(50, 91) = 20.75 Prob > F =
0.0000
use http://fmwww.bc.edu/ec-p/data/wooldridge/WAGEPAN
iis nr
tis year
reg lwage educ black hisp exper expersq married union d81-d87
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0913498 .0052374 17.44 0.000 .0810819
.1016177
black | -.1392342 .0235796 -5.90 0.000 -.1854622 -
.0930062
hisp | .0160195 .0207971 0.77 0.441 -.0247535
.0567925
exper | .0672345 .0136948 4.91 0.000 .0403856
.0940834
expersq | -.0024117 .00082 -2.94 0.003 -.0040192 -
.0008042
married | .1082529 .0156894 6.90 0.000 .0774937
.1390122
union | .1824613 .0171568 10.63 0.000 .1488253
.2160973
d81 | .05832 .0303536 1.92 0.055 -.0011886
.1178286
d82 | .0627744 .0332141 1.89 0.059 -.0023421
.1278909
d83 | .0620117 .0366601 1.69 0.091 -.0098608
.1338843
d84 | .0904672 .0400907 2.26 0.024 .011869
.1690654
d85 | .1092463 .0433525 2.52 0.012 .0242533
.1942393
d86 | .1419596 .046423 3.06 0.002 .0509469
.2329723
d87 | .1738334 .049433 3.52 0.000 .0769194
.2707474
_cons | .0920558 .0782701 1.18 0.240 -.0613935
.2455051
-----------------------------------------------------------------------------
-
xtreg lwage educ black hisp exper expersq married union, re
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0918763 .0106597 8.62 0.000 .0709836
.1127689
black | -.1393767 .0477228 -2.92 0.003 -.2329117 -
.0458417
hisp | .0217317 .0426063 0.51 0.610 -.0617751
.1052385
exper | .1057545 .0153668 6.88 0.000 .0756361
.1358729
expersq | -.0047239 .0006895 -6.85 0.000 -.0060753 -
.0033726
married | .063986 .0167742 3.81 0.000 .0311091
.0968629
union | .1061344 .0178539 5.94 0.000 .0711415
.1411273
d81 | .040462 .0246946 1.64 0.101 -.0079385
.0888626
d82 | .0309212 .0323416 0.96 0.339 -.0324672
.0943096
d83 | .0202806 .041582 0.49 0.626 -.0612186
.1017798
d84 | .0431187 .0513163 0.84 0.401 -.0574595
.1436969
d85 | .0578155 .0612323 0.94 0.345 -.0621977
.1778286
d86 | .0919476 .0712293 1.29 0.197 -.0476592
.2315544
d87 | .1349289 .0813135 1.66 0.097 -.0244427
.2943005
_cons | .0235864 .1506683 0.16 0.876 -.271718
.3188907
-------------+---------------------------------------------------------------
-
sigma_u | .32460315
sigma_e | .35099001
rho | .46100216 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
xtreg lwage expersq married union d81-d87, fe
F(10,3805) =
83.85
corr(u_i, Xb) = -0.1222 Prob > F =
0.0000
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
expersq | -.0051855 .0007044 -7.36 0.000 -.0065666 -
.0038044
married | .0466804 .0183104 2.55 0.011 .0107811
.0825796
union | .0800019 .0193103 4.14 0.000 .0421423
.1178614
d81 | .1511912 .0219489 6.89 0.000 .1081584
.194224
d82 | .2529709 .0244185 10.36 0.000 .2050963
.3008454
d83 | .3544437 .0292419 12.12 0.000 .2971125
.4117749
d84 | .4901148 .0362266 13.53 0.000 .4190894
.5611402
d85 | .6174823 .0452435 13.65 0.000 .5287784
.7061861
d86 | .7654966 .0561277 13.64 0.000 .6554532
.8755399
d87 | .9250249 .0687731 13.45 0.000 .7901893
1.059861
_cons | 1.426019 .0183415 77.75 0.000 1.390058
1.461979
-------------+---------------------------------------------------------------
-
sigma_u | .39176195
sigma_e | .35099001
rho | .55472817 (fraction of variance due to u_i)
-----------------------------------------------------------------------------
-
F test that all u_i=0: F(544, 3805) = 9.16 Prob > F =
0.0000
use http://fmwww.bc.edu/ec-p/data/wooldridge/MROZ
reg lwage educ
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .1086487 .0143998 7.55 0.000 .0803451
.1369523
_cons | -.1851969 .1852259 -1.00 0.318 -.5492674
.1788735
-----------------------------------------------------------------------------
-
ivreg lwage (educ = fatheduc )
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0591735 .0351418 1.68 0.093 -.0098994
.1282463
_cons | .4411035 .4461018 0.99 0.323 -.4357311
1.317938
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: fatheduc
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/WAGE2
ivreg lwage (educ = sibs )
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .1224327 .0263506 4.65 0.000 .0707194
.1741459
_cons | 5.130026 .3551712 14.44 0.000 4.432999
5.827053
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: sibs
-----------------------------------------------------------------------------
-
reg lwage educ
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0598392 .0059631 10.03 0.000 .0481366
.0715418
_cons | 5.973062 .0813737 73.40 0.000 5.813366
6.132759
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/BWGHT
ivreg lbwght (packs = cigprice ), first
First-stage regressions
-----------------------
-----------------------------------------------------------------------------
-
packs | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
cigprice | .0002829 .000783 0.36 0.718 -.0012531
.0018188
_cons | .0674257 .1025384 0.66 0.511 -.1337215
.2685728
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
lbwght | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
packs | 2.988674 8.698884 0.34 0.731 -14.07573
20.05307
_cons | 4.448137 .9081547 4.90 0.000 2.66663
6.229643
-----------------------------------------------------------------------------
-
Instrumented: packs
Instruments: cigprice
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/CARD
ivreg lwage (educ = nearc4 ) exper expersq black smsa south, first
First-stage regressions
-----------------------
-----------------------------------------------------------------------------
-
educ | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
exper | -.4100081 .0336939 -12.17 0.000 -.4760735 -
.3439427
expersq | .0007323 .0016499 0.44 0.657 -.0025029
.0039674
black | -1.006138 .0896454 -11.22 0.000 -1.181911 -
.8303656
smsa | .4038769 .0848872 4.76 0.000 .2374339
.5703199
south | -.291464 .0792247 -3.68 0.000 -.4468042 -
.1361238
nearc4 | .3373208 .0825004 4.09 0.000 .1755577
.4990839
_cons | 16.65917 .1763889 94.45 0.000 16.31332
17.00503
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .1322888 .0492332 2.69 0.007 .0357545
.228823
exper | .107498 .0213006 5.05 0.000 .0657327
.1492632
expersq | -.0022841 .0003341 -6.84 0.000 -.0029392 -
.0016289
black | -.130802 .0528723 -2.47 0.013 -.2344716 -
.0271324
smsa | .1313237 .0301298 4.36 0.000 .0722465
.1904009
south | -.1049005 .0230731 -4.55 0.000 -.1501412 -
.0596599
_cons | 3.752783 .8293408 4.53 0.000 2.126649
5.378916
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq black smsa south nearc4
-----------------------------------------------------------------------------
-
reg lwage educ exper expersq black smsa south
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .074009 .0035054 21.11 0.000 .0671357
.0808823
exper | .0835958 .0066478 12.57 0.000 .0705612
.0966305
expersq | -.0022409 .0003178 -7.05 0.000 -.0028641 -
.0016177
black | -.1896316 .0176266 -10.76 0.000 -.2241929 -
.1550702
smsa | .161423 .0155733 10.37 0.000 .1308876
.1919583
south | -.1248615 .0151182 -8.26 0.000 -.1545046 -
.0952184
_cons | 4.733664 .0676026 70.02 0.000 4.601112
4.866217
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/MROZ
reg educ exper expersq motheduc fatheduc
-----------------------------------------------------------------------------
-
educ | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
exper | .085378 .0255485 3.34 0.001 .0352228
.1355333
expersq | -.0018564 .0008276 -2.24 0.025 -.0034812 -
.0002317
motheduc | .1856173 .0259869 7.14 0.000 .1346014
.2366331
fatheduc | .1845745 .0244979 7.53 0.000 .1364817
.2326674
_cons | 8.366716 .2667111 31.37 0.000 7.843125
8.890307
-----------------------------------------------------------------------------
-
test motheduc fatheduc
( 1) motheduc = 0.0
( 2) fatheduc = 0.0
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0613966 .0314367 1.95 0.051 -.0003945
.1231878
exper | .0441704 .0134325 3.29 0.001 .0177679
.0705729
expersq | -.000899 .0004017 -2.24 0.026 -.0016885 -
.0001094
_cons | .0481003 .4003281 0.12 0.904 -.7387744
.834975
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq motheduc fatheduc
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/WAGE2
ivreg lwage educ exper tenure married south urban black (IQ =KWW)
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
IQ | .0130473 .0049341 2.64 0.008 .0033641
.0227305
educ | .0250321 .0166068 1.51 0.132 -.0075591
.0576234
exper | .01442 .0033208 4.34 0.000 .0079029
.0209371
tenure | .0104562 .0026012 4.02 0.000 .0053512
.0155612
married | .2006904 .0406775 4.93 0.000 .1208596
.2805212
south | -.0515532 .0311279 -1.66 0.098 -.1126426
.0095362
urban | .1767058 .0282117 6.26 0.000 .1213394
.2320722
black | -.0225611 .0739597 -0.31 0.760 -.1677092
.122587
_cons | 4.592453 .3257807 14.10 0.000 3.953099
5.231807
-----------------------------------------------------------------------------
-
Instrumented: IQ
Instruments: educ exper tenure married south urban black KWW
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/MROZ
reg educ exper expersq motheduc fatheduc if lwage<.
-----------------------------------------------------------------------------
-
educ | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
exper | .0452254 .0402507 1.12 0.262 -.0338909
.1243417
expersq | -.0010091 .0012033 -0.84 0.402 -.0033744
.0013562
motheduc | .157597 .0358941 4.39 0.000 .087044
.2281501
fatheduc | .1895484 .0337565 5.62 0.000 .1231971
.2558997
_cons | 9.10264 .4265614 21.34 0.000 8.264196
9.941084
-----------------------------------------------------------------------------
-
predict double uhat1, res
reg lwage educ exper expersq uhat1
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0613966 .0309849 1.98 0.048 .000493
.1223003
exper | .0441704 .0132394 3.34 0.001 .0181471
.0701937
expersq | -.000899 .0003959 -2.27 0.024 -.0016772 -
.0001208
uhat1 | .0581666 .0348073 1.67 0.095 -.0102501
.1265834
_cons | .0481003 .3945753 0.12 0.903 -.7274721
.8236727
-----------------------------------------------------------------------------
-
reg lwage educ exper expersq
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .1074896 .0141465 7.60 0.000 .0796837
.1352956
exper | .0415665 .0131752 3.15 0.002 .0156697
.0674633
expersq | -.0008112 .0003932 -2.06 0.040 -.0015841 -
.0000382
_cons | -.5220407 .1986321 -2.63 0.009 -.9124668 -
.1316145
-----------------------------------------------------------------------------
-
ivreg lwage (educ = motheduc fatheduc) exper expersq
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0613966 .0314367 1.95 0.051 -.0003945
.1231878
exper | .0441704 .0134325 3.29 0.001 .0177679
.0705729
expersq | -.000899 .0004017 -2.24 0.026 -.0016885 -
.0001094
_cons | .0481003 .4003281 0.12 0.904 -.7387744
.834975
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq motheduc fatheduc
-----------------------------------------------------------------------------
-
Example 15.8: Return to Education for Working Women
use http://fmwww.bc.edu/ec-p/data/wooldridge/MROZ
ivreg lwage (educ = motheduc fatheduc) exper expersq
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0613966 .0314367 1.95 0.051 -.0003945
.1231878
exper | .0441704 .0134325 3.29 0.001 .0177679
.0705729
expersq | -.000899 .0004017 -2.24 0.026 -.0016885 -
.0001094
_cons | .0481003 .4003281 0.12 0.904 -.7387744
.834975
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq motheduc fatheduc
-----------------------------------------------------------------------------
-
ssc install overid, replace
overid
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0803918 .021774 3.69 0.000 .0375934
.1231901
exper | .0430973 .0132649 3.25 0.001 .0170242
.0691704
expersq | -.0008628 .0003962 -2.18 0.030 -.0016415 -
.0000841
_cons | -.1868574 .2853959 -0.65 0.513 -.7478243
.3741096
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq motheduc fatheduc huseduc
-----------------------------------------------------------------------------
-
overid
use http://fmwww.bc.edu/ec-p/data/wooldridge/FERTIL1
ivreg kids (educ = meduc feduc) age agesq black east northcen west farm
othrural town smcity y74 y76 y78 y80 y82 y84
-----------------------------------------------------------------------------
-
kids | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | -.1527395 .0392232 -3.89 0.000 -.2296993 -
.0757796
age | .5235536 .1390348 3.77 0.000 .2507532
.796354
agesq | -.005716 .0015705 -3.64 0.000 -.0087976 -
.0026345
black | 1.072952 .1737155 6.18 0.000 .732105
1.4138
east | .2285554 .1338537 1.71 0.088 -.0340792
.49119
northcen | .3744188 .122061 3.07 0.002 .1349228
.6139148
west | .2076398 .1676568 1.24 0.216 -.1213199
.5365995
farm | -.0770015 .1513718 -0.51 0.611 -.3740083
.2200052
othrural | -.1952451 .181551 -1.08 0.282 -.5514666
.1609764
town | .08181 .1246821 0.66 0.512 -.162829
.3264489
smcity | .2124996 .160425 1.32 0.186 -.1022706
.5272698
y74 | .2721292 .172944 1.57 0.116 -.0672045
.6114629
y76 | -.0945483 .1792324 -0.53 0.598 -.4462205
.2571239
y78 | -.0572543 .1825536 -0.31 0.754 -.415443
.3009343
y80 | -.053248 .1847175 -0.29 0.773 -.4156825
.3091865
y82 | -.4962149 .1765888 -2.81 0.005 -.8427 -
.1497298
y84 | -.5213604 .1779205 -2.93 0.003 -.8704586 -
.1722623
_cons | -7.241244 3.136642 -2.31 0.021 -13.39565 -
1.086834
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: age agesq black east northcen west farm othrural town smcity
y74
y76 y78 y80 y82 y84 meduc feduc
-----------------------------------------------------------------------------
-
reg kids educ age agesq black east northcen west farm othrural town smcity
y74 y76 y78 y80 y82 y84
-----------------------------------------------------------------------------
-
kids | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | -.1284268 .0183486 -7.00 0.000 -.1644286 -
.092425
age | .5321346 .1383863 3.85 0.000 .2606065
.8036626
agesq | -.005804 .0015643 -3.71 0.000 -.0088733 -
.0027347
black | 1.075658 .1735356 6.20 0.000 .7351631
1.416152
east | .217324 .1327878 1.64 0.102 -.0432192
.4778672
northcen | .363114 .1208969 3.00 0.003 .125902
.6003261
west | .1976032 .1669134 1.18 0.237 -.1298978
.5251041
farm | -.0525575 .14719 -0.36 0.721 -.3413592
.2362443
othrural | -.1628537 .175442 -0.93 0.353 -.5070887
.1813814
town | .0843532 .124531 0.68 0.498 -.1599893
.3286957
smcity | .2118791 .160296 1.32 0.187 -.1026379
.5263961
y74 | .2681825 .172716 1.55 0.121 -.0707039
.6070689
y76 | -.0973795 .1790456 -0.54 0.587 -.448685
.2539261
y78 | -.0686665 .1816837 -0.38 0.706 -.4251483
.2878154
y80 | -.0713053 .1827707 -0.39 0.697 -.42992
.2873093
y82 | -.5224842 .1724361 -3.03 0.003 -.8608214 -
.184147
y84 | -.5451661 .1745162 -3.12 0.002 -.8875846 -
.2027477
_cons | -7.742457 3.051767 -2.54 0.011 -13.73033 -
1.754579
-----------------------------------------------------------------------------
-
reg educ meduc feduc age agesq black east northcen west farm othrural town
smcity y74 y76 y78 y80 y82 y84
-----------------------------------------------------------------------------
-
educ | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
meduc | .1723015 .0221964 7.76 0.000 .1287499
.2158531
feduc | .2074188 .0254604 8.15 0.000 .1574629
.2573747
age | -.2243687 .2000013 -1.12 0.262 -.616792
.1680546
agesq | .0025664 .0022605 1.14 0.256 -.001869
.0070018
black | .3667819 .2522869 1.45 0.146 -.1282311
.861795
east | .2488042 .1920135 1.30 0.195 -.1279462
.6255546
northcen | .0913945 .1757744 0.52 0.603 -.2534931
.4362821
west | .1010676 .2422408 0.42 0.677 -.3742339
.5763691
farm | -.3792615 .2143864 -1.77 0.077 -.7999099
.0413869
othrural | -.560814 .2551196 -2.20 0.028 -1.061385 -
.060243
town | .0616337 .1807832 0.34 0.733 -.2930816
.416349
smcity | .0806634 .2317387 0.35 0.728 -.3740319
.5353587
y74 | .0060993 .249827 0.02 0.981 -.4840872
.4962858
y76 | .1239104 .2587922 0.48 0.632 -.3838667
.6316874
y78 | .2077861 .2627738 0.79 0.429 -.3078033
.7233755
y80 | .3828911 .2642433 1.45 0.148 -.1355816
.9013638
y82 | .5820401 .2492372 2.34 0.020 .0930108
1.071069
y84 | .4250429 .2529006 1.68 0.093 -.0711741
.92126
_cons | 13.63334 4.396773 3.10 0.002 5.006421
22.26027
-----------------------------------------------------------------------------
-
predict v, res
reg kids educ age agesq black east northcen west farm othrural town smcity
y74 y76 y78 y80 y82 y84 v
-----------------------------------------------------------------------------
-
kids | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | -.1527395 .0392012 -3.90 0.000 -.2296562 -
.0758227
age | .5235536 .1389568 3.77 0.000 .250906
.7962012
agesq | -.005716 .0015697 -3.64 0.000 -.0087959 -
.0026362
black | 1.072952 .173618 6.18 0.000 .7322958
1.413609
east | .2285554 .1337787 1.71 0.088 -.0339321
.491043
northcen | .3744188 .1219925 3.07 0.002 .1350569
.6137807
west | .2076398 .1675628 1.24 0.216 -.1211357
.5364153
farm | -.0770015 .1512869 -0.51 0.611 -.373842
.2198389
othrural | -.1952451 .1814491 -1.08 0.282 -.5512671
.1607769
town | .08181 .1246122 0.66 0.512 -.162692
.3263119
smcity | .2124996 .160335 1.33 0.185 -.1020943
.5270935
y74 | .2721292 .172847 1.57 0.116 -.0670144
.6112729
y76 | -.0945483 .1791319 -0.53 0.598 -.4460236
.2569269
y78 | -.0572543 .1824512 -0.31 0.754 -.4152424
.3007337
y80 | -.053248 .1846139 -0.29 0.773 -.4154795
.3089836
y82 | -.4962149 .1764897 -2.81 0.005 -.842506 -
.1499238
y84 | -.5213604 .1778207 -2.93 0.003 -.8702631 -
.1724578
v | .0311374 .0443634 0.70 0.483 -.0559081
.1181829
_cons | -7.241244 3.134883 -2.31 0.021 -13.39221 -
1.09028
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/JTRAIN
tsset fcode year
sort fcode year
drop if year==1989
ivreg D.lscrap (D.hrsemp = D.grant)
-----------------------------------------------------------------------------
-
D.lscrap | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
hrsemp |
D1 | -.0141532 .0079147 -1.79 0.081 -.0301148
.0018084
_cons | -.0326684 .1269512 -0.26 0.798 -.2886898
.223353
-----------------------------------------------------------------------------
-
Instrumented: D.hrsemp
Instruments: D.grant
-----------------------------------------------------------------------------
-
reg D.lscrap D.hrsemp
-----------------------------------------------------------------------------
-
D.lscrap | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
hrsemp |
D1 | -.0076007 .0045112 -1.68 0.099 -.0166984
.0014971
_cons | -.1035161 .103736 -1.00 0.324 -.3127197
.1056875
-----------------------------------------------------------------------------
-
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 WinZip to unzip the data files.
Example 5.3 on page 96 using mroz.dta.
use mroz, clear
-----------------------------------------------------------------------------
-
educ | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
exper | .0374977 .0343102 1.09 0.275 -.0299424
.1049379
expersq | -.0006002 .0010261 -0.58 0.559 -.0026171
.0014167
motheduc | .1141532 .0307835 3.71 0.000 .0536452
.1746613
fatheduc | .1060801 .0295153 3.59 0.000 .0480648
.1640955
huseduc | .3752548 .0296347 12.66 0.000 .3170049
.4335048
_cons | 5.538311 .4597824 12.05 0.000 4.634562
6.44206
-----------------------------------------------------------------------------
-
( 1) motheduc = 0
( 2) fatheduc = 0
( 3) huseduc = 0
F( 3, 422) = 104.29
Prob > F = 0.0000
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0803918 .021774 3.69 0.000 .0375934
.1231901
exper | .0430973 .0132649 3.25 0.001 .0170242
.0691704
expersq | -.0008628 .0003962 -2.18 0.030 -.0016415 -
.0000841
_cons | -.1868572 .2853959 -0.65 0.513 -.7478241
.3741097
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq fatheduc huseduc motheduc
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
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
-----------------------------------------------------------------------------
-
Example 5.4 on page 99.
ivreg lwage exper expersq kidslt6 kidsge6 (educ=fatheduc huseduc motheduc
kidslt6 kidsge6)
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .0798678 .0223575 3.57 0.000 .035922
.1238136
exper | .0414939 .0134453 3.09 0.002 .0150658
.0679221
expersq | -.0008576 .0003972 -2.16 0.031 -.0016384 -
.0000768
kidslt6 | -.0313332 .0861049 -0.36 0.716 -.2005811
.1379146
kidsge6 | -.0182224 .0271427 -0.67 0.502 -.0715741
.0351292
_cons | -.1315325 .3038534 -0.43 0.665 -.7287871
.4657222
-----------------------------------------------------------------------------
-
Instrumented: educ
Instruments: exper expersq kidslt6 kidsge6 fatheduc huseduc motheduc
-----------------------------------------------------------------------------
-
( 1) kidslt6 = 0
( 2) kidsge6 = 0
F( 2, 422) = 0.31
Prob > F = 0.7368
Example 5.5 on page 106 using nls80.dta.
use nls80, clear
ivreg lwage exper tenure married south urban black educ (iq = kww )
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
iq | .0130473 .0049341 2.64 0.008 .0033641
.0227305
exper | .01442 .0033208 4.34 0.000 .0079029
.0209371
tenure | .0104562 .0026012 4.02 0.000 .0053512
.0155612
married | .2006903 .0406775 4.93 0.000 .1208595
.2805211
south | -.0515532 .0311279 -1.66 0.098 -.1126426
.0095361
urban | .1767058 .0282117 6.26 0.000 .1213394
.2320722
black | -.0225612 .0739597 -0.31 0.760 -.1677093
.1225869
educ | .0250321 .0166068 1.51 0.132 -.0075591
.0576234
_cons | 4.592453 .3257807 14.10 0.000 3.953099
5.231807
-----------------------------------------------------------------------------
-
Instrumented: iq
Instruments: exper tenure married south urban black educ kww
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
hours | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
lwage | 1639.556 470.5757 3.48 0.001 714.5914
2564.52
educ | -183.7513 59.09981 -3.11 0.002 -299.918 -
67.58463
age | -7.806094 9.378013 -0.83 0.406 -26.23953
10.62734
kidslt6 | -198.1543 182.9291 -1.08 0.279 -557.72
161.4115
nwifeinc | -10.16959 6.614743 -1.54 0.125 -23.17154
2.832358
_cons | 2225.662 574.5641 3.87 0.000 1096.298
3355.026
-----------------------------------------------------------------------------
-
Instrumented: lwage
Instruments: educ age kidslt6 nwifeinc exper expersq
-----------------------------------------------------------------------------
-
reg hours lwage educ age kidslt6 nwifeinc
-----------------------------------------------------------------------------
-
hours | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
lwage | -2.0468 54.88014 -0.04 0.970 -109.9193
105.8257
educ | -6.621869 18.11627 -0.37 0.715 -42.23123
28.98749
age | .562254 5.140012 0.11 0.913 -9.540961
10.66547
kidslt6 | -328.8584 101.4573 -3.24 0.001 -528.2831 -
129.4338
nwifeinc | -5.918458 3.683341 -1.61 0.109 -13.15844
1.321522
_cons | 1523.775 305.5755 4.99 0.000 923.1353
2124.414
-----------------------------------------------------------------------------
-
ivreg lwage (hours = age kidslt6 nwifeinc) educ exper expersq
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
hours | .0001259 .0002546 0.49 0.621 -.0003746
.0006264
educ | .11033 .0155244 7.11 0.000 .0798155
.1408445
exper | .0345824 .0194916 1.77 0.077 -.00373
.0728947
expersq | -.0007058 .0004541 -1.55 0.121 -.0015983
.0001868
_cons | -.6557256 .3377883 -1.94 0.053 -1.319678
.008227
-----------------------------------------------------------------------------
-
Instrumented: hours
Instruments: educ exper expersq age kidslt6 nwifeinc
-----------------------------------------------------------------------------
-
Example 16.6: Inflation and Openness
First-stage regressions
-----------------------
-----------------------------------------------------------------------------
-
open | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
lpcinc | .5464794 1.49324 0.37 0.715 -2.412475
3.505433
lland | -7.567103 .8142162 -9.29 0.000 -9.180527 -
5.953679
_cons | 117.0845 15.8483 7.39 0.000 85.68007
148.489
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
inf | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
open | -.3374869 .1441212 -2.34 0.021 -.6230726 -
.0519012
lpcinc | .3758232 2.015081 0.19 0.852 -3.617194
4.36884
_cons | 26.89934 15.4012 1.75 0.083 -3.619157
57.41784
-----------------------------------------------------------------------------
-
Instrumented: open
Instruments: lpcinc lland
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
gc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
r3 | -.0002698 .0007639 -0.35 0.726 -.0018258
.0012861
gy | .5826032 .0747338 7.80 0.000 .4303755
.7348309
_cons | .0081396 .002054 3.96 0.000 .0039557
.0123236
-----------------------------------------------------------------------------
-
Instrumented: r3
Instruments: gy L.gc L.gy L.r3
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
gcriv | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
cag0_14 | -2483.038 1400.61 -1.77 0.077 -5232.917
266.8405
cag15_17 | 10.79079 2.677477 4.03 0.000 5.533976
16.04759
cag18_24 | -.4464182 1.756685 -0.25 0.799 -3.895395
3.002558
cag25_34 | -4.329303 1.407631 -3.08 0.002 -7.092966 -
1.56564
cunem | .0053237 .0027825 1.91 0.056 -.0001393
.0107867
cblack | -.0021635 .0358322 -0.06 0.952 -.0725144
.0681874
cmetro | .0018484 .0108955 0.17 0.865 -.0195432
.02324
gincpc | .9395616 .151253 6.21 0.000 .6425999
1.236523
gpolpc | .0854818 .0585893 1.46 0.145 -.0295491
.2005127
gpris | -.1739892 .0482266 -3.61 0.000 -.2686747 -
.0793038
_cons | .0386684 .0335862 1.15 0.250 -.0272729
.1046097
-----------------------------------------------------------------------------
-
ivreg gcriv cag0_14 cag15_17 cag18_24 cag25_34 cunem cblack cmetro gincpc
gpolpc (gpris = final1 final2)
Instrumental variables (2SLS) regression
-----------------------------------------------------------------------------
-
gcriv | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpris | -.9942312 .3589068 -2.77 0.006 -1.698889 -
.2895738
cag0_14 | -3138.017 1687.888 -1.86 0.063 -6451.922
175.8876
cag15_17 | 5.211254 3.990898 1.31 0.192 -2.624253
13.04676
cag18_24 | -2.638793 2.291848 -1.15 0.250 -7.138478
1.860893
cag25_34 | -5.737185 1.779489 -3.22 0.001 -9.230934 -
2.243436
cunem | .008557 .0035887 2.38 0.017 .0015112
.0156027
cblack | -.003239 .0425733 -0.08 0.939 -.0868251
.080347
cmetro | -.0045437 .0132357 -0.34 0.731 -.03053
.0214425
gincpc | .9112354 .1801137 5.06 0.000 .5576101
1.264861
gpolpc | .0641088 .0702171 0.91 0.362 -.0737516
.2019692
_cons | .0987133 .047591 2.07 0.038 .0052758
.1921508
-----------------------------------------------------------------------------
-
Instrumented: gpris
Instruments: cag0_14 cag15_17 cag18_24 cag25_34 cunem cblack cmetro gincpc
gpolpc final1 final2
-----------------------------------------------------------------------------
-
c | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
p | .1929343 .0912102 2.12 0.049 .0004977
.385371
p1 | .0898847 .0906479 0.99 0.335 -.1013658
.2811351
w | .7962188 .0399439 19.93 0.000 .7119444
.8804931
_cons | 16.2366 1.302698 12.46 0.000 13.48815
18.98506
-----------------------------------------------------------------------------
-
Table 16.4, 2SLS using reg3, page 687.
reg3 (c p p1 w), 2sls nodfk inst(t wg g yr p1 x1 k1)
-----------------------------------------------------------------------------
-
| Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
c |
p | .0173022 .1180494 0.15 0.885 -.2317603
.2663647
p1 | .2162338 .107268 2.02 0.060 -.0100818
.4425495
w | .8101827 .0402497 20.13 0.000 .7252632
.8951022
_cons | 16.55476 1.320793 12.53 0.000 13.76813
19.34139
-----------------------------------------------------------------------------
-
Endogenous variables: c p w
Exogenous variables: t wg g yr p1 x1 k1
-----------------------------------------------------------------------------
-
Table 16.4, 2SLS using ivreg, page 687. The initial ivreg produces the correct coefficients but
the standard errors are wrong. Additional code is necessary to obtain the correct standard errors.
ivreg c p1 (p w = t wg g yr p1 x1 k1)
-----------------------------------------------------------------------------
-
c | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
p | .0173022 .1312046 0.13 0.897 -.2595153
.2941197
w | .8101827 .0447351 18.11 0.000 .7158
.9045654
p1 | .2162338 .1192217 1.81 0.087 -.0353019
.4677696
_cons | 16.55476 1.467979 11.28 0.000 13.45759
19.65192
-----------------------------------------------------------------------------
-
Instrumented: p w
Instruments: p1 t wg g yr x1 k1
-----------------------------------------------------------------------------
-
se[1,4]
p w p1 _cons
y1 .11804942 .04024972 .10726797 1.3207925
Table 16.4, GMM, page 687. Uses ivgmm0 by Christopher F. Baum and David M. Drukker,
available from SSC-Ideas. The program ivgmm0 can be downloaded typing findit ivgmm0 in
the command line (see How can I use the findit command to search for programs and get
additional help? for more information about using findit). The standard errors are the same as
Greene but the coefficients are slightly different. Results identical to Stata are produced by the
program TSP. Some researchers suggest that Greene's coefficients are due to the fact that he uses
the results from prior analyses as his starting values.
ivgmm0 c p1 (p w = t wg g yr p1 x1 k1)
-----------------------------------------------------------------------------
-
| Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
c |
p | .0173022 .1180494 0.15 0.884 -.2196919
.2542963
p1 | .2162338 .107268 2.02 0.049 .0008844
.4315833
w | .8101827 .0402497 20.13 0.000 .729378
.8909874
_cons | 16.55476 1.320793 12.53 0.000 13.90316
19.20636
-------------+---------------------------------------------------------------
-
i |
p | .1502219 .1732292 0.87 0.390 -.1975503
.4979941
p1 | .6159434 .1627853 3.78 0.000 .2891382
.9427486
k1 | -.1577876 .0361262 -4.37 0.000 -.2303141 -
.0852612
_cons | 20.27821 7.542704 2.69 0.010 5.135599
35.42082
-------------+---------------------------------------------------------------
-
wp |
x | .4388591 .0356319 12.32 0.000 .3673251
.5103931
x1 | .1466739 .0388361 3.78 0.000 .0687071
.2246406
yr | .1303956 .029141 4.47 0.000 .0718927
.1888985
_cons | 1.500296 1.147779 1.31 0.197 -.8039674
3.804559
-----------------------------------------------------------------------------
-
Endogenous variables: c p w i wp x
Exogenous variables: t wg g yr p1 x1 k1
-----------------------------------------------------------------------------
-
Table 16.5, OLS, page 699.
reg3 (c p p1 w) (i p p1 k1) (wp x x1 yr), ols
Multivariate regression
----------------------------------------------------------------------
Equation Obs Parms RMSE "R-sq" F-Stat P
----------------------------------------------------------------------
c 21 3 1.02554 0.9810 292.7075 0.0000
i 21 3 1.009447 0.9313 76.87538 0.0000
wp 21 3 .7671466 0.9874 444.5687 0.0000
----------------------------------------------------------------------
-----------------------------------------------------------------------------
-
| Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
c |
p | .1929343 .0912102 2.12 0.039 .0098223
.3760464
p1 | .0898847 .0906479 0.99 0.326 -.0920987
.271868
w | .7962188 .0399439 19.93 0.000 .716028
.8764095
_cons | 16.2366 1.302698 12.46 0.000 13.62133
18.85188
-------------+---------------------------------------------------------------
-
i |
p | .4796356 .0971146 4.94 0.000 .28467
.6746012
p1 | .3330387 .1008592 3.30 0.002 .1305554
.535522
k1 | -.1117947 .0267276 -4.18 0.000 -.1654525 -
.0581369
_cons | 10.12579 5.465546 1.85 0.070 -.8467492
21.09833
-------------+---------------------------------------------------------------
-
wp |
x | .4394769 .0324076 13.56 0.000 .374416
.5045378
x1 | .14609 .0374231 3.90 0.000 .07096
.22122
yr | .1302452 .0319103 4.08 0.000 .0661826
.1943077
_cons | 1.497043 1.270031 1.18 0.244 -1.052651
4.046737
-----------------------------------------------------------------------------
-
Table 16.5, 3SLS, page 699.
reg3 (c p p1 w) (i p p1 k1) (wp x x1 yr), 3sls inst(t wg g yr p1 x1 k1)
-----------------------------------------------------------------------------
-
| Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
c |
p | .1248904 .1081291 1.16 0.248 -.0870387
.3368194
p1 | .1631439 .1004382 1.62 0.104 -.0337113
.3599992
w | .790081 .0379379 20.83 0.000 .715724
.8644379
_cons | 16.44079 1.304549 12.60 0.000 13.88392
18.99766
-------------+---------------------------------------------------------------
-
i |
p | -.0130791 .1618962 -0.08 0.936 -.3303898
.3042316
p1 | .7557238 .1529331 4.94 0.000 .4559805
1.055467
k1 | -.1948482 .0325307 -5.99 0.000 -.2586072 -
.1310893
_cons | 28.17785 6.793768 4.15 0.000 14.86231
41.49339
-------------+---------------------------------------------------------------
-
wp |
x | .4004919 .0318134 12.59 0.000 .3381388
.462845
x1 | .181291 .0341588 5.31 0.000 .1143411
.2482409
yr | .149674 .0279352 5.36 0.000 .094922
.2044261
_cons | 1.797216 1.115854 1.61 0.107 -.3898181
3.984251
-----------------------------------------------------------------------------
-
Endogenous variables: c p w i wp x
Exogenous variables: t wg g yr p1 x1 k1
-----------------------------------------------------------------------------
-
Table 16.5, I3SLS, page 699.
reg3 (c p p1 w) (i p p1 k1) (wp x x1 yr), 3sls ireg3 inst(t wg g yr p1 x1 k1)
-----------------------------------------------------------------------------
-
inlf | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nwifeinc | -.0034052 .0014485 -2.35 0.019 -.0062488 -
.0005616
educ | .0379953 .007376 5.15 0.000 .023515
.0524756
exper | .0394924 .0056727 6.96 0.000 .0283561
.0506287
expersq | -.0005963 .0001848 -3.23 0.001 -.0009591 -
.0002335
age | -.0160908 .0024847 -6.48 0.000 -.0209686 -
.011213
kidslt6 | -.2618105 .0335058 -7.81 0.000 -.3275875 -
.1960335
kidsge6 | .0130122 .013196 0.99 0.324 -.0128935
.0389179
_cons | .5855192 .154178 3.80 0.000 .2828442
.8881943
-----------------------------------------------------------------------------
-
logit inlf nwifeinc educ exper expersq age kidslt6 kidsge6
-----------------------------------------------------------------------------
-
inlf | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nwifeinc | -.0213452 .0084214 -2.53 0.011 -.0378509 -
.0048394
educ | .2211704 .0434396 5.09 0.000 .1360303
.3063105
exper | .2058695 .0320569 6.42 0.000 .1430391
.2686999
expersq | -.0031541 .0010161 -3.10 0.002 -.0051456 -
.0011626
age | -.0880244 .014573 -6.04 0.000 -.116587 -
.0594618
kidslt6 | -1.443354 .2035849 -7.09 0.000 -1.842373 -
1.044335
kidsge6 | .0601122 .0747897 0.80 0.422 -.086473
.2066974
_cons | .4254524 .8603696 0.49 0.621 -1.260841
2.111746
-----------------------------------------------------------------------------
-
probit inlf nwifeinc educ exper expersq age kidslt6 kidsge6
-----------------------------------------------------------------------------
-
inlf | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nwifeinc | -.0120237 .0048398 -2.48 0.013 -.0215096 -
.0025378
educ | .1309047 .0252542 5.18 0.000 .0814074
.180402
exper | .1233476 .0187164 6.59 0.000 .0866641
.1600311
expersq | -.0018871 .0006 -3.15 0.002 -.003063 -
.0007111
age | -.0528527 .0084772 -6.23 0.000 -.0694678 -
.0362376
kidslt6 | -.8683285 .1185223 -7.33 0.000 -1.100628 -
.636029
kidsge6 | .036005 .0434768 0.83 0.408 -.049208
.1212179
_cons | .2700768 .508593 0.53 0.595 -.7267472
1.266901
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
hours | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nwifeinc | -3.446636 2.544 -1.35 0.176 -8.440898
1.547626
educ | 28.76112 12.95459 2.22 0.027 3.329284
54.19297
exper | 65.67251 9.962983 6.59 0.000 46.11365
85.23138
expersq | -.7004939 .3245501 -2.16 0.031 -1.337635 -
.0633524
age | -30.51163 4.363868 -6.99 0.000 -39.07858 -
21.94469
kidslt6 | -442.0899 58.8466 -7.51 0.000 -557.6148 -
326.565
kidsge6 | -32.77923 23.17622 -1.41 0.158 -78.2777
12.71924
_cons | 1330.482 270.7846 4.91 0.000 798.8906
1862.074
-----------------------------------------------------------------------------
-
tobit hours nwifeinc educ exper expersq age kidslt6 kidsge6, ll(0)
-----------------------------------------------------------------------------
-
hours | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
nwifeinc | -8.814243 4.459096 -1.98 0.048 -17.56811 -
.0603725
educ | 80.64561 21.58322 3.74 0.000 38.27453
123.0167
exper | 131.5643 17.27938 7.61 0.000 97.64231
165.4863
expersq | -1.864158 .5376615 -3.47 0.001 -2.919667 -
.8086479
age | -54.40501 7.418496 -7.33 0.000 -68.96862 -
39.8414
kidslt6 | -894.0217 111.8779 -7.99 0.000 -1113.655 -
674.3887
kidsge6 | -16.218 38.64136 -0.42 0.675 -92.07675
59.64075
_cons | 965.3053 446.4358 2.16 0.031 88.88531
1841.725
-------------+---------------------------------------------------------------
-
_se | 1122.022 41.57903 (Ancillary parameter)
-----------------------------------------------------------------------------
-
Changes in probability
* fixup for expersq : take square of mean rather than mean of square per JMW
summ exper,meanonly
local exp2=r(mean)^2
mfx compute, at(mean expersq=`exp2') predict(ystar(0,.))
-----------------------------------------------------------------------------
-
narr86 | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
pcnv | -.4015713 .0849712 -4.73 0.000 -.5681117 -
.2350308
avgsen | -.0237723 .019946 -1.19 0.233 -.0628658
.0153212
tottime | .0244904 .0147504 1.66 0.097 -.0044199
.0534006
ptime86 | -.0985584 .0206946 -4.76 0.000 -.1391192 -
.0579977
qemp86 | -.0380187 .0290242 -1.31 0.190 -.0949051
.0188677
inc86 | -.0080807 .001041 -7.76 0.000 -.010121 -
.0060404
black | .6608376 .0738342 8.95 0.000 .5161252
.80555
hispan | .4998133 .0739267 6.76 0.000 .3549196
.644707
born60 | -.0510286 .0640518 -0.80 0.426 -.1765678
.0745106
_cons | -.5995888 .0672501 -8.92 0.000 -.7313966 -
.467781
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
ldurat | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
workprg | -.0625715 .1200369 -0.52 0.602 -.2980382
.1728951
priors | -.1372529 .0214587 -6.40 0.000 -.1793466 -
.0951592
tserved | -.0193305 .0029779 -6.49 0.000 -.0251721 -
.013489
felon | .4439947 .1450865 3.06 0.002 .1593903
.7285991
alcohol | -.6349093 .1442166 -4.40 0.000 -.9178072 -
.3520113
drugs | -.2981602 .1327356 -2.25 0.025 -.5585367 -
.0377836
black | -.5427179 .1174428 -4.62 0.000 -.7730958 -
.31234
married | .3406837 .1398431 2.44 0.015 .066365
.6150024
educ | .0229196 .0253974 0.90 0.367 -.0269004
.0727395
age | .0039103 .0006062 6.45 0.000 .0027211
.0050994
_cons | 4.099386 .3475351 11.80 0.000 3.417655
4.781117
-------------+---------------------------------------------------------------
-
_se | 1.81047 .0623022 (Ancillary parameter)
-----------------------------------------------------------------------------
-
mat pct=e(Xmfx_dydx)
matmap pct pct, m(100*(exp(@)-1))
mat list pct
pct[1,10]
workprg priors tserved felon alcohol drugs
r1 -6.0654125 -12.825026 -1.9144899 55.892217 -47.001643 -25.781754
-----------------------------------------------------------------------------
-
lwage | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
educ | .1074896 .0141465 7.60 0.000 .0796837
.1352956
exper | .0415665 .0131752 3.15 0.002 .0156697
.0674633
expersq | -.0008112 .0003932 -2.06 0.040 -.0015841 -
.0000382
_cons | -.5220407 .1986321 -2.63 0.009 -.9124668 -
.1316145
-----------------------------------------------------------------------------
-
heckman lwage educ exper expersq, sel(inlf = nwifeinc educ exper expersq age
kidslt6 kidsge6) twostep
Wald chi2(6) =
180.10
Prob > chi2 =
0.0000
-----------------------------------------------------------------------------
-
| Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
lwage |
educ | .1090655 .015523 7.03 0.000 .0786411
.13949
exper | .0438873 .0162611 2.70 0.007 .0120163
.0757584
expersq | -.0008591 .0004389 -1.96 0.050 -.0017194 1.15e-
06
_cons | -.5781033 .3050062 -1.90 0.058 -1.175904
.0196979
-------------+---------------------------------------------------------------
-
inlf |
nwifeinc | -.0120237 .0048398 -2.48 0.013 -.0215096 -
.0025378
educ | .1309047 .0252542 5.18 0.000 .0814074
.180402
exper | .1233476 .0187164 6.59 0.000 .0866641
.1600311
expersq | -.0018871 .0006 -3.15 0.002 -.003063 -
.0007111
age | -.0528527 .0084772 -6.23 0.000 -.0694678 -
.0362376
kidslt6 | -.8683285 .1185223 -7.33 0.000 -1.100628 -
.636029
kidsge6 | .036005 .0434768 0.83 0.408 -.049208
.1212179
_cons | .2700768 .508593 0.53 0.595 -.7267472
1.266901
-------------+---------------------------------------------------------------
-
mills |
lambda | .0322619 .1336246 0.24 0.809 -.2296376
.2941613
-------------+---------------------------------------------------------------
-
rho | 0.04861
sigma | .66362876
lambda | .03226186 .1336246
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | .4638517 .1619563 2.86 0.008 .1320992
.7956043
tuce | .0104951 .0194829 0.54 0.594 -.0294137
.0504039
psi | .3785548 .1391727 2.72 0.011 .0934724
.6636372
_cons | -1.498017 .5238886 -2.86 0.008 -2.571154 -
.4248801
-----------------------------------------------------------------------------
-
The slope for each parameter in the case of linear regression is simply the parameter itself since
it is linear. The density function is simply the constant 1 for linear regression. The column for
logistic regression of Table 19.1 is obtained using a logistic regression model.
logit grade gpa tuce psi
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 2.826113 1.262941 2.24 0.025 .3507938
5.301432
tuce | .0951577 .1415542 0.67 0.501 -.1822835
.3725988
psi | 2.378688 1.064564 2.23 0.025 .29218
4.465195
_cons | -13.02135 4.931325 -2.64 0.008 -22.68657 -
3.35613
-----------------------------------------------------------------------------
-
In Stata 7, we use the mfx command to get the marginal effect with option nodiscrete so the
variable psi is treated as a continuous variable.
mfx compute, nodiscrete
matrix list m
m[1,4]
gpa tuce psi _cons
_cons 3.1171875 21.9375 .4375 1
matrix c=x*m'
matrix list c
symmetric c[1,1]
_cons
y1 -1.083627
Now we use the density function for the logistic distribution (19-11) on page 815 to get the scale
factor below.
di exp(trace(c))/(1+exp(trace(c)))^2
.18890217
The column for probit regression of Table 19.1 is obtained using a probit model.
probit grade gpa tuce psi
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 1.62581 .6938818 2.34 0.019 .2658269
2.985794
tuce | .0517289 .0838901 0.62 0.537 -.1126927
.2161506
psi | 1.426332 .595037 2.40 0.017 .2600814
2.592583
_cons | -7.45232 2.542467 -2.93 0.003 -12.43546 -
2.469177
-----------------------------------------------------------------------------
-
In the same way as in logistic regression, we can to get the marginal effect using mfx and treat
psi as a continuous variable.
mfx compute, nodiscrete
matrix c=x*m'
Now we use the standard normal distribution for the probit model to get the scale factor.
di normalden(trace(c))
.32805002
Last column of Table 19.1 is obtained using a little bit more maximum likelihood programming
in Stata.
gen d0 = 1-grade
gen d1 = grade
version 6
args lnf theta
quietly replace `lnf'=-d0*exp(`theta')+d1*log(1-exp(-exp(`theta')))
end
Number of obs =
32
Wald chi2(3) =
10.19
Log likelihood = -13.008003 Prob > chi2 =
0.0170
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 2.293553 1.035001 2.22 0.027 .2649881
4.322118
tuce | .041156 .1073136 0.38 0.701 -.1691748
.2514867
psi | 1.562276 .7305064 2.14 0.032 .1305096
2.994042
_cons | -10.03142 3.479058 -2.88 0.004 -16.85025 -
3.212591
-----------------------------------------------------------------------------
-
Now let's calculate the slope at mean, this is the last column in Table 19.1 Using the model
specified in Example 19.1, we can derive the derivative and plug in the mean vector. Matrix x
stores the coefficient estimates and matrix m stores the mean vector of independent variables
including the constant term. Finally vector y stores the slope for each independent variable at its
mean value. The last display shows the scale factor computed at the means of the variables.
matrix x=e(b)
matrix accum a=gpa tuce psi, mean(m)
(obs=32)
matrix c=x*m'
matrix list c
symmetric c[1,1]
_cons
y1 -1.2956303
local d = exp(-exp(trace(c)))*exp(trace(c))
matrix y=`d'*x
matrix list y
y[1,4]
eq1: eq1: eq1: eq1:
gpa tuce psi _cons
y1 .47747024 .00856782 .3252335 -2.0883339
di exp(-exp(trace(c)))*exp(trace(c))
20817929
Example 19.2 on page 817.
gen ps1_0=norm(-7.45+1.62*gpa+.052*21.938)
gen ps1_1=norm(-7.45+1.62*gpa+.052*21.938+1.4263)
sort gpa
graph twoway scatter ps1_0 ps1_1 gpa if gpa>=2, msymbol(i i) connect(l l)
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 2.826113 1.262941 2.24 0.025 .3507938
5.301432
tuce | .0951577 .1415542 0.67 0.501 -.1822835
.3725988
psi | 2.378688 1.064564 2.23 0.025 .29218
4.465195
_cons | -13.02135 4.931325 -2.64 0.008 -22.68657 -
3.35613
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 1.62581 .6938818 2.34 0.019 .2658269
2.985794
tuce | .0517289 .0838901 0.62 0.537 -.1126927
.2161506
psi | 1.426332 .595037 2.40 0.017 .2600814
2.592583
_cons | -7.45232 2.542467 -2.93 0.003 -12.43546 -
2.469177
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 2.826113 1.262941 2.24 0.025 .3507938
5.301432
tuce | .0951577 .1415542 0.67 0.501 -.1822835
.3725988
psi | 2.378688 1.064564 2.23 0.025 .29218
4.465195
_cons | -13.02135 4.931325 -2.64 0.008 -22.68657 -
3.35613
-----------------------------------------------------------------------------
-
Now let's do the second part of the example. We first run the full model and then run separate
models for the case when psi==0 and when psi==1. We store the log likelihood in a local
variable for each model and compare them afterwards.
probit grade gpa tuce
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 1.409575 .6354662 2.22 0.027 .1640846
2.655066
tuce | .0526675 .0755527 0.70 0.486 -.0954132
.2007481
_cons | -6.034327 2.121027 -2.85 0.004 -10.19146 -
1.877191
-----------------------------------------------------------------------------
-
local l10 = e(ll)
probit grade gpa tuce if psi==0
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 3.092025 1.813587 1.70 0.088 -.4625411
6.646591
tuce | .1535286 .2708777 0.57 0.571 -.377382
.6844391
_cons | -14.90758 9.85688 -1.51 0.130 -34.22671
4.411545
-----------------------------------------------------------------------------
-
local l0=e(ll)
probit grade gpa tuce if psi==1
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 1.102962 .7846481 1.41 0.160 -.4349205
2.640844
tuce | .0276161 .0984905 0.28 0.779 -.1654217
.2206539
_cons | -3.870036 2.861729 -1.35 0.176 -9.478921
1.738849
-----------------------------------------------------------------------------
-
local l1=e(ll)
di 2*(`l1'+`l0'-`l10')
8.5473743
di chi2tail(3, 8.54743)
03595439
We can also get the critical value for 95%.
di invchi2tail(3, .05)
7.8147278
Example 19.7 and Table 19.3 on page 830. The first estimate is obtained by running a probit
model and the second one is obtained by running heteroscedastic probit model.
probit grade gpa tuce psi
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gpa | 1.62581 .6938818 2.34 0.019 .2658269
2.985794
tuce | .0517289 .0838901 0.62 0.537 -.1126927
.2161506
psi | 1.426332 .595037 2.40 0.017 .2600814
2.592583
_cons | -7.45232 2.542467 -2.93 0.003 -12.43546 -
2.469177
-----------------------------------------------------------------------------
-
Wald chi2(3) =
3.33
Log likelihood = -11.89585 Prob > chi2 =
0.3438
-----------------------------------------------------------------------------
-
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
grade |
gpa | 3.12155 1.760869 1.77 0.076 -.3296887
6.572789
tuce | .1237515 .2134227 0.58 0.562 -.2945493
.5420523
psi | 2.34322 1.670631 1.40 0.161 -.9311565
5.617597
_cons | -14.28904 8.860899 -1.61 0.107 -31.65609
3.077997
-------------+---------------------------------------------------------------
-
lnsigma2 |
psi | 1.093371 .8805796 1.24 0.214 -.6325333
2.819275
-----------------------------------------------------------------------------
-
Likelihood ratio test of lnsigma2=0: chi2(1) = 1.85 Prob > chi2 =
0.1743
The first LR test comes as a part of the output from the hetprob procedure as shown above. Stata
does not have a LM test yet. For Wald test, we can simply calculate it manually as shown in the
book. Stata's hetprobit has an option that does robust standard error estimate and Wald test for it
as shown after our manual computation of Wald test.
di (1.09337/.8805795)^2
1.5416904
Wald chi2(3) =
9.51
Log likelihood = -11.89585 Prob > chi2 =
0.0232
-----------------------------------------------------------------------------
-
| Robust
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
grade |
gpa | 3.121551 1.129778 2.76 0.006 .9072259
5.335875
tuce | .1237516 .1428788 0.87 0.386 -.1562857
.4037888
psi | 2.343221 1.502745 1.56 0.119 -.6021045
5.288546
_cons | -14.28905 4.881214 -2.93 0.003 -23.85605 -
4.722045
-------------+---------------------------------------------------------------
-
lnsigma2 |
psi | 1.093371 .7252922 1.51 0.132 -.3281753
2.514918
-----------------------------------------------------------------------------
-
Wald test of lnsigma2=0: chi2(1) = 2.27 Prob > chi2 =
0.1317
Example 19.18 on page 868 on nested logit. The independent variables are ttme -- terminal time
(zero for car), hinc -- household income and gc -- generalized cost. The dependent variable is
mode--the choice that a person makes among four travel modes. The data set is in such a format
that each person has as many observations as the number of choices. For instance, in our case,
each person has four choices and there are 210 people in the dataset. Therefore, the total number
of observations in this dataset is 210*4 = 840. In other words, each four observations in the
dataset correspond to a choice that a person makes. In order to run the nested logit analysis in
Stata 7, we need to create a couple of variables needed to build up the nested logit tree. First, we
need a group variable that corresponds to a person. In our case, every four observations will be a
group. This is done by using command generate with group function. Secondly we need a
variable that corresponds to all the possible choices. To this end, we generate a variable called
travel based on the group variable.
use http://www.ats.ucla.edu/stat/stata/examples/greene/TBL19-2, clear
top-->bottom
type travel
------------------------
fly air
ground train
bus
car
We have successfully built the nested logit tree now. We need more dummy variables for the
choices and interaction of choices with household income. We create them below.
gen aasc = mod(_n, 4)==1
gen tasc = mod(_n, 4)==2
gen basc = mod(_n, 4)==3
gen casc = mod(_n, 4)==0
gen hincair = hinc*aasc
The following model corresponds to Table 19.12 on page 869, the unconditional estimate. Since
the model is not nested, it gives the exact output as clogit shown below. In this case, we should
use clogit since it is much faster.
nlogit mode (travel = aasc tasc basc gc ttme hincair), group(grp)
note: nonnested model, results are the same as -clogit-
Nested logit
Levels = 1 Number of obs =
840
Dependent variable = mode LR chi2(6) =
183.9869
Log likelihood = -199.12837 Prob > chi2 =
0.0000
-----------------------------------------------------------------------------
-
| Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
travel |
aasc | 5.207443 .7790551 6.68 0.000 3.680523
6.734363
tasc | 3.869043 .4431269 8.73 0.000 3.00053
4.737555
basc | 3.163194 .4502659 7.03 0.000 2.280689
4.045699
gc | -.0155015 .004408 -3.52 0.000 -.024141 -
.006862
ttme | -.0961248 .0104398 -9.21 0.000 -.1165865 -
.0756631
hincair | .013287 .0102624 1.29 0.195 -.0068269
.033401
-------------+---------------------------------------------------------------
-
(IV params) |
|
(none) |
-----------------------------------------------------------------------------
-
LR test of homoskedasticity (iv = 1): chi2(0)= 0.00 Prob > chi2 =
.
-----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
-
mode | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
aasc | 5.207443 .7790525 6.68 0.000 3.680528
6.734358
tasc | 3.869043 .4431252 8.73 0.000 3.000533
4.737552
basc | 3.163194 .4502646 7.03 0.000 2.280692
4.045697
gc | -.0155015 .004408 -3.52 0.000 -.024141 -
.006862
ttme | -.0961248 .0104398 -9.21 0.000 -.1165864 -
.0756632
hincair | .013287 .0102624 1.29 0.195 -.0068269
.0334009
-----------------------------------------------------------------------------
-
The following model corresponds to Table 19.12 on page 869, the FIML estimate.
nlogit mode (travel = aasc tasc basc gc ttme) (type=hincair), group(grp)
tree structure specified for the nested logit model
top-->bottom
type travel
------------------------
fly air
ground train
bus
car
Nested logit
Levels = 2 Number of obs =
840
Dependent variable = mode LR chi2(8) =
194.9313
Log likelihood = -193.65615 Prob > chi2 =
0.0000
-----------------------------------------------------------------------------
-
| Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
travel |
aasc | 6.042255 1.198907 5.04 0.000 3.692441
8.39207
tasc | 5.064679 .6620317 7.65 0.000 3.767121
6.362237
basc | 4.096302 .6151582 6.66 0.000 2.890614
5.30199
gc | -.0315888 .0081566 -3.87 0.000 -.0475754 -
.0156022
ttme | -.1126183 .0141293 -7.97 0.000 -.1403111 -
.0849254
-------------+---------------------------------------------------------------
-
type |
hincair | .0153337 .0093814 1.63 0.102 -.0030534
.0337209
-------------+---------------------------------------------------------------
-
(IV params) |
|
type |
/fly | .5859993 .1406199 4.17 0.000 .3103894
.8616092
/ground | .3889488 .1236623 3.15 0.002 .1465753
.6313224
-----------------------------------------------------------------------------
-
LR test of homoskedasticity (iv = 1): chi2(2)= 10.94 Prob > chi2 =
0.0042
-----------------------------------------------------------------------------
-
The following is an attempt to create a LIML (limited information maximum likelihood) model
corresponds to table 19.12, the LIML estimate. This is a two-step procedure. Stata currently does
not support LIML yet. So we have to do some extra work here. The first step is to estimate the
choice model for the three choices in the ground branch. Using variable type that we created
before for nested logit tree, we create a new variable called method to indicate the branches. We
then use clogit making use of the group structure.
tab type, gen(method)
-----------------------------------------------------------------------------
-
mode | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
tasc | 4.463668 .6405338 6.97 0.000 3.208245
5.719091
basc | 3.104744 .6090192 5.10 0.000 1.911088
4.2984
gc | -.0636819 .0100424 -6.34 0.000 -.0833646 -
.0439992
ttme | -.0698778 .0148803 -4.70 0.000 -.0990427 -
.040713
-----------------------------------------------------------------------------
-
So we have seen that we have correctly estimated the coefficient for variables tasc, basc, gc and
ttme. We now try to compute the inclusive values using the formula at the bottom of page 866.
matrix X=e(b)
matrix V1=e(V)
gen myivb=X[1,1]*tasc + X[1,2]*basc + X[1,3]*gc + X[1,4]*ttme
replace myivb = log(exp(myivb)+exp(myivb[_n+1])+exp(myivb[_n+2])) if
mod(_n,4)==2
(210 real changes made)
gen ivair=aasc*myivb
gen ivground=(1-aasc)*myivb
So far, we have the variables IV_fly and IV_ground computed correctly. Next step is to
compute the last model. Since we now look at a higher level we need to reshape our dataset. We
only have two choices, ground versus fly. The variable branch is created corresponding to the
two choices. We then have to drop half of the observations since we only have two choices for
each person instead of four. clogit is used again to obtain the parameter estimate for branch level
variables. You can see that the coefficient estimates are correct but not the standard error. This is
because LIML uses different method of estimating the standard errors which involves some
matrix computation.
preserve
gen branch=mode*type
replace branch = branch[_n+1] | branch[_n+2] | branch[_n] if mod(_n, 4)==2
(152 real changes made)
drop grp
gen grp=group(210)
clogit branch aasc hincair ivair ivground, group(grp)
-----------------------------------------------------------------------------
-
branch | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
aasc | -.0647031 .9836824 -0.07 0.948 -1.992685
1.863279
hincair | .0207877 .0085162 2.44 0.015 .0040962
.0374791
ivair | .2266246 .1005949 2.25 0.024 .0294622
.4237869
ivground | .158721 .0717853 2.21 0.027 .0180245
.2994175
-----------------------------------------------------------------------------
-
restore
Example 19.22 on Poisson regression. We'll skip here the measure of goodness-of-fit based on
the standardized residuals and the measure based on the deviance.
use http://www.ats.ucla.edu/stat/stata/examples/greene/tbl19-3, clear
gen logm=log(months)
(6 missing values generated)
-----------------------------------------------------------------------------
-
acc | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
tb | -.5447114 .1776135 -3.07 0.002 -.8928274 -
.1965954
tc | -.6887643 .3290358 -2.09 0.036 -1.333663 -
.043866
td | -.0743091 .2905578 -0.26 0.798 -.6437919
.4951737
te | .320529 .235752 1.36 0.174 -.1415365
.7825945
t6569 | .6958455 .1496562 4.65 0.000 .4025246
.9891663
t7074 | .8174555 .1698376 4.81 0.000 .4845798
1.150331
t7579 | .4449709 .2332392 1.91 0.056 -.0121695
.9021113
o7579 | .3838589 .1182605 3.25 0.001 .1520726
.6156451
logm | 1 . . . .
.
_cons | -6.402877 .2175228 -29.44 0.000 -6.829214 -
5.97654
-----------------------------------------------------------------------------
-
lrtest, saving(0)
* Stata 8 code.
poisgof
-----------------------------------------------------------------------------
-
acc | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
t6569 | .7536172 .1487663 5.07 0.000 .4620406
1.045194
t7074 | 1.050336 .1575621 6.67 0.000 .7415201
1.359152
t7579 | .6998992 .2203023 3.18 0.001 .2681146
1.131684
o7579 | .3872451 .1181021 3.28 0.001 .1557692
.618721
logm | 1 . . . .
.
_cons | -6.946953 .1269425 -54.73 0.000 -7.195756 -
6.69815
-----------------------------------------------------------------------------
-
lrtest, using(0)
* Stata 8 code.
poisgof
-----------------------------------------------------------------------------
-
acc | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
tb | -.7437271 .1691475 -4.40 0.000 -1.07525 -
.412204
tc | -.7548676 .3276393 -2.30 0.021 -1.397029 -
.1127063
td | -.1843232 .2875527 -0.64 0.522 -.7479161
.3792697
te | .3841932 .23479 1.64 0.102 -.0759868
.8443732
o7579 | .5000988 .1115645 4.48 0.000 .2814363
.7187612
logm | 1 . . . .
.
_cons | -5.799973 .1784196 -32.51 0.000 -6.149669 -
5.450278
-----------------------------------------------------------------------------
-
lrtest, using(0)
* Stata 8 code.
poisgof
use http://fmwww.bc.edu/ec-p/data/wooldridge/HSEINV
tsset year
-----------------------------------------------------------------------------
-
linvpc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
t | .0081459 .0018129 4.49 0.000 .0044819
.0118098
_cons | -.8412918 .044744 -18.80 0.000 -.9317228 -
.7508608
-----------------------------------------------------------------------------
-
predict elinvpc,r
reg elinvpc gprice L.elinvpc
-----------------------------------------------------------------------------
-
elinvpc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gprice | 3.094828 .9333266 3.32 0.002 1.205407
4.984249
elinvpc |
L1 | .3399015 .1315881 2.58 0.014 .0735154
.6062876
_cons | -.0099629 .017916 -0.56 0.581 -.046232
.0263061
-----------------------------------------------------------------------------
-
scalar lrpGDL = _b[gprice]/(1-_b[L.elinvpc])
display _n "long run propensity : " lrpGDL
-----------------------------------------------------------------------------
-
elinvpc | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gprice | 3.256352 .9703223 3.36 0.002 1.288447
5.224257
elinvpc |
L1 | .5471706 .1516713 3.61 0.001 .2395669
.8547743
gprice |
L1 | -2.936344 .9731857 -3.02 0.005 -4.910056 -
.9626315
_cons | .0058685 .0169326 0.35 0.731 -.0284725
.0402095
-----------------------------------------------------------------------------
-
scalar lrpRDL = (_b[gprice]+_b[L.gprice])/(1-_b[L.elinvpc])
display _n "long run propensity : " lrpRDL
use http://fmwww.bc.edu/ec-p/data/wooldridge/INTQRT
reg cr3 r3_1
-----------------------------------------------------------------------------
-
cr3 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
r3_1 | -.0907106 .0366782 -2.47 0.015 -.1633247 -
.0180965
_cons | .6253371 .2608254 2.40 0.018 .1089645
1.14171
-----------------------------------------------------------------------------
-
display "rho=" 1+_b[r3_1]
rho=.90928937
use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
reg cinf inf_1 cinf_1
-----------------------------------------------------------------------------
-
cinf | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
inf_1 | -.3103252 .1027077 -3.02 0.004 -.517319 -
.1033315
cinf_1 | .1383615 .1264025 1.09 0.280 -.1163861
.3931091
_cons | 1.360791 .5167103 2.63 0.012 .3194297
2.402152
-----------------------------------------------------------------------------
-
display "rho=" 1+_b[inf_1]
rho=.68967477
Example 18.4: Unit Root in the Log of U.S. Real Gross Domestic Product
use http://fmwww.bc.edu/ec-p/data/wooldridge/INVEN
tsset year
time variable: year, 1959 to 1995
gen lgdp=log(gdp)
reg D.lgdp year L.lgdp L.D.lgdp
-----------------------------------------------------------------------------
-
D.lgdp | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
year | .0058696 .002696 2.18 0.037 .0003711
.0113681
lgdp |
L1 | -.2096203 .0865941 -2.42 0.022 -.3862301 -
.0330104
LD | .2637479 .1647397 1.60 0.120 -.0722409
.5997367
_cons | -9.841804 4.620125 -2.13 0.041 -19.26461 -
.4189969
-----------------------------------------------------------------------------
-
display "rho=" 1+_b[L.lgdp]
rho=.79037972
reg D.lgdp L.lgdp L.D.lgdp
-----------------------------------------------------------------------------
-
D.lgdp | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
lgdp |
L1 | -.0226876 .0118894 -1.91 0.065 -.0469056
.0015304
LD | .1671587 .167669 1.00 0.326 -.1743718
.5086892
_cons | .2148862 .100468 2.14 0.040 .0102395
.4195328
-----------------------------------------------------------------------------
-
display "rho=" 1+_b[L.lgdp]
rho=.9773124
use http://fmwww.bc.edu/ec-p/data/wooldridge/FERTIL3
tsset year
-----------------------------------------------------------------------------
-
gfr | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
pe | .186662 .0346265 5.39 0.000 .1175841
.2557399
year | -.9051881 .1089923 -8.31 0.000 -1.122622 -
.6877543
_cons | 1840.65 210.0516 8.76 0.000 1421.608
2259.691
-----------------------------------------------------------------------------
-
predict uh, res
reg D.gfr D.pe year
-----------------------------------------------------------------------------
-
D.gfr | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
pe |
D1 | -.0441285 .0289463 -1.52 0.132 -.1018899
.0136329
year | -.007633 .0249413 -0.31 0.761 -.0574026
.0421367
_cons | 14.09361 48.61889 0.29 0.773 -82.92387
111.1111
-----------------------------------------------------------------------------
-
reg D.gfr L.gfr L.D.gfr year
-----------------------------------------------------------------------------
-
D.gfr | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
gfr |
L1 | -.0438938 .0297773 -1.47 0.145 -.1033461
.0155585
LD | .3092968 .1166811 2.65 0.010 .0763355
.5422581
year | -.0185421 .0282515 -0.66 0.514 -.074948
.0378638
_cons | 39.73213 56.5777 0.70 0.485 -73.22889
152.6931
-----------------------------------------------------------------------------
-
reg D.pe L.pe L.D.pe year
-----------------------------------------------------------------------------
-
D.pe | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
pe |
L1 | -.0661281 .0449466 -1.47 0.146 -.1558668
.0236106
LD | .2567035 .1220926 2.10 0.039 .0129377
.5004694
year | .0316731 .1463908 0.22 0.829 -.2606056
.3239517
_cons | -54.13747 282.2287 -0.19 0.848 -617.6253
509.3503
-----------------------------------------------------------------------------
-
reg D.uh L.uh L.D.uh year
-----------------------------------------------------------------------------
-
D.uh | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
uh |
L1 | -.1188282 .0490884 -2.42 0.018 -.2168364 -
.0208201
LD | .2378983 .1176739 2.02 0.047 .0029547
.4728418
year | .0257499 .0334197 0.77 0.444 -.0409748
.0924746
_cons | -50.38379 65.15702 -0.77 0.442 -180.474
79.7064
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/INTQRT
gen cr3_2 = cr3[_n-2]
gen cr3_1p = cr3[_n+1]
gen cr3_2p = cr3[_n+2]
reg r6 r3 cr3 cr3_1 cr3_2 cr3_1p cr3_2p
-----------------------------------------------------------------------------
-
r6 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
r3 | 1.038171 .0080773 128.53 0.000 1.022167
1.054175
cr3 | -.0531227 .0194406 -2.73 0.007 -.0916418 -
.0146036
cr3_1 | -.0611365 .0190433 -3.21 0.002 -.0988684 -
.0234046
cr3_2 | -.0437775 .0189032 -2.32 0.022 -.0812318 -
.0063233
cr3_1p | -.0035722 .0191223 -0.19 0.852 -.0414606
.0343163
cr3_2p | .0123662 .0189704 0.65 0.516 -.0252213
.0499536
_cons | .0651458 .0569524 1.14 0.255 -.047698
.1779895
-----------------------------------------------------------------------------
-
test r3
( 1) r3 = 0.0
F( 1, 112) =16519.67
Prob > F = 0.0000
reg r6 r3
-----------------------------------------------------------------------------
-
r6 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
r3 | 1.025899 .0077088 133.08 0.000 1.010639
1.04116
_cons | .1353736 .0548673 2.47 0.015 .0267584
.2439889
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/INTQRT
gen del = hy6_1 - hy3[_n-2]
reg chy6 chy3_1 del
-----------------------------------------------------------------------------
-
chy6 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
chy3_1 | 1.218363 .2636012 4.62 0.000 .6964068
1.74032
del | -.8400495 .2441269 -3.44 0.001 -1.323445 -
.3566539
_cons | .0898484 .042688 2.10 0.037 .0053219
.174375
-----------------------------------------------------------------------------
-
use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
reg unem unem_1
-----------------------------------------------------------------------------
-
unem | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
unem_1 | .7323538 .0968906 7.56 0.000 .5373231
.9273845
_cons | 1.571741 .5771181 2.72 0.009 .4100629
2.73342
-----------------------------------------------------------------------------
-
display "Forecast for 1997: " _b[_cons] +_b[unem_1]*5.4
-----------------------------------------------------------------------------
-
unem | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
unem_1 | .6470261 .0838056 7.72 0.000 .4782329
.8158192
inf_1 | .1835766 .0411828 4.46 0.000 .1006302
.2665231
_cons | 1.303797 .4896861 2.66 0.011 .3175188
2.290076
-----------------------------------------------------------------------------
-
display "Forecast for 1997: " _b[_cons] +_b[unem_1]*5.4 +_b[ inf_1]*3
-----------------------------------------------------------------------------
-
unem | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
un1 | .6470261 .0838056 7.72 0.000 .4782329
.8158192
inf1 | .1835766 .0411828 4.46 0.000 .1006302
.2665231
_cons | 5.348468 .1365394 39.17 0.000 5.073463
5.623472
-----------------------------------------------------------------------------
-
scalar down = _b[ _cons]-1.96*sqrt(_se[_cons]^2+e(rmse)^2)
scalar up= _b[_cons]+1.96*sqrt(_se[_cons]^2+e(rmse)^2)
display "95% forecast interval: [" down ","up "]"
use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
reg unem unem_1
-----------------------------------------------------------------------------
-
unem | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
unem_1 | .7323538 .0968906 7.56 0.000 .5373231
.9273845
_cons | 1.571741 .5771181 2.72 0.009 .4100629
2.73342
-----------------------------------------------------------------------------
-
display _n "RMSE : " %9.3f e(rmse)
RMSE : 1.049
qui {
predict eps1 if e(sample), r
replace eps1 = abs(eps)
summ eps1,meanonly
}
display _n "MAE : " %9.3f `r(mean)'
MAE : 0.813
reg unem unem_1 inf_1
-----------------------------------------------------------------------------
-
unem | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
unem_1 | .6470261 .0838056 7.72 0.000 .4782329
.8158192
inf_1 | .1835766 .0411828 4.46 0.000 .1006302
.2665231
_cons | 1.303797 .4896861 2.66 0.011 .3175188
2.290076
-----------------------------------------------------------------------------
-
display _n "RMSE : " %9.3f e(rmse)
RMSE : 0.883
qui {
predict eps if e(sample), r
replace eps = abs(eps)
summ eps,meanonly
}
display _n "MAE : " %9.3f `r(mean)'
MAE : 0.649
use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
reg inf inf_1
-----------------------------------------------------------------------------
-
inf | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
inf_1 | .6652586 .1069819 6.22 0.000 .4499151
.8806021
_cons | 1.27665 .5576568 2.29 0.027 .1541456
2.399155
-----------------------------------------------------------------------------
scalar inf1997 = _b[_cons]+_b[inf_1]*3
display "Forecast for inflation in 1997: " inf1997
-----------------------------------------------------------------------------
-
unem | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+---------------------------------------------------------------
-
unem_1 | .6470261 .0838056 7.72 0.000 .4782329
.8158192
inf_1 | .1835766 .0411828 4.46 0.000 .1006302
.2665231
_cons | 1.303797 .4896861 2.66 0.011 .3175188
2.290076
-----------------------------------------------------------------------------
-
display "Forecast for unemployment in 1998: "
_b[_cons]+_b[unem]*5.35+_b[inf_1]*inf1997
GENERAL SOURCES
These are suggestions – they are not meant to limit your choice of a topic.
www.rfe.org - RESOURCES FOR ECONOMISTS. This is a good overall site (and has a lot of
good data).
www.nber.org - National Bureau of Economic Research. The NBER does a lot of really
excellent empirical research. The papers on this site might be a bit technical, but browse through
their titles for ideas.
http://economics.about.com/mbody.htm - General site, the specific topics (health economics,
sports economics) may be good sources for ideas. The DATA SOURCES may also lead you to a
topic.
http://odwin.ucsd.edu/cgi-
bin/easy_search2?search=getdata&file=/data/data.html&print=notitle&header=/header/data.head
er Social Science Data on the Net
EDUCATION
I am sure you are all familiar with the US News Rankings of Colleges. These data are available
(in ICPSR) and can be used to answer a number of questions concerning education – questions
about tuition, professor’s salaries, quality of students, etc.
For a lot of education topics, you might want to pull in location data - i.e. if you are looking at
local school funding issues, you would need other information about the area. A good source for
location information is the City and County Data Books (available at the ICPSR site). These
give very detailed information at the county level – things like average income, age distribution
of population, housing values, etc.