-----------------------------------------------------------------------------------
       log:  /Users/baum/doc/Courses 2006-2007/EC77101S/771ivexamples.smcl
  log type:  smcl
 opened on:   4 Feb 2007, 12:05:16


. use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta,clear (Wages of Very Young Men, Zvi Griliches, J.Pol.Ec. 1976)

. xi i.year i.year _Iyear_66-73 (naturally coded; _Iyear_66 omitted)

. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt)

IV (2SLS) estimation --------------------

Number of obs = 758 F( 12, 745) = 45.91 Prob > F = 0.0000 Total (centered) SS = 139.2861498 Centered R2 = 0.4255 Total (uncentered) SS = 24652.24662 Uncentered R2 = 0.9968 Residual SS = 80.0182337 Root MSE = .3249

------------------------------------------------------------------------------ lw | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- iq | .0001747 .0039035 0.04 0.964 -.007476 .0078253 s | .0691759 .0129366 5.35 0.000 .0438206 .0945312 expr | .029866 .0066393 4.50 0.000 .0168533 .0428788 tenure | .0432738 .0076271 5.67 0.000 .0283249 .0582226 rns | -.1035897 .029481 -3.51 0.000 -.1613715 -.0458079 smsa | .1351148 .0266573 5.07 0.000 .0828674 .1873623 _Iyear_67 | -.052598 .0476924 -1.10 0.270 -.1460734 .0408774 _Iyear_68 | .0794686 .0447194 1.78 0.076 -.0081797 .1671169 _Iyear_69 | .2108962 .0439336 4.80 0.000 .1247878 .2970045 _Iyear_70 | .2386338 .0509733 4.68 0.000 .1387281 .3385396 _Iyear_71 | .2284609 .0437436 5.22 0.000 .1427251 .3141967 _Iyear_73 | .3258944 .0407181 8.00 0.000 .2460884 .4057004 _cons | 4.39955 .2685443 16.38 0.000 3.873213 4.925887 ------------------------------------------------------------------------------ Anderson canon. corr. LR statistic (underidentification test): 54.338 Chi-sq(4) P-val = 0.0000 ------------------------------------------------------------------------------ Cragg-Donald F statistic (weak identification test): 13.786 Stock-Yogo weak ID test critical values: 5% maximal IV relative bias 16.85 10% maximal IV relative bias 10.27 20% maximal IV relative bias 6.71 30% maximal IV relative bias 5.34 10% maximal IV size 24.58 15% maximal IV size 13.96 20% maximal IV size 10.26 25% maximal IV size 8.31 Source: Stock-Yogo (2005). Reproduced by permission. ------------------------------------------------------------------------------ Sargan statistic (overidentification test of all instruments): 87.655 Chi-sq(3) P-val = 0.0000 ------------------------------------------------------------------------------ Instrumented: iq Included instruments: s expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 Excluded instruments: med kww age mrt ------------------------------------------------------------------------------

. overid, all

Tests of overidentifying restrictions: Sargan N*R-sq test 87.655 Chi-sq(3) P-value = 0.0000 Sargan (N-L)*R-sq test 86.152 Chi-sq(3) P-value = 0.0000 Basmann test 97.025 Chi-sq(3) P-value = 0.0000 Sargan pseudo-F test 28.717 F(3,745) P-value = 0.0000 Basmann pseudo-F test 32.342 F(3,742) P-value = 0.0000

. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), gmm robust

2-Step GMM estimation ---------------------

Statistics robust to heteroskedasticity

Number of obs = 758 F( 12, 745) = 49.67 Prob > F = 0.0000 Total (centered) SS = 139.2861498 Centered R2 = 0.4166 Total (uncentered) SS = 24652.24662 Uncentered R2 = 0.9967 Residual SS = 81.26217887 Root MSE = .3274

------------------------------------------------------------------------------ | Robust lw | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- iq | -.0014014 .0041131 -0.34 0.733 -.009463 .0066602 s | .0768355 .0131859 5.83 0.000 .0509915 .1026794 expr | .0312339 .0066931 4.67 0.000 .0181157 .0443522 tenure | .0489998 .0073437 6.67 0.000 .0346064 .0633931 rns | -.1006811 .0295887 -3.40 0.001 -.1586738 -.0426884 smsa | .1335973 .0263245 5.08 0.000 .0820021 .1851925 _Iyear_67 | -.0210135 .0455433 -0.46 0.645 -.1102768 .0682498 _Iyear_68 | .0890993 .042702 2.09 0.037 .0054049 .1727937 _Iyear_69 | .2072484 .0407995 5.08 0.000 .1272828 .287214 _Iyear_70 | .2338308 .0528512 4.42 0.000 .1302445 .3374172 _Iyear_71 | .2345525 .0425661 5.51 0.000 .1511244 .3179805 _Iyear_73 | .3360267 .0404103 8.32 0.000 .2568239 .4152295 _cons | 4.436784 .2899504 15.30 0.000 3.868492 5.005077 ------------------------------------------------------------------------------ Anderson canon. corr. LR statistic (underidentification test): 54.338 Chi-sq(4) P-val = 0.0000 Test statistic(s) not robust ------------------------------------------------------------------------------ Cragg-Donald F statistic (weak identification test): 13.786 Stock-Yogo weak ID test critical values: 5% maximal IV relative bias 16.85 10% maximal IV relative bias 10.27 20% maximal IV relative bias 6.71 30% maximal IV relative bias 5.34 10% maximal IV size 24.58 15% maximal IV size 13.96 20% maximal IV size 10.26 25% maximal IV size 8.31 Test statistic(s) not robust Source: Stock-Yogo (2005). Reproduced by permission. ------------------------------------------------------------------------------ Hansen J statistic (overidentification test of all instruments): 74.165 Chi-sq(3) P-val = 0.0000 ------------------------------------------------------------------------------ Instrumented: iq Included instruments: s expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 Excluded instruments: med kww age mrt ------------------------------------------------------------------------------

. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), gmm robust orthog(age > mrt)

2-Step GMM estimation ---------------------

Statistics robust to heteroskedasticity

Number of obs = 758 F( 12, 745) = 49.67 Prob > F = 0.0000 Total (centered) SS = 139.2861498 Centered R2 = 0.4166 Total (uncentered) SS = 24652.24662 Uncentered R2 = 0.9967 Residual SS = 81.26217887 Root MSE = .3274

------------------------------------------------------------------------------ | Robust lw | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- iq | -.0014014 .0041131 -0.34 0.733 -.009463 .0066602 s | .0768355 .0131859 5.83 0.000 .0509915 .1026794 expr | .0312339 .0066931 4.67 0.000 .0181157 .0443522 tenure | .0489998 .0073437 6.67 0.000 .0346064 .0633931 rns | -.1006811 .0295887 -3.40 0.001 -.1586738 -.0426884 smsa | .1335973 .0263245 5.08 0.000 .0820021 .1851925 _Iyear_67 | -.0210135 .0455433 -0.46 0.645 -.1102768 .0682498 _Iyear_68 | .0890993 .042702 2.09 0.037 .0054049 .1727937 _Iyear_69 | .2072484 .0407995 5.08 0.000 .1272828 .287214 _Iyear_70 | .2338308 .0528512 4.42 0.000 .1302445 .3374172 _Iyear_71 | .2345525 .0425661 5.51 0.000 .1511244 .3179805 _Iyear_73 | .3360267 .0404103 8.32 0.000 .2568239 .4152295 _cons | 4.436784 .2899504 15.30 0.000 3.868492 5.005077 ------------------------------------------------------------------------------ Anderson canon. corr. LR statistic (underidentification test): 54.338 Chi-sq(4) P-val = 0.0000 Test statistic(s) not robust ------------------------------------------------------------------------------ Cragg-Donald F statistic (weak identification test): 13.786 Stock-Yogo weak ID test critical values: 5% maximal IV relative bias 16.85 10% maximal IV relative bias 10.27 20% maximal IV relative bias 6.71 30% maximal IV relative bias 5.34 10% maximal IV size 24.58 15% maximal IV size 13.96 20% maximal IV size 10.26 25% maximal IV size 8.31 Test statistic(s) not robust Source: Stock-Yogo (2005). Reproduced by permission. ------------------------------------------------------------------------------ Hansen J statistic (overidentification test of all instruments): 74.165 Chi-sq(3) P-val = 0.0000 -orthog- option: Hansen J statistic (eqn. excluding suspect orthog. conditions): 1.176 Chi-sq(1) P-val = 0.2782 C statistic (exogeneity/orthogonality of suspect instruments): 72.989 Chi-sq(2) P-val = 0.0000 Instruments tested: age mrt ------------------------------------------------------------------------------ Instrumented: iq Included instruments: s expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 Excluded instruments: med kww age mrt ------------------------------------------------------------------------------

. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww), gmm robust endog(iq)

2-Step GMM estimation ---------------------

Statistics robust to heteroskedasticity

Number of obs = 758 F( 12, 745) = 30.77 Prob > F = 0.0000 Total (centered) SS = 139.2861498 Centered R2 = 0.1030 Total (uncentered) SS = 24652.24662 Uncentered R2 = 0.9949 Residual SS = 124.9413508 Root MSE = .406

------------------------------------------------------------------------------ | Robust lw | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- iq | .0240417 .0060961 3.94 0.000 .0120936 .0359899 s | .0009181 .0194208 0.05 0.962 -.0371459 .038982 expr | .0393333 .0088012 4.47 0.000 .0220833 .0565834 tenure | .0324916 .0091223 3.56 0.000 .0146122 .050371 rns | -.0326157 .0376679 -0.87 0.387 -.1064433 .041212 smsa | .114463 .0330718 3.46 0.001 .0496434 .1792825 _Iyear_67 | -.0694178 .0568781 -1.22 0.222 -.1808968 .0420613 _Iyear_68 | .0891834 .0585629 1.52 0.128 -.0255977 .2039645 _Iyear_69 | .1780712 .0532308 3.35 0.001 .0737407 .2824016 _Iyear_70 | .139594 .0677261 2.06 0.039 .0068533 .2723346 _Iyear_71 | .1730151 .0521623 3.32 0.001 .070779 .2752512 _Iyear_73 | .300759 .0490919 6.13 0.000 .2045407 .3969772 _cons | 2.859113 .4083706 7.00 0.000 2.058721 3.659504 ------------------------------------------------------------------------------ Anderson canon. corr. LR statistic (underidentification test): 35.828 Chi-sq(2) P-val = 0.0000 Test statistic(s) not robust ------------------------------------------------------------------------------ Cragg-Donald F statistic (weak identification test): 18.005 Stock-Yogo weak ID test critical values: 10% maximal IV size 19.93 15% maximal IV size 11.59 20% maximal IV size 8.75 25% maximal IV size 7.25 Test statistic(s) not robust Source: Stock-Yogo (2005). Reproduced by permission. ------------------------------------------------------------------------------ Hansen J statistic (overidentification test of all instruments): 0.781 Chi-sq(1) P-val = 0.3768 -endog- option: Endogeneity test of endogenous regressors: 19.303 Chi-sq(1) P-val = 0.0000 Regressors tested: iq ------------------------------------------------------------------------------ Instrumented: iq Included instruments: s expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 Excluded instruments: med kww ------------------------------------------------------------------------------

. ivreg2 lw expr tenure rns smsa _I* (iq s = age med kww), gmm robust ffirst



Summary results for first-stage regressions -------------------------------------------

Variable | Shea Partial R2 | Partial R2 | F( 3, 744) P-value iq | 0.0636 | 0.1398 | 37.40 0.0000 s | 0.1635 | 0.3595 | 127.75 0.0000

NB: first-stage F-stat heteroskedasticity-robust

Underidentification tests Ho: matrix of reduced form coefficients has rank=K-1 (underidentified) Ha: matrix has rank=K (identified) Chi-sq(2) P-value Anderson canon. corr. -N*ln(1-CCEV) LR stat. 49.23 0.0000 Cragg-Donald N*CDEV statistic 50.86 0.0000

Weak identification tests Ho: equation is weakly identified Cragg-Donald (N-L)*CDEV/L1 F-statistic 16.64 See main output for Cragg-Donald weak id test critical values

NB: Anderson and Cragg-Donald under- and weak identification stats not robust

Weak-instrument-robust inference Tests of joint significance of endogenous regressors B1 in main equation Ho: B1=0 and overidentifying restrictions are valid Anderson-Rubin test F(3,744)= 55.00 P-val=0.0000 Anderson-Rubin test Chi-sq(3)=168.09 P-val=0.0000 Stock-Wright S statistic Chi-sq(3)=105.26 P-val=0.0000 NB: Test statistics heteroskedasticity-robust

Number of observations N = 758 Number of regressors K = 13 Number of instruments L = 14 Number of excluded instruments L1 = 3



2-Step GMM estimation ---------------------

Statistics robust to heteroskedasticity

Number of obs = 758 F( 12, 745) = 41.03 Prob > F = 0.0000 Total (centered) SS = 139.2861498 Centered R2 = 0.2530 Total (uncentered) SS = 24652.24662 Uncentered R2 = 0.9958 Residual SS = 104.0478999 Root MSE = .3705

------------------------------------------------------------------------------ | Robust lw | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- iq | -.0076476 .0048451 -1.58 0.114 -.0171438 .0018486 s | .1675741 .0205994 8.13 0.000 .1272 .2079483 expr | .0498822 .007918 6.30 0.000 .0343632 .0654012 tenure | .0413172 .0092831 4.45 0.000 .0231227 .0595117 rns | -.0952903 .0331236 -2.88 0.004 -.1602113 -.0303694 smsa | .1261241 .0303159 4.16 0.000 .066706 .1855423 _Iyear_67 | -.0562335 .0507271 -1.11 0.268 -.1556569 .0431898 _Iyear_68 | .0530208 .0491781 1.08 0.281 -.0433665 .1494082 _Iyear_69 | .1558199 .0469351 3.32 0.001 .0638287 .2478111 _Iyear_70 | .1714748 .0601713 2.85 0.004 .0535412 .2894084 _Iyear_71 | .0898856 .0545867 1.65 0.100 -.0171023 .1968735 _Iyear_73 | .0962117 .059777 1.61 0.108 -.0209491 .2133726 _cons | 3.944565 .3303562 11.94 0.000 3.297079 4.592052 ------------------------------------------------------------------------------ Anderson canon. corr. LR statistic (underidentification test): 49.229 Chi-sq(2) P-val = 0.0000 Test statistic(s) not robust ------------------------------------------------------------------------------ Cragg-Donald F statistic (weak identification test): 16.641 Stock-Yogo weak ID test critical values: 10% maximal IV size 13.43 15% maximal IV size 8.18 20% maximal IV size 6.40 25% maximal IV size 5.45 Test statistic(s) not robust Source: Stock-Yogo (2005). Reproduced by permission. ------------------------------------------------------------------------------ Hansen J statistic (overidentification test of all instruments): 0.757 Chi-sq(1) P-val = 0.3843 ------------------------------------------------------------------------------ Instrumented: iq s Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 Excluded instruments: age med kww ------------------------------------------------------------------------------

. use http://fmwww.bc.edu/ec-p/data/wooldridge/mroz.dta

. ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), redundant(age)

IV (2SLS) estimation --------------------

Number of obs = 428 F( 3, 424) = 7.49 Prob > F = 0.0001 Total (centered) SS = 223.3274513 Centered R2 = 0.1556 Total (uncentered) SS = 829.594813 Uncentered R2 = 0.7727 Residual SS = 188.5780571 Root MSE = .6638

------------------------------------------------------------------------------ lwage | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- educ | .0964002 .0814278 1.18 0.236 -.0631952 .2559957 exper | .042193 .0138831 3.04 0.002 .0149827 .0694033 expersq | -.0008323 .0004204 -1.98 0.048 -.0016563 -8.33e-06 _cons | -.3848718 1.011551 -0.38 0.704 -2.367476 1.597732 ------------------------------------------------------------------------------ Anderson canon. corr. LR statistic (underidentification test): 13.012 Chi-sq(3) P-val = 0.0046 -redundant- option: LR IV redundancy test (redundancy of specified instruments): 0.458 Chi-sq(1) P-val = 0.4987 Instruments tested: age ------------------------------------------------------------------------------ Cragg-Donald F statistic (weak identification test): 4.342 Stock-Yogo weak ID test critical values: 5% maximal IV relative bias 13.91 10% maximal IV relative bias 9.08 20% maximal IV relative bias 6.46 30% maximal IV relative bias 5.39 10% maximal IV size 22.30 15% maximal IV size 12.83 20% maximal IV size 9.54 25% maximal IV size 7.80 Source: Stock-Yogo (2005). Reproduced by permission. ------------------------------------------------------------------------------ Sargan statistic (overidentification test of all instruments): 0.702 Chi-sq(2) P-val = 0.7042 ------------------------------------------------------------------------------ Instrumented: educ Included instruments: exper expersq Excluded instruments: age kidslt6 kidsge6 ------------------------------------------------------------------------------

. log close log: /Users/baum/doc/Courses 2006-2007/EC77101S/771ivexamples.smcl log type: smcl closed on: 4 Feb 2007, 12:05:17 -----------------------------------------------------------------------------------