Dear Statalist,

For the following model under the IV framework:
Code:
ivreg2 cognition (infl_pneumonia_rate1000=inter) female agesurvey black postsulfa `postAtheen' i.birth_year i.birth_state, cluster(birth_state) partial(i.birth_year i.birth_state)
I want to examine whether the effect of infl_pneumonia_rate on cognition differs according to the third binary variable -- DNAMGRIMAGE_accl.

I used two methods to address this problem. The first method is by including DNAMGRIMAGE_accl as an interaction term with infl_pneumonia_rate in the IV model. I followed some previous discussions about IV interactions in the forum and write the following code:
Code:
ivreg2 cognition (infl_pneumonia_rate1000 c.infl_pneumonia_rate1000#i.DNAMGRIMAGE_accl=inter c.inter#i.DNAMGRIMAGE_accl) female agesurvey i.DNAMGRIMAGE_accl black postsulfa `postAtheen' i.birth_year i.birth_state, cluster(birth_state)  partial(i.birth_year i.birth_state)
And this code yield results as following:
Code:
IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on birth_state

Number of clusters (birth_state) =     48             Number of obs =    13385
                                                      F( 21,    47) =   163.82
                                                      Prob > F      =   0.0000
Total (centered) SS     =  242728.7548                Centered R2   =   0.1287
Total (uncentered) SS   =  242728.7548                Uncentered R2 =   0.1287
Residual SS             =  211487.5393                Root MSE      =    3.975

------------------------------------------------------------------------------------------------------------
                                           |               Robust
                                 cognition |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------------------------------+----------------------------------------------------------------
                   infl_pneumonia_rate1000 |  -2.700423   1.641164    -1.65   0.100    -5.917046    .5161992
                                           |
DNAMGRIMAGE_accl#c.infl_pneumonia_rate1000 |
                                        1  |   1.388179   .8338651     1.66   0.096    -.2461667    3.022525
                                           |
                                    female |     .76827   .1373375     5.59   0.000     .4990933    1.037447
                                 agesurvey |  -.1910098   .0051996   -36.74   0.000    -.2012008   -.1808187
                        1.DNAMGRIMAGE_accl |  -1.780273   .7225659    -2.46   0.014    -3.196476   -.3640699
                                     black |  -2.721402   .2830009    -9.62   0.000    -3.276073    -2.16673
                                 postsulfa |    7.26792   9.512314     0.76   0.445    -11.37587    25.91171
                             post_complete |  -8.505998    7.04445    -1.21   0.227    -22.31287    5.300871
                        post_b_mmr_1930_36 |  -.3231463   .3937424    -0.82   0.412    -1.094867    .4485745
                       post_b_diar_1930_36 |  -.0887637   .0945664    -0.94   0.348    -.2741104     .096583
                    post_b_malaria_1930_36 |  -.0032673   .0021566    -1.51   0.130    -.0074942    .0009596
                        post_b_tbr_1930_36 |  -.2205102    3.32944    -0.07   0.947    -6.746093    6.305072
                  post_base_scarfever_rate |  -46857.07   36927.85    -1.27   0.204    -119234.3    25520.18
                 post_base_meningitis_rate |   14000.31   38008.46     0.37   0.713    -60494.91    88495.53
               post_b_physician_cap_193036 |   -1.39203   .6091681    -2.29   0.022    -2.585978   -.1980829
                   post_b_pharm_cap_193036 |   1.719759   1.593879     1.08   0.281    -1.404185    4.843704
               post_b_nb_hos_imp_pc_193036 |  -13.21998   18.62931    -0.71   0.478    -49.73275     23.2928
                         post_b_pci_193036 |  -.0029973   .0042377    -0.71   0.479     -.011303    .0053084
                    post_b_urban_st_193036 |   .4362025   5.122835     0.09   0.932     -9.60437    10.47678
                    post_b_illit_st_193036 |   .9197056   11.53224     0.08   0.936    -21.68308    23.52249
               post_b_nb_sch_imp_pc_193036 |  -.0892432   .3536831    -0.25   0.801    -.7824494    .6039629

The second method is just by stratifying the initial IV model by the binary variable DNAMGRIMAGE_accl. I used the following code:
1. When DNAMGRIMAGE_accl = 1
Code:
ivreg2 cognition (infl_pneumonia_rate1000=inter) female agesurvey black postsulfa `postAtheen' i.birth_year i.birth_state if DNAMGRIMAGE_accl == 1, cluster(birth_state) partial(i.birth_year i.birth_state)

Code:
IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on birth_state

Number of clusters (birth_state) =     48             Number of obs =     5838
                                                      F( 19,    47) =   146.57
                                                      Prob > F      =   0.0000
Total (centered) SS     =  101303.6092                Centered R2   =   0.1305
Total (uncentered) SS   =  101303.6092                Uncentered R2 =   0.1305
Residual SS             =   88081.7182                Root MSE      =    3.884

---------------------------------------------------------------------------------------------
                            |               Robust
                  cognition |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
    infl_pneumonia_rate1000 |  -.4627608   2.066673    -0.22   0.823    -4.513366    3.587844
                     female |   .7953502   .2299685     3.46   0.001     .3446202     1.24608
                  agesurvey |  -.1996929   .0075702   -26.38   0.000    -.2145302   -.1848557
                      black |  -2.322097    .394588    -5.88   0.000    -3.095476   -1.548719
                  postsulfa |   7.610768   14.96973     0.51   0.611    -21.72936    36.95089
              post_complete |   -.674218    9.90113    -0.07   0.946    -20.08008    18.73164
         post_b_mmr_1930_36 |  -.0718856     .58801    -0.12   0.903    -1.224364    1.080593
        post_b_diar_1930_36 |   -.175774   .1387585    -1.27   0.205    -.4477357    .0961876
     post_b_malaria_1930_36 |  -.0012827   .0037815    -0.34   0.734    -.0086943    .0061289
         post_b_tbr_1930_36 |  -4.834991   5.406693    -0.89   0.371    -15.43192    5.761933
   post_base_scarfever_rate |    40192.7   42631.75     0.94   0.346       -43364    123749.4
  post_base_meningitis_rate |   41752.66   89054.39     0.47   0.639    -132790.7      216296
post_b_physician_cap_193036 |  -3.246845   1.390723    -2.33   0.020    -5.972613   -.5210775
    post_b_pharm_cap_193036 |    2.52376   2.686741     0.94   0.348    -2.742156    7.789676
post_b_nb_hos_imp_pc_193036 |  -17.48562   38.14572    -0.46   0.647    -92.24986    57.27861
          post_b_pci_193036 |   .0084787   .0077569     1.09   0.274    -.0067246    .0236819
     post_b_urban_st_193036 |  -11.44327   8.021479    -1.43   0.154    -27.16508     4.27854
     post_b_illit_st_193036 |   11.93194   19.74517     0.60   0.546    -26.76788    50.63175
post_b_nb_sch_imp_pc_193036 |  -.6371579   .6122712    -1.04   0.298    -1.837187    .5628715
---------------------------------------------------------------------------------------------



2. When DNAMGRIMAGE_accl = 0
Code:
ivreg2 cognition (infl_pneumonia_rate1000=inter) female agesurvey black postsulfa `postAtheen' i.birth_year i.birth_state if DNAMGRIMAGE_accl == 0, cluster(birth_state) partial(i.birth_year i.birth_state)
Code:
IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on birth_state

Number of clusters (birth_state) =     48             Number of obs =     7547
                                                      F( 19,    47) =    76.47
                                                      Prob > F      =   0.0000
Total (centered) SS     =  131605.8729                Centered R2   =   0.1198
Total (uncentered) SS   =  131605.8729                Uncentered R2 =   0.1198
Residual SS             =  115841.1524                Root MSE      =    3.918

---------------------------------------------------------------------------------------------
                            |               Robust
                  cognition |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
    infl_pneumonia_rate1000 |  -3.189662   2.171009    -1.47   0.142    -7.444761    1.065437
                     female |   .7863143   .1631763     4.82   0.000     .4664946    1.106134
                  agesurvey |  -.1859477   .0064833   -28.68   0.000    -.1986546   -.1732407
                      black |  -2.846336    .448716    -6.34   0.000    -3.725803   -1.966868
                  postsulfa |   5.667493   10.68912     0.53   0.596    -15.28279    26.61778
              post_complete |  -16.86658   9.549301    -1.77   0.077    -35.58286    1.849707
         post_b_mmr_1930_36 |  -.5785419   .5686961    -1.02   0.309    -1.693166     .536082
        post_b_diar_1930_36 |   .2194986   .1302678     1.68   0.092    -.0358216    .4748189
     post_b_malaria_1930_36 |  -.0059695   .0033666    -1.77   0.076    -.0125679    .0006288
         post_b_tbr_1930_36 |  -3.152445   3.633162    -0.87   0.386    -10.27331    3.968422
   post_base_scarfever_rate |  -116179.3   47454.37    -2.45   0.014    -209188.2   -23170.43
  post_base_meningitis_rate |   40355.72   36380.03     1.11   0.267    -30947.82    111659.3
post_b_physician_cap_193036 |   .0375361   1.289499     0.03   0.977    -2.489836    2.564909
    post_b_pharm_cap_193036 |   2.416589   2.204938     1.10   0.273     -1.90501    6.738188
post_b_nb_hos_imp_pc_193036 |   17.58173   24.02155     0.73   0.464    -29.49963     64.6631
          post_b_pci_193036 |  -.0144308   .0065389    -2.21   0.027    -.0272469   -.0016148
     post_b_urban_st_193036 |   14.76539   7.294849     2.02   0.043      .467744    29.06303
     post_b_illit_st_193036 |   16.74622   17.71698     0.95   0.345    -17.97842    51.47087
post_b_nb_sch_imp_pc_193036 |   .2122467   .3956725     0.54   0.592    -.5632571    .9877505
---------------------------------------------------------------------------------------------
Now the question here is, the point estimate for infl_pneumonia_rate1000 in the interaction IV model when DNAMGRIMAGE_accl = 1/0 does not equal to the point estimate in the subgroup IV analysis by the value of DNAMGRIMAGE_accl.

For example, in the subgroup analysis, when DNAMGRIMAGE_accl = 1, the coefficient of infl_pneumonia_rate1000 is -0.46276. But in the IV model, the point estimate for infl_pneumonia_rate1000 when DNAMGRIMAGE_accl = 1 is (-2.700423+1.388179) = -1.312244

And in the subgroup analysis, when DNAMGRIMAGE_accl = 0, the coefficient of infl_pneumonia_rate1000 is -3.189662. But in the IV model, the point estimate for infl_pneumonia_rate1000 when DNAMGRIMAGE_accl = 0 is -2.700423.

Are there any mistakes in my code for either interaction or subgroup IV analysis? If there is no mistake, how should we explain the difference in the point estimate between IV interaction analysis and IV subgroup analysis?

Many thanks!!!