use ivbinoutdata, clear
Additive structural mean model
Read in binary outcome data; y
outcome, x
exposure, w
covariate, z*
instrumental variables (genotypes).
Fit the model with a single instrumental variable.
y (x = z1) ivregress 2sls
Instrumental variables 2SLS regression Number of obs = 2,500
Wald chi2(1) = 100.20
Prob > chi2 = 0.0000
R-squared = 0.4338
Root MSE = .37484
------------------------------------------------------------------------------
y | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | .1433391 .0143193 10.01 0.000 .1152738 .1714043
_cons | .2817003 .0271777 10.37 0.000 .228433 .3349676
------------------------------------------------------------------------------
Endogenous: x
Exogenous: z1
y (x = z1) ivreg2
IV (2SLS) estimation
--------------------
Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only
Number of obs = 2500
F( 1, 2498) = 100.12
Prob > F = 0.0000
Total (centered) SS = 620.3344 Centered R2 = 0.4338
Total (uncentered) SS = 1358 Uncentered R2 = 0.7413
Residual SS = 351.260716 Root MSE = .3748
------------------------------------------------------------------------------
y | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | .1433391 .0143193 10.01 0.000 .1152738 .1714043
_cons | .2817003 .0271777 10.37 0.000 .228433 .3349676
------------------------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic): 171.159
Chi-sq(1) P-val = 0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic): 183.591
Stock-Yogo weak ID test critical values: 10% maximal IV size 16.38
15% maximal IV size 8.96
20% maximal IV size 6.66
25% maximal IV size 5.53
Source: Stock-Yogo (2005). Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments): 0.000
(equation exactly identified)
------------------------------------------------------------------------------
Instrumented: x
Excluded instruments: z1
------------------------------------------------------------------------------
Fit the model with multiple instruments.
y (x = z1 z2 z3) ivregress 2sls
Instrumental variables 2SLS regression Number of obs = 2,500
Wald chi2(1) = 323.89
Prob > chi2 = 0.0000
R-squared = 0.4223
Root MSE = .37863
------------------------------------------------------------------------------
y | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | .1307856 .0072671 18.00 0.000 .1165423 .1450289
_cons | .3046021 .015268 19.95 0.000 .2746774 .3345267
------------------------------------------------------------------------------
Endogenous: x
Exogenous: z1 z2 z3
y (x = z1 z2 z3) ivreg2
IV (2SLS) estimation
--------------------
Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only
Number of obs = 2500
F( 1, 2498) = 323.63
Prob > F = 0.0000
Total (centered) SS = 620.3344 Centered R2 = 0.4223
Total (uncentered) SS = 1358 Uncentered R2 = 0.7361
Residual SS = 358.3930269 Root MSE = .3786
------------------------------------------------------------------------------
y | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | .1307856 .0072671 18.00 0.000 .1165423 .1450289
_cons | .3046021 .015268 19.95 0.000 .2746774 .3345267
------------------------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic): 678.024
Chi-sq(3) P-val = 0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic): 309.618
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): 1.662
Chi-sq(2) P-val = 0.4357
------------------------------------------------------------------------------
Instrumented: x
Excluded instruments: z1 z2 z3
------------------------------------------------------------------------------
Fit the model with multiple exposures, and instruments, and adjusting for w
.
y w (x1 x2 = z1 z2 z3) ivregress 2sls
Instrumental variables 2SLS regression Number of obs = 2,500
Wald chi2(3) = 1010.76
Prob > chi2 = 0.0000
R-squared = 0.4481
Root MSE = .37006
------------------------------------------------------------------------------
y | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x1 | .1212489 .0108116 11.21 0.000 .1000585 .1424392
x2 | .0142141 .0135397 1.05 0.294 -.0123231 .0407513
w | .0721392 .0129687 5.56 0.000 .0467211 .0975573
_cons | .3056947 .014944 20.46 0.000 .2764051 .3349843
------------------------------------------------------------------------------
Endogenous: x1 x2
Exogenous: w z1 z2 z3
y w (x1 x2 = z1 z2 z3) ivreg2
IV (2SLS) estimation
--------------------
Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only
Number of obs = 2500
F( 3, 2496) = 336.38
Prob > F = 0.0000
Total (centered) SS = 620.3344 Centered R2 = 0.4481
Total (uncentered) SS = 1358 Uncentered R2 = 0.7479
Residual SS = 342.3610763 Root MSE = .3701
------------------------------------------------------------------------------
y | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x1 | .1212489 .0108116 11.21 0.000 .1000585 .1424392
x2 | .0142141 .0135397 1.05 0.294 -.0123231 .0407513
w | .0721392 .0129687 5.56 0.000 .0467211 .0975573
_cons | .3056947 .014944 20.46 0.000 .2764051 .3349843
------------------------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic): 413.984
Chi-sq(2) P-val = 0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic): 165.050
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
Source: Stock-Yogo (2005). Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments): 0.523
Chi-sq(1) P-val = 0.4696
------------------------------------------------------------------------------
Instrumented: x1 x2
Included instruments: w
Excluded instruments: z1 z2 z3
------------------------------------------------------------------------------