use ivbinoutdata, clear
Logistic 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) ivlsmm
Final GMM criterion Q(b) = 2.37e-30
note: model is exactly identified.
GMM estimation
Number of parameters = 5
Number of moments = 5
Initial weight matrix: Unadjusted Number of obs = 2,500
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
| Coefficient std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
/xb_x | 1.375182 .0563156 24.42 0.000 1.264805 1.485558
/xb_z1 | -.1698859 .1079229 -1.57 0.115 -.3814109 .0416391
/b0 | -2.076602 .1038597 -19.99 0.000 -2.280163 -1.873041
/cmxb_x | 1.196517 .1133081 10.56 0.000 .9744374 1.418597
/ey0 | .1448039 .0310372 4.67 0.000 .0839722 .2056356
------------------------------------------------------------------------------
Instruments for equation 1: x z1 _cons
Instruments for equation 2: z1 _cons
Test of overidentifying restriction:
Hansen's J chi2(0) = 5.9e-27 (p = .)
Note: test cannot be performed because there are no
overidentifying restrictions.
Causal odds ratio for: x
( 1) [cmxb_x]_cons = 0
------------------------------------------------------------------------------
| exp(b) Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
(1) | 3.308574 .3748881 10.56 0.000 2.649676 4.13132
------------------------------------------------------------------------------
Fit the model with multiple instruments.
y (x = z1 z2 z3) ivlsmm
Final GMM criterion Q(b) = .0007498
GMM estimation
Number of parameters = 7
Number of moments = 9
Initial weight matrix: Unadjusted Number of obs = 2,500
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
| Coefficient std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
/xb_x | 1.497546 .0629276 23.80 0.000 1.374211 1.620882
/xb_z1 | -.3828314 .0697615 -5.49 0.000 -.5195614 -.2461015
/xb_z2 | -.361644 .0634738 -5.70 0.000 -.4860504 -.2372376
/xb_z3 | -.3727515 .0639573 -5.83 0.000 -.4981055 -.2473976
/b0 | -1.692298 .1204232 -14.05 0.000 -1.928323 -1.456273
/cmxb_x | 1.113372 .0673101 16.54 0.000 .9814465 1.245297
/ey0 | .1778203 .0213404 8.33 0.000 .1359939 .2196468
------------------------------------------------------------------------------
Instruments for equation 1: x z1 z2 z3 _cons
Instruments for equation 2: z1 z2 z3 _cons
Test of overidentifying restriction:
Hansen's J chi2(2) = 1.87445 (p = 0.3917)
Causal odds ratio for: x
( 1) [cmxb_x]_cons = 0
------------------------------------------------------------------------------
| exp(b) Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
(1) | 3.044607 .2049329 16.54 0.000 2.668313 3.473968
------------------------------------------------------------------------------
Fit the model with multiple exposures, and instruments, and adjusting for w.
y w (x1 x2 = z1 z2 z3) ivlsmm
Final GMM criterion Q(b) = .0006646
GMM estimation
Number of parameters = 11
Number of moments = 12
Initial weight matrix: Unadjusted Number of obs = 2,500
GMM weight matrix: Robust
------------------------------------------------------------------------------
| Robust
| Coefficient std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
/xb_x1 | 1.270939 .0709528 17.91 0.000 1.131875 1.410004
/xb_x2 | .7280662 .0577047 12.62 0.000 .6149671 .8411654
/xb_z1 | -.6069302 .0915561 -6.63 0.000 -.7863769 -.4274835
/xb_z2 | -.6409243 .0906894 -7.07 0.000 -.8186723 -.4631763
/xb_z3 | -.0478545 .0956419 -0.50 0.617 -.2353092 .1396002
/xb_w | .6417589 .0844396 7.60 0.000 .4762603 .8072576
/b0 | -1.973388 .1356534 -14.55 0.000 -2.239264 -1.707512
/cmxb_x1 | 1.193709 .1028285 11.61 0.000 .9921685 1.395249
/cmxb_x2 | .1719145 .1120826 1.53 0.125 -.0477634 .3915923
/cmxb_w | .7090571 .11249 6.30 0.000 .4885808 .9295334
/ey0 | .1486804 .0181689 8.18 0.000 .1130701 .1842907
------------------------------------------------------------------------------
Instruments for equation 1: x1 x2 z1 z2 z3 w _cons
Instruments for equation 2: z1 z2 z3 w _cons
Test of overidentifying restriction:
Hansen's J chi2(1) = 1.66158 (p = 0.1974)
Causal odds ratio for: x1
( 1) [cmxb_x1]_cons = 0
------------------------------------------------------------------------------
| exp(b) Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
(1) | 3.299294 .3392614 11.61 0.000 2.697077 4.035978
------------------------------------------------------------------------------
Causal odds ratio for: x2
( 1) [cmxb_x2]_cons = 0
------------------------------------------------------------------------------
| exp(b) Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
(1) | 1.187576 .1331066 1.53 0.125 .9533594 1.479334
------------------------------------------------------------------------------
Causal odds ratio for: w
( 1) [cmxb_w]_cons = 0
------------------------------------------------------------------------------
| exp(b) Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
(1) | 2.032074 .228588 6.30 0.000 1.630001 2.533327
------------------------------------------------------------------------------