Эконометрика, 2017-2018, 4 модуль Семинар 3 160418 Для Группы Э_Б2015_Э_3 Семинарист ОАДемидова * Stata program * copyright C 2010 by A Colin Cameron and Pravin K Trivedi * used for "Microeconometrics Using Stata, Revised Edition" * by A Colin Cameron and Pravin K Trivedi (2010) * Stata Press * Chapter 6 * 63: INSTRUMENTAL VARIABLES EXAMPLE * 64: WEAK INSTRUMENTS ********** DATA DESCRIPTION ********** * The original data is from MEPS over 65 similar to chapter 3 1
global x2list totchr age female blhisp linc summarize ldrugexp hi_empunion $x2list Variable Obs Mean Std Dev Min Max ldrugexp 10391 6479668 1363395 0 1018017 hi_empunion 10391 3796555 4853245 0 1 totchr 10391 1860745 1290131 0 9 age 10391 7504639 669368 65 91 female 10391 5797325 4936256 0 1 blhisp 10391 1703397 3759491 0 1 linc 10089 2743275 9131433-6907755 5744476 2
* Summarize available instruments summarize ssiratio lowincome multlc firmsz if linc!= Variable Obs Mean Std Dev Min Max ssiratio 10089 5365438 3678175 0 925062 lowincome 10089 1874319 3902771 0 1 multlc 10089 0620478 2412543 0 1 firmsz 10089 1405293 2170389 0 50 3
* IV estimation of a just-identified model with single endog regressor ivregress 2sls ldrugexp (hi_empunion = ssiratio) $x2list, vce(robust) first First-stage regressions Number of obs = 10089 F( 6, 10082) = 11918 Prob > F = 00000 R-squared = 00761 Adj R-squared = 00755 Root MSE = 04672 Robust hi_empunion Coef Std Err t P> t [95% Conf Interval] totchr 0127865 0036655 349 0000 0056015 0199716 age -0086323 0007087-1218 0000-0100216 -0072431 female -07345 0096392-762 0000-0923448 -0545552 blhisp -06268 0122742-511 0000-08674 -0386201 linc 0483937 0066075 732 0000 0354417 0613456 ssiratio -1916432 0236326-811 0000-2379678 -1453186 _cons 1028981 0581387 1770 0000 9150172 1142944 Instrumental variables (2SLS) regression Number of obs = 10089 Wald chi2(6) = 200086 Prob > chi2 = 00000 R-squared = 00640 Root MSE = 13177 Robust ldrugexp Coef Std Err z P> z [95% Conf Interval] hi_empunion -8975913 2211268-406 0000-1330992 -4641908 totchr 4502655 0101969 4416 0000 43028 470251 age -0132176 0029977-441 0000-0190931 -0073421 female -020406 0326114-063 0531-0843232 0435113 blhisp -2174244 0394944-551 0000-294832 -1400167 linc 0870018 0226356 384 0000 0426368 1313668 _cons 678717 2688453 2525 0000 6260243 7314097 Instrumented: hi_empunion Instruments: totchr age female blhisp linc ssiratio * Compare 5 estimators and variance estimates for overidentified models global ivmodel "ldrugexp (hi_empunion = ssiratio multlc) $x2list" quietly ivregress 2sls $ivmodel, vce(robust) estimates store TwoSLS quietly ivregress gmm $ivmodel, wmatrix(robust) estimates store GMM_het quietly ivregress gmm $ivmodel, wmatrix(robust) igmm estimates store GMM_igmm quietly ivregress gmm $ivmodel, wmatrix(cluster age) estimates store GMM_clu quietly ivregress 2sls $ivmodel estimates store TwoSLS_def estimates table TwoSLS GMM_het GMM_igmm GMM_clu TwoSLS_def, b(%95f) se 4
* Compare 5 estimators and variance estimates for overidentified models global ivmodel "ldrugexp (hi_empunion = ssiratio multlc) $x2list" quietly ivregress 2sls $ivmodel, vce(robust) estimates store TwoSLS quietly ivregress gmm $ivmodel, wmatrix(robust) estimates store GMM_het quietly ivregress gmm $ivmodel, wmatrix(robust) igmm estimates store GMM_igmm quietly ivregress gmm $ivmodel, wmatrix(cluster age) estimates store GMM_clu quietly ivregress 2sls $ivmodel estimates store TwoSLS_def estimates table TwoSLS GMM_het GMM_igmm GMM_clu TwoSLS_def, b(%95f) se Variable TwoSLS GMM_het GMM_igmm GMM_clu TwoSLS_~f hi_empunion -098993-099328 -099329-103587 -098993 020459 020467 020467 020438 019221 totchr 045121 045095 045095 044822 045121 001031 001031 001031 001325 001051 age -001414-001415 -001415-001185 -001414 000290 000290 000290 000626 000278 female -002784-002817 -002817-002451 -002784 003217 003219 003219 002919 003117 blhisp -022371-022310 -022311-020907 -022371 003958 003960 003960 005018 003870 linc 009427 009446 009446 009573 009427 002188 002190 002190 001474 002123 _cons 687519 687782 687783 672769 687519 025789 025800 025800 050588 024528 * Obtain OLS estimates to compare with preceding IV estimates regress ldrugexp hi_empunion $x2list, vce(robust) 5
* Obtain OLS estimates to compare with preceding IV estimates regress ldrugexp hi_empunion $x2list, vce(robust) Linear regression Number of obs = 10089 F( 6, 10082) = 37685 Prob > F = 00000 R-squared = 01770 Root MSE = 1236 Robust ldrugexp Coef Std Err t P> t [95% Conf Interval] hi_empunion 0738788 0259848 284 0004 0229435 1248141 totchr 4403807 0093633 4703 0000 4220268 4587346 age -0035295 001937-182 0068-0073264 0002675 female 0578055 0253651 228 0023 0080848 1075262 blhisp -1513068 0341264-443 0000-2182013 -0844122 linc 0104815 0137126 076 0445-0163979 037361 _cons 5861131 1571037 3731 0000 5553176 6169085 * Robust Durbin-Wu-Hausman test of endogeneity implemented by estat endogenous ivregress 2sls ldrugexp (hi_empunion = ssiratio) $x2list, vce(robust) estat endogenous * Robust Durbin-Wu-Hausman test of endogeneity implemented by estat endogenous ivregress 2sls ldrugexp (hi_empunion = ssiratio) $x2list, vce(robust) Instrumental variables (2SLS) regression Number of obs = 10089 Wald chi2(6) = 200086 Prob > chi2 = 00000 R-squared = 00640 Root MSE = 13177 Robust ldrugexp Coef Std Err z P> z [95% Conf Interval] hi_empunion -8975913 2211268-406 0000-1330992 -4641908 totchr 4502655 0101969 4416 0000 43028 470251 age -0132176 0029977-441 0000-0190931 -0073421 female -020406 0326114-063 0531-0843232 0435113 blhisp -2174244 0394944-551 0000-294832 -1400167 linc 0870018 0226356 384 0000 0426368 1313668 _cons 678717 2688453 2525 0000 6260243 7314097 Instrumented: hi_empunion Instruments: totchr age female blhisp linc ssiratio estat endogenous Tests of endogeneity Ho: variables are exogenous Robust score chi2(1) = 24935 (p = 00000) Robust regression F(1,10081) = 264333 (p = 00000) * Robust Durbin-Wu-Hausman test of endogeneity implemented manually quietly regress hi_empunion ssiratio $x2list quietly predict v1hat, resid quietly regress ldrugexp hi_empunion v1hat $x2list, vce(robust) test v1hat 6
* Robust Durbin-Wu-Hausman test of endogeneity implemented manually quietly regress hi_empunion ssiratio $x2list quietly predict v1hat, resid quietly regress ldrugexp hi_empunion v1hat $x2list, vce(robust) test v1hat ( 1) v1hat = 0 F( 1, 10081) = 2643 Prob > F = 00000 * Test of overidentifying restrictions following ivregress gmm quietly ivregress gmm ldrugexp (hi_empunion = ssiratio multlc) $x2list, wmatrix(robust) estat overid quietly ivregress gmm ldrugexp (hi_empunion = ssiratio multlc) $x2list, wmatrix(robust) estat overid Test of overidentifying restriction: Hansen's J chi2(1) = 104754 (p = 03061) * Test of overidentifying restrictions following ivregress gmm ivregress gmm ldrugexp (hi_empunion = ssiratio lowincome multlc firmsz) $x2list, wmatrix(robust) estat overid ivregress gmm ldrugexp (hi_empunion = ssiratio lowincome multlc firmsz) $x2list, wmatrix(robust) Instrumental variables (GMM) regression Number of obs = 10089 Wald chi2(6) = 204212 Prob > chi2 = 00000 R-squared = 00829 GMM weight matrix: Robust Root MSE = 13043 Robust ldrugexp Coef Std Err z P> z [95% Conf Interval] hi_empunion -8124043 1846433-440 0000-1174299 -45051 totchr 449488 010047 4474 0000 4297962 4691799 age -0124598 0027466-454 0000-0178432 -0070765 female -0104528 0306889-034 0733-0706019 0496963 blhisp -2061018 0382891-538 0000-2811471 -1310566 linc 0796532 0203397 392 0000 0397882 1195183 _cons 67126 2425973 2767 0000 6237118 7188081 Instrumented: hi_empunion Instruments: totchr age female blhisp linc ssiratio lowincome multlc firmsz estat overid Test of overidentifying restriction: Hansen's J chi2(3) = 115903 (p = 00089) ********** 64: WEAK INSTRUMENTS * Correlations of endogenous regressor with instruments correlate hi_empunion ssiratio lowincome multlc firmsz if linc!= 7
correlate hi_empunion ssiratio lowincome multlc firmsz if linc!= (obs=10089) hi_emp~n ssiratio lowinc~e multlc firmsz hi_empunion 10000 ssiratio -02124 10000 lowincome -01164 02539 10000 multlc 01198-01904 -00625 10000 firmsz 00374-00446 -00082 01873 10000 * Weak instrument tests - just-identified model quietly ivregress 2sls ldrugexp (hi_empunion = ssiratio) $x2list, vce(robust) estat firststage, forcenonrobust all * Weak instrument tests - just-identified model quietly ivregress 2sls ldrugexp (hi_empunion = ssiratio) $x2list, vce(robust) estat firststage, forcenonrobust all First-stage regression summary statistics Adjusted Partial Robust Variable R-sq R-sq R-sq F(1,10082) Prob > F hi_empunion 00761 00755 00179 657602 00000 Shea's partial R-squared Variable Shea's Shea's Partial R-sq Adj Partial R-sq hi_empunion 00179 00174 Minimum eigenvalue statistic = 18398 Critical Values # of endogenous regressors: 1 Ho: Instruments are weak # of excluded instruments: 1 2SLS relative bias 5% 10% 20% 30% (not available) 10% 15% 20% 25% 2SLS Size of nominal 5% Wald test 1638 896 666 553 LIML Size of nominal 5% Wald test 1638 896 666 553 * Weak instrument tests - two or more overidentifying restrictions quietly ivregress gmm ldrugexp (hi_empunion = ssiratio lowincome multlc firmsz) $x2list, vce(robust) estat firststage, forcenonrobust 8
* Weak instrument tests - two or more overidentifying restrictions quietly ivregress gmm ldrugexp (hi_empunion = ssiratio lowincome multlc firmsz) $x2list, vce(robust) estat firststage, forcenonrobust First-stage regression summary statistics Adjusted Partial Robust Variable R-sq R-sq R-sq F(4,10079) Prob > F hi_empunion 00821 00812 00243 44823 00000 Minimum eigenvalue statistic = 62749 Critical Values # of endogenous regressors: 1 Ho: Instruments are weak # of excluded instruments: 4 5% 10% 20% 30% 2SLS relative bias 1685 1027 671 534 10% 15% 20% 25% 2SLS Size of nominal 5% Wald test 2458 1396 1026 831 LIML Size of nominal 5% Wald test 544 387 330 298 * Compare 4 just-identified model estimates with different instruments quietly regress ldrugexp hi_empunion $x2list, vce(robust) estimates store OLS0 quietly ivregress 2sls ldrugexp (hi_empunion=ssiratio) $x2list, vce(robust) estimates store IV_INST1 quietly estat firststage, forcenonrobust scalar me1 = r(mineig) quietly ivregress 2sls ldrugexp (hi_empunion=lowincome) $x2list, vce(robust) estimates store IV_INST2 quietly estat firststage, forcenonrobust scalar me2 = r(mineig) quietly ivregress 2sls ldrugexp (hi_empunion=multlc) $x2list, vce(robust) estimates store IV_INST3 quietly estat firststage, forcenonrobust scalar me3 = r(mineig) quietly ivregress 2sls ldrugexp (hi_empunion=firmsz) $x2list, vce(robust) estimates store IV_INST4 quietly estat firststage, forcenonrobust scalar me4 = r(mineig) estimates table OLS0 IV_INST1 IV_INST2 IV_INST3 IV_INST4, b(%84f) se display "Minimum eigenvalues are: " me1 _s(2) me2 _s(2) me3 _s(2) me4 9
* Compare 4 just-identified model estimates with different instruments quietly regress ldrugexp hi_empunion $x2list, vce(robust) estimates store OLS0 quietly ivregress 2sls ldrugexp (hi_empunion=ssiratio) $x2list, vce(robust) estimates store IV_INST1 quietly estat firststage, forcenonrobust scalar me1 = r(mineig) quietly ivregress 2sls ldrugexp (hi_empunion=lowincome) $x2list, vce(robust) estimates store IV_INST2 quietly estat firststage, forcenonrobust scalar me2 = r(mineig) quietly ivregress 2sls ldrugexp (hi_empunion=multlc) $x2list, vce(robust) estimates store IV_INST3 quietly estat firststage, forcenonrobust scalar me3 = r(mineig) quietly ivregress 2sls ldrugexp (hi_empunion=firmsz) $x2list, vce(robust) estimates store IV_INST4 quietly estat firststage, forcenonrobust scalar me4 = r(mineig) estimates table OLS0 IV_INST1 IV_INST2 IV_INST3 IV_INST4, b(%84f) se Variable OLS0 IV_INST1 IV_INST2 IV_INST3 IV_INST4 hi_empunion 00739-08976 01170-13459 -29323 00260 02211 03594 04238 14025 totchr 04404 04503 04399 04548 04710 00094 00102 00100 00116 00203 age -00035-00132 -00031-00177 -00335 00019 00030 00041 00048 00143 female 00578-00204 00613-00565 -01842 00254 00326 00381 00449 01203 blhisp -01513-02174 -01484-02479 -03559 00341 00395 00416 00489 01098 linc 00105 00870 00071 01223 02473 00137 00226 00311 00371 01130 _cons 58611 67872 58201 72145 87267 01571 02688 03812 04419 13594 legend: b/se display "Minimum eigenvalues are: " me1 _s(2) me2 _s(2) me3 _s(2) me4 Minimum eigenvalues are: 18397973 54328603 55157581 99595082 10
Hausman test ivreg ldrugexp (hi_empunion = ssiratio) $x2list Instrumental variables (2SLS) regression Source SS df MS Number of obs = 10089 F( 6, 10082) = 31962 Model 119689964 6 199483274 Prob > F = 00000 Residual 175182166 10082 173757355 R-squared = 00640 Adj R-squared = 00634 Total 187151162 10088 185518599 Root MSE = 13182 ldrugexp Coef Std Err t P> t [95% Conf Interval] hi_empunion -8975913 2079906-432 0000-1305294 -4898882 totchr 4502655 0104225 4320 0000 4298354 4706957 age -0132176 0028759-460 0000-0188549 -0075802 female -020406 0315518-065 0518-0822538 0414418 blhisp -2174244 0386879-562 0000-2932603 -1415884 linc 0870018 0220221 395 0000 0438342 1301694 _cons 678717 2555229 2656 0000 6286294 7288046 Instrumented: hi_empunion Instruments: totchr age female blhisp linc ssiratio est store IV regress ldrugexp hi_empunion $x2list Source SS df MS Number of obs = 10089 F( 6, 10082) = 36132 Model 331206802 6 552011337 Prob > F = 00000 Residual 154030482 10082 152777705 R-squared = 01770 Adj R-squared = 01765 Total 187151162 10088 185518599 Root MSE = 1236 ldrugexp Coef Std Err t P> t [95% Conf Interval] hi_empunion 0738788 0261088 283 0005 0227003 1250573 totchr 4403807 0095731 4600 0000 4216155 459146 age -0035295 001886-187 0061-0072265 0001675 female 0578055 0251633 230 0022 0084803 1071307 blhisp -1513068 0338083-448 0000-2175778 -0850358 linc 0104815 0139518 075 0453-0168667 0378298 _cons 5861131 1531845 3826 0000 5560858 6161403 est store OLS hausman IV OLS Coefficients (b) (B) (b-b) sqrt(diag(v_b-v_b)) IV OLS Difference SE hi_empunion -8975913 0738788-9714701 2063454 totchr 4502655 4403807 0098848 0041211 age -0132176-0035295 -0096881 0021711 female -020406 0578055-0782115 0190347 blhisp -2174244-1513068 -0661176 0188083 linc 0870018 0104815 0765202 0170388 b = consistent under Ho and Ha; obtained from ivreg B = inconsistent under Ha, efficient under Ho; obtained from regress Test: Ho: difference in coefficients not systematic chi2(6) = (b-b)'[(v_b-v_b)^(-1)](b-b) = 2217 Prob>chi2 = 00011 11