use ivbinoutdata, clear
Multiplicative 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) ivmsmm
Final GMM criterion Q(b) = 4.78e-34
note: model is exactly identified.
Exponential mean model with endogenous regressors
Number of parameters = 2 Number of obs = 2,500
Number of moments = 2
Initial weight matrix: Unadjusted
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
y | IRR std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | 1.481751 .1140179 5.11 0.000 1.274315 1.722953
_cons | .1934525 .0344643 -9.22 0.000 .1364362 .2742957
------------------------------------------------------------------------------
Note: _cons estimates baseline incidence rate.
Endogenous: x
Exogenous: z1
Fit the model with multiple instruments.
y (x = z1 z2 z3)
ivmsmm estat overid
Final GMM criterion Q(b) = .0005389
Exponential mean model with endogenous regressors
Number of parameters = 2 Number of obs = 2,500
Number of moments = 4
Initial weight matrix: Unadjusted
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
y | IRR std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | 1.457696 .0555919 9.88 0.000 1.352711 1.57083
_cons | .2007564 .0195625 -16.48 0.000 .1658536 .2430044
------------------------------------------------------------------------------
Note: _cons estimates baseline incidence rate.
Endogenous: x
Exogenous: z1 z2 z3
Test of overidentifying restriction:
Hansen's J chi2(2) = 1.34718 (p = 0.5099)
Adjusting for w
.
y w (x = z1 z2 z3) ivmsmm
Final GMM criterion Q(b) = .0005056
Exponential mean model with endogenous regressors
Number of parameters = 3 Number of obs = 2,500
Number of moments = 5
Initial weight matrix: Unadjusted
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
y | IRR std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x | 1.560802 .066842 10.40 0.000 1.435142 1.697465
w | 1.257379 .0453377 6.35 0.000 1.171586 1.349455
_cons | .1674455 .0170897 -17.51 0.000 .1370878 .2045257
------------------------------------------------------------------------------
Note: _cons estimates baseline incidence rate.
Endogenous: x
Exogenous: w z1 z2 z3
Fit the model with multiple exposures, and instruments, and adjusting for w.
y w (x1 x2 = z1 z2 z3)
ivmsmm estat overid
Final GMM criterion Q(b) = 2.37e-06
Exponential mean model with endogenous regressors
Number of parameters = 4 Number of obs = 2,500
Number of moments = 5
Initial weight matrix: Unadjusted
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
y | IRR std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
x1 | 1.517255 .0745502 8.48 0.000 1.377954 1.670637
x2 | 1.057035 .0518303 1.13 0.258 .9601786 1.163662
w | 1.302055 .0622329 5.52 0.000 1.185619 1.429925
_cons | .1640391 .0169551 -17.49 0.000 .1339575 .2008759
------------------------------------------------------------------------------
Note: _cons estimates baseline incidence rate.
Endogenous: x1 x2
Exogenous: w z1 z2 z3
Test of overidentifying restriction:
Hansen's J chi2(1) = .005935 (p = 0.9386)
Comparison with ivpois
(specify onestep option to ivmsmm
/ivpoisson
for equivalence).
y, endog(x) exog(z1) eform(RR) ivpois
y | RR Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
y |
x | 1.481748 .1140173 5.11 0.000 1.274313 1.722949
_cons | .1934532 .0344643 -9.22 0.000 .1364368 .2742965
------------------------------------------------------------------------------
y, endog(x) exog(z1 z2 z3) eform(RR) ivpois
y | RR Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
y |
x | 1.455861 .0554883 9.85 0.000 1.351069 1.568781
_cons | .2014477 .0196368 -16.44 0.000 .1664136 .2438574
------------------------------------------------------------------------------
y w, endog(x) exog(z1 z2 z3) eform(RR) ivpois
y | RR Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
y |
w | 1.256041 .045248 6.33 0.000 1.170415 1.347931
x | 1.557702 .0665613 10.37 0.000 1.432558 1.693779
_cons | .1683465 .017178 -17.46 0.000 .1378313 .2056176
------------------------------------------------------------------------------
y w, endog(x1 x2) exog(z1 z2 z3) eform(RR) ivpois
y | RR Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
y |
w | 1.301945 .0622521 5.52 0.000 1.185476 1.429857
x1 | 1.517616 .0747339 8.47 0.000 1.377987 1.671394
x2 | 1.056735 .0519727 1.12 0.262 .959626 1.163671
_cons | .1640171 .0169575 -17.49 0.000 .1339321 .20086
------------------------------------------------------------------------------