Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Interpreting interactions - what is the difference?

 From Amal Khanolkar To "statalist@hsphsun2.harvard.edu" Subject st: Interpreting interactions - what is the difference? Date Fri, 8 Mar 2013 12:43:13 +0000

```Hi,

I have good reason to believe that I have an interaction effect on the association that I am investigating. I tested for an interaction as follows (the syntax that I am used to using):

xi: regress bvk i.ethnicity_bi2*i.smoke1 i.magecat i.education i.famsit_new i.MBMI4 if multibirth==1, vce(robust)
i.ethnicity_bi2   _Iethnicity_1-3     (naturally coded; _Iethnicity_1 omitted)
i.smoke1          _Ismoke1_2-4        (naturally coded; _Ismoke1_2 omitted)
i.et~i2*i.smo~1   _IethXsmo_#_#       (coded as above)
i.magecat         _Imagecat_1-6       (naturally coded; _Imagecat_1 omitted)
i.education       _Ieducation_1-4     (naturally coded; _Ieducation_1 omitted)
i.famsit_new      _Ifamsit_ne_2-4     (naturally coded; _Ifamsit_ne_2 omitted)
i.MBMI4           _IMBMI4_1-5         (naturally coded; _IMBMI4_1 omitted)

Linear regression                                      Number of obs = 1145520
F( 22,1145497) = 2485.52
Prob > F      =  0.0000
R-squared     =  0.0464
Root MSE      =   534.6

-------------------------------------------------------------------------------
|               Robust
bvk |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
_Iethnicity_2 |  -55.40851   3.363476   -16.47   0.000    -62.00081   -48.81621
_Iethnicity_3 |  -209.3707   2.593969   -80.71   0.000    -214.4548   -204.2866
_Ismoke1_3 |  -163.5623   1.590281  -102.85   0.000    -166.6792   -160.4454
_Ismoke1_4 |   -225.331   2.045473  -110.16   0.000    -229.3401    -221.322
_IethXsmo_2_3 |    43.0082   8.363382     5.14   0.000     26.61625    59.40014
_IethXsmo_2_4 |   34.62322   10.56243     3.28   0.001     13.92122    55.32522
_IethXsmo_3_3 |   106.4277   11.11523     9.57   0.000     84.64226    128.2132
_IethXsmo_3_4 |   102.8906   17.05702     6.03   0.000     69.45945    136.3218
_Imagecat_2 |   13.45526   3.548731     3.79   0.000     6.499868    20.41065
_Imagecat_3 |   39.19018   3.505844    11.18   0.000     32.31885    46.06152
_Imagecat_4 |     59.574   3.555526    16.76   0.000     52.60529    66.54271
_Imagecat_5 |    47.8014   3.794845    12.60   0.000     40.36364    55.23917
_Imagecat_6 |   9.255351   5.388909     1.72   0.086    -1.306727    19.81743
_Ieducation_2 |   9.028195    1.68224     5.37   0.000     5.731061    12.32533
_Ieducation_3 |   18.69893   1.998478     9.36   0.000     14.78198    22.61588
_Ieducation_4 |   20.15501   2.027461     9.94   0.000     16.18125    24.12876
_Ifamsit_ne_3 |  -38.88596   3.173605   -12.25   0.000    -45.10612   -32.66581
_Ifamsit_ne_4 |  -35.80535   4.399755    -8.14   0.000    -44.42873   -27.18198
_IMBMI4_2 |   167.7779   2.274281    73.77   0.000     163.3204    172.2354
_IMBMI4_3 |   295.7826   2.512326   117.73   0.000     290.8585    300.7067
_IMBMI4_4 |   331.3417   3.399698    97.46   0.000     324.6784     338.005
_IMBMI4_5 |   377.5889   5.639559    66.95   0.000     366.5355    388.6422
_cons |   3365.112   4.132198   814.36   0.000     3357.013    3373.211
-------------------------------------------------------------------------------

-From the above one can see that that all four interaction terms are highly statistically significant (here it indicates that ethnicity interacts with smoking on its effect on the outcome, bvk).

-Suppose I wanted to change the baseline group for the covariate magecat (maternal age) to the third category, then I do so by running the following (without the xi prefix, and everything else remaining the same as the first regression above):

. regress bvk i.ethnicity_bi2#i.smoke1 ib3.magecat i.education i.famsit_new i.MBMI4 if multibirth==1

Source |       SS       df       MS              Number of obs = 1145520
-------------+------------------------------           F( 22,1145497) = 2531.71
Model |  1.5918e+10    22   723544817           Prob > F      =  0.0000
Residual |  3.2737e+111145497  285792.395           R-squared     =  0.0464
Total |  3.4329e+111145519  299682.779           Root MSE      =   534.6

--------------------------------------------------------------------------------------
bvk |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
ethnicity_bi2#smoke1 |
1 3  |  -163.5623   1.581015  -103.45   0.000     -166.661   -160.4635
1 4  |   -225.331   2.039092  -110.51   0.000    -229.3276   -221.3345
2 2  |  -55.40851   3.368284   -16.45   0.000    -62.01023   -48.80679
2 3  |  -175.9626   7.517375   -23.41   0.000    -190.6964   -161.2288
2 4  |  -246.1163   9.717415   -25.33   0.000    -265.1621   -227.0705
3 2  |  -209.3707   2.673535   -78.31   0.000    -214.6107   -204.1306
3 3  |  -266.5052   11.05835   -24.10   0.000    -288.1792   -244.8312
3 4  |  -331.8111   16.67969   -19.89   0.000    -364.5027   -299.1195
|
magecat |
1  |  -39.19018   3.544335   -11.06   0.000    -46.13696   -32.24341
2  |  -25.73492     1.4048   -18.32   0.000    -28.48828   -22.98156
4  |   20.38381   1.253754    16.26   0.000      17.9265    22.84113
5  |   8.611217   1.759931     4.89   0.000     5.161811    12.06062
6  |  -29.93483   3.877429    -7.72   0.000    -37.53446    -22.3352
|
education |
2  |   9.028195   1.651843     5.47   0.000     5.790639    12.26575
3  |   18.69893   1.981509     9.44   0.000     14.81524    22.58262
4  |   20.15501   2.010367    10.03   0.000     16.21476    24.09526
|
famsit_new |
3  |  -38.88596   3.099098   -12.55   0.000    -44.96009   -32.81184
4  |  -35.80535   4.341713    -8.25   0.000    -44.31496   -27.29574
|
MBMI4 |
2  |   167.7779   2.390923    70.17   0.000     163.0918     172.464
3  |   295.7826   2.591934   114.12   0.000     290.7025    300.8627
4  |   331.3417    3.27985   101.02   0.000     324.9133    337.7701
5  |   377.5889   4.904759    76.98   0.000     367.9757    387.2021
|
_cons |   3404.302   2.863698  1188.78   0.000      3398.69    3409.915
--------------------------------------------------------------------------------------

- I expected the second regression to be the same as the first, but it seems like the coefficients for the interaction terms 2_3, 2_4, 3_3, &  3_4 are however different. Could someone explain to me why they are different and if I should interpret the interaction terms from the two regression models differently.

- I then predicted values post estimation and tried to plot a graph as follows, however I get the error message 'unmatched quote'. I'm not able to figure out what's wrong in my syntax.

. predict p
(option xb assumed; fitted values)
(1812933 missing values generated)

. predict se, stdp
(1812933 missing values generated)

. tw (scatter bviktbs smoke1 if ethnicity_bi2==1, ms(+) ) ///
>    (scatter bviktbs smoke1 if ethnicity_bi2==2, ms(o) ) ///
>    (scatter bviktbs smoke1 if ethnicity_bi2==3, ms(-) ) ///
>    (line nahat3 smoke1 if ethnicity_bi2==1, lp(dash) lw(thick) sort) ///
>    (line nahat3 smoke1 if ethnicity_bi2==2, lp(solid) lw(thin) sort) ///
>    (line nahat3 smoke1 if ethnicity_bi2==3, lp(solid) lw(thick) sort), ///
>    scheme (slomo) ///
>    legend (label (1 "Swedish") label (2 "Caucasian") label (3 "non-Caucasian") ///
>    col(1) ring(0) pos(7)) ///
>    ytitle("mean birth weight") ///
>    xtitle("smoking status")

unmatched quote
r(198);

Thanks for any help and suggestions!

Regards,

Amal Khanolkar

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```