Visualizing Interaction Effects: A Proposal For Presentation and Interpretation
Visualizing Interaction Effects: A Proposal For Presentation and Interpretation
Visualizing Interaction Effects: A Proposal For Presentation and Interpretation
Abstract
Objective: Interaction terms are often included in regression models to test whether the impact of one variable on the outcome is modified by another variable. However, the interpretation of these models is often not clear. We propose several graphical presentations and
corresponding statistical tests alleviating the interpretation of interaction effects.
Study Design and Setting: We implemented functions in the statistical program R that can be used on interaction terms in linear,
logistic, and Cox Proportional Hazards models. Survival data were simulated to show the functionalities of our proposed graphical visualization methods.
Results: The mutual modifying effect of the interaction term is grasped by our presented figures and methods: the combined effect of
both continuous variables is shown by a two-dimensional surface mimicking a 3D-Plot. Furthermore, significance regions were calculated
for the two variables involved in the interaction term, answering the question for which values of one variable the effect of the other variable
significantly differs from zero and vice versa.
Conclusion: We propose several graphical visualization methods to ease the interpretation of interaction effects making arbitrary
categorizations unnecessary. With these approaches, researchers and clinicians are equipped with the necessary information to assess
the clinical relevance and implications of interaction effects. 2012 Elsevier Inc. All rights reserved.
Keywords: Interaction; Visualization; Categorization; Cox models; Linear models; Logistic models
1. Background
In epidemiology, interaction terms are often incorporated into multivariable regression models to test whether
the impact of one variable on the outcome is modified by
another variable. However, the interpretation of interaction
effects is often not clear. It depends on the scale of the variables included in the interaction term (continuous and/or
categorical) and the scale of the model (linear regression,
logistic regression, Cox Proportional Hazards model). The
interpretation is rather straightforward, if interaction effects
between the two categorical variables or between one continuous and one categorical variable are considered. One
such example would be an effect that can only be seen in
men, but not in women, in Europeans but not in Asians
etc. For such situations, there are also graphical solutions implemented in standard statistical programs [1]. If
researchers are interested in interaction between two continuous variables, the interpretation is less clear. It seems
that interaction terms between continuous variables are
avoided or continuous variables are categorized beforehand. If significant P-values of continuous interaction terms
are reported, most authors switch to categorizations of these
former continuous variables for interpretation purposes. In
general, categorizations of continuous variables are often
done rather arbitrarily by choosing percentiles of the respective interacting variables, for example, by dichotomizing using the median [2]. Categorization of continuous
variables leads to significant loss of information and power,
though [3]. Sometimes, clinically recognized and predefined cutpoints are chosen, such as a body mass index of
O30 kg/m2 for the definition of obesity. Even in this case,
information is lost because the definition of these cutpoints
has been designed for a totally different purpose. This approach can lead to considerable bias. The problem even
worsens, if both continuous variables that constitute to an
interaction term are categorized [4].
In other cases, regression coefficients and P-values of interaction terms are shown, but the reader is left alone with the
856
What is new?
1. Epidemiological publications on interaction effects in survival analyses mostly use categorizations of variables for the ease of interpretation.
This approach might lead to considerable bias,
though.
2. To ease the interpretation of interaction effects between two continuous variables, we propose
a graphical visualization approach which we implemented in functions in the statistical program
R. They can be used on Generalized Linear
Models and Cox Proportional Hazards models.
3. The mutual modifying effect of both variables
constituting the interaction effect can be shown
by a two-dimensional twisted surface and interaction plots showing the effect estimator of one variable for varying values of the other variable.
including interaction terms between two continuous variables (see Appendix on the journals Web site at www.
jclinepi.com). It revealed that only one study group used
the complete range of both continuous variables to interpret
the interaction effects: The authors presented interaction
plots, showing the modifying effect of waist circumference
on the relationship between several parameters (cholesterol,
leptin, and adiponectin) and mortality [6,7].
The lack of such forms of presentations is certainly because of unfamiliarity with the methodological background
and lack of easy to use methods. Therefore, such methods
are required in the clinical epidemiological setting to avoid
common misinterpretations in interaction models.
To ease the interpretation of interaction effects between
two continuous variables, we propose several possibilities
for graphical presentation, which we implemented in functions in the statistical program R: These functions have
been implemented for linear regression, logistic regression,
and Cox Proportional Hazards models. To demonstrate the
functionalities, one data set including survival data has
been simulated and analyzed in Cox models including linear interaction effects between two continuous predictors.
2. Methods
2.1. Formulating and interpreting multiplicative
interaction terms in linear, logistic, and Cox models
For explanatory purposes, a linear regression model is
assumed first. Interaction terms between two continuous
variables x1 and x2 on the continuous outcome variable Y
can be modeled in the following way:
EYjx1 ; x2 5 Xb 5 b0 b1 x1 b2 x2 b3 x1 x2
1
with b0 being the intercept, b1 and b2 the conditional effects of x1 and x2 and b3 being the interaction effect on
the outcome Y. The linear combination on the right side
of the equation is the linear predictor Xb, to which further
covariates can be added. The regression coefficients for x1
and x2 are conditional effects because they depend on the
values of the other constituting variable:
A one unit change of x1 corresponds to a change of
b1 b3x2 on Y.
A one unit change of x2 corresponds to a change of
b2 b3x1 on Y.
This means that b1 itself is the effect of x1 on Y, if x2 is
equal to zero and vice versa. Thus, the interpretation of regression coefficients cannot be done without taking the
levels of the interacting variable into account. According
to Rothman [8], the statistical term interaction is used
to refer to departure from the underlying form of a statistical
model. For a linear model, a significant interaction term
thus implies deviation from additivity, meaning the additive
effect of the individual effects b1 x1 b2 x2 on the outcome.
with s11 being the variance of b1, s33 the variance of b3, and
s13 the covariance of b1 and b3.
Given the slope and its standard error, a t-test can then
be constructed:
857
with h0(t) being the underlying baseline hazard, which cannot be estimated. For each of the covariates in the linear predictor, the factor exp(bi) gives the so-called hazard ratio
(HR), which is a measure of relative risk. It characterizes
the shift in the hazard function as a result of a shift of one
unit in the corresponding variable xi. The interpretation on
interaction effects on the linear predictor Xb in a Cox model
can be done analogical to the linear regression model. For
Cox models, it might be more meaningful to look at the
change in HR, though. As for logistic regression models,
on the scale of the relative risk estimate, the inclusion of interaction terms tests the deviation from multiplicativity.
2.2. Description of the simulated survival data set
including interaction effects
We simulated survival data to explain the interpretation
of interaction effects and show the utilities of our graphical
presentations in a Cox model. One thousand right-censored
observations were generated with three continuous and normally distributed variables with mean 0 and variance 1. In
addition, one N(0,1)-distributed nuisance parameter has
been included, that is ignored in the following Cox model.
Therefore, the linear predictor was constructed as follows:
Linear predictor Xb 5 2 x1 0 x2 1 x1 x2
1 x3 N0; 1
with n being the number of cases and k the number of variables not including the intercept. The simple slopes test of
x2 effects for specific x1 values can be derived likewise.
The interpretations and formulas on effect estimates
given in this paragraph can be generalized to logistic regression or Cox models by substituting the expectation of
the outcome variable by a general function. The linear
predictor Xb5b0 b1 x1 b2 x2 b3 x1 x2 is then modeled by a monotone link function as the logit function
lnp=1 p for logistic regression models, with p being
the probability of the outcome. In this case, the intuitive
effect measure is the odds ratio (OR), which is estimated
by ORi 5 exp(bi) for variable xi. Thus, the regression function can be rewritten to p=1 p5expb0 expb1 x1
expb2 x2 expb3 x1 x2 . On this scale, a significant
interaction effect would imply a deviation from multiplicativity of individual effects [9], in contrast to interaction
The effect estimates were chosen to represent two possible interaction scenarios: a strong main effect that attenuates for increasing values of the other interacting variable
is reflected by b1, whereas b2 5 0 reflects an effect, that
would not be observed in a model not including an interaction term because the x2 effect even changes direction for
varying values of x1.
The simulation was performed using function Simsurv of the library prodlim in R [11]. For each observation, a Weibull distributed survival time was generated with
baseline risk set to 0.2. The censoring time was simulated
to follow an exponential distribution with a baseline censoring risk set to 3. The baseline risks for censoring and survival were chosen to yield a high censoring rate. The
minimum of the two simulated times was taken as observation time. The event indicator was set to 1, if the survival
time was shorter than the censoring time, otherwise the indicator was set to 0.
slopex1
|tn k 1
t5
seslopex1
858
and corresponding confidence intervals are plotted for varying values of x2 over their complete range. For logistic and
Cox models, OR or HR can be given alternatively by exponentiating the effect estimates and the corresponding confidence intervals. Thus, two figures, one for each of the two
interacting variables, are sufficient to summarize the interaction effect over the complete range of both continuous
variables.
3. Results
Eighty-two percent of the simulated observations are
censored. The results of the simulated Cox model are given
in Table 1. The risk experiencing an event is significantly
decreasing for increasing values of x1 (HR 5 0.1521,
P ! 0.001), if x2 5 0. If x1 5 0, x2 does not have an effect
on the hazard. Other implications that can directly be drawn
from the numbers in the table, are that there is a significant
interaction effect, meaning, that the effects of x1 and x2 vary
for varying values of the other variable. Other slopes can be
calculated by linear combinations of the effect estimates:
The effect estimate of x2 for specific x1 values can be calculated by 0.0227 1.0378*(x1 value). For x1 5 0.6456
(525% quantile), this would be 0.6473, for x1 5 1.772
(595% quantile), it is 1.862. For the calculation of
P-values, however, specific covariances are needed from
the output of the model. Thus, they cannot be derived
directly from Table 1, but can be given out by applying
the test given in formula (4) implemented in the function
getRegionCox: P 5 4.4e 14 (for x1 5 0.6456) and
P ! 10e 20 (for x1 5 1.772).
A rough overview of the impact of the interaction can be
given by the twisted surface in Fig. 1: The highest risk can
be found at consecutive low values of both variables. The
variable x1 does have a negative impact on the risk for
low values of x2. For increasing values of x2, the x1 effect
is attenuated. For low values of x1, the variable x2 is positively associated with the outcome variable, which is time
to event in this example (increasing slope), whereas x2 is inversely associated for high values of x1 (decreasing slope).
The surface is twisted, indicating that the direction of the x2
effect even changes direction for varying values of x1. Alternatively, a colored contour plot (Fig. 2) can depict the
same information: The highest risk can be found in areas,
which are displayed in pink (both x1 and x2 low), whereas
the risk decreases for darkening blue color.
Fig. 3 shows slices through the three-dimensional plot
for specific values of x1 or x2. The left panel shows the x1
Table 1. True and estimated effect estimates of the conditional and interaction effects in the simulated Cox model
^
^
Variable
True effect, b
Estimated effect, b
se b
HR
95% CI of HR
x1
x2
x 1 * x2
x3
2
0
1
1
1.8834
0.0227
1.0378
0.8826
0.1092
0.0976
0.0883
0.0777
0.1521
1.023
2.823
2.417
[0.1228;
[0.8449;
[2.3744;
[2.0757;
0.1884]
1.2386]
3.3564]
2.8148]
P-value
!0.001
0.816
!0.001
!0.001
859
Fig. 2. Contour plot displaying the linear predictor of the hazard function. The linear predictor of the hazard function for varying values of
x1 and x2 is displayed in different colors, ranging from blue (low risk)
to pink (high risk).
interpretation of an interaction effect: we observed a significant interaction between time-varying values of albumin
and phosphorus on overall mortality in our cohort [13]:
for high albumin values, increasing phosphorus concentrations were significantly associated with an increased mortality risk, whereas the beneficial effect of increasing
albumin values was only observed for low phosphorus
levels. We concluded that decisions about phosphoruslowering therapy should also take albumin values into account and epidemiological studies and guidelines should
consider this interplay. The proposed graphical presentation
and the calculation of the significance regions helped in the
discussion with clinicians and interpretation of results.
4. Discussion
We have implemented functions in R providing several
different graphical presentations and corresponding statistical tests to ease the interpretation of interaction effects between continuous variables. We have successfully applied
one of these approaches in a prospective study on incident dialysis patients, which was very useful for the
860
Fig. 3. Slices through the interaction surface plot for specific values. The y-axis shows the linear predictor of the hazard function for varying values
of x1, holding x2 fixed at specific values (5%, 25%, 50%, 75%, and 95% quantiles; left panel) and the linear predictor of the hazard function for
varying values of x2, holding x1 fixed at specific values (5%, 25%, 50%, 75%, and 95% quantiles; right panel).
861
Fig. 4. Interaction plot. The y-axis gives the hazard ratio (HR) with point-wise 95% confidence intervals for x1 on mortality for varying values of x2
(on the left) and for x2 for varying values of x1 (on the right).
862
References
[1] Barthel FM-S, Royston P. Graphical representation of interactions.
Stata J 2006;6:348e63.
[2] Turner EL, Dobson JE, Pocock SJ. Categorisation of continuous risk
factors in epidemiological publications: a survey of current practice.
Epidemiol Perspect Innov 2010;7:9.
[3] Royston P, Altman DG, Sauerbrei W. Dichotomizing continuous predictors in multiple regression: a bad idea. Stat Med 2006;25:127e41.
[4] Maxwell SE, Delaney HD. Bivariate median splits and spurious statistical significance. Psychol Bull 1993;113:181e90.
[5] Aiken LS, West SG. Multiple regression: testing and interpreting interactions. Thousand Oaks, CA: SAGE Publications; 1991.
[6] Postorino M, Marino C, Tripepi G, Zoccali C. Abdominal obesity
modifies the risk of hypertriglyceridemia for all-cause and cardiovascular mortality in hemodialysis patients. Kidney Int 2011;79:765e72.
[7] Zoccali C, Postorino M, Marino C, Pizzini P, Cutrupi S, Tripepi G.
Waist circumference modifies the relationship between the adipose
tissue cytokines leptin and adiponectin and all-cause and cardiovascular mortality in haemodialysis patients. J Intern Med 2011;
269:172e81.
[8] Rothman KJ. Epidemiology; an introduction. New York, NY: Oxford
University Press; 2002.
[9] de Mutsert R, Jager KJ, Zoccali C, Dekker FW. The effect of joint
exposures: examining the presence of interaction. Kidney Int
2009;75:677e81.
[10] Therneau TM, Grambsch PM. Modeling survival datadextending
the Cox model. New York, NY: Springer; 2000.
[11] Bender R, Augustin T, Blettner M. Generating survival times to simulate Cox proportional hazards models. Stat Med 2005;24:1713e23.
[12] Brambor T, Clark WR, Golder M. Understanding interaction models:
improving empirical analyses. Polit Anal 2006;14:63e82.
[13] Zitt E, Lamina C, Sturm G, Knoll F, Lins F, Freistatter O, et al. Interaction of time-varying albumin and phosphorus on mortality in incident dialysis patients. Clin J Am Soc Nephrol 2011;6:2650e6.
[14] Taylor JMG, Yu MG. Bias and efficiency loss due to categorizing an
explanatory variable. J Multivar Anal 2002;83:248e63.
[15] Chen H, Cohen P, Chen S. Biased odds ratios from dichotomization
of age. Stat Med 2007;26:3487e97.
[16] Altman DG. Categorizing continuous variables. In: Armitage P,
Colton T, editors. Encyclopedia of biostatistics. Chichester, UK: John
Wiley and Sons; 1998:563e7.
[17] Wood SN. Generalized additive models: an introduction with R. Boca
Raton, FL: Chapmann & Hall; 2006.
[18] Wood SN. Thin plate regression splines. J R Stat Soc B 2003;
65:95e114.
[19] Brezger A, Lang S. Generalized structured additive regression based
on Bayesian P-splines. Comput Stat Data Anal 2006;50:967e91.
[20] Fahrmeir L, Kneib T, Lang S. Regression: Modelle, Methoden und
Anwendungen. Berlin, Germany: Springer; 2007.
[21] Echembadi R, Hess JD. Mean-centering does not alleviate collinearity problems in moderated multiple regression models. Market Sci
2007;26:438e45.