The definition of the distinction between the effect modifier and interaction term is:

Interaction and effect modification are formally defined within the counterfactual framework. Interaction is defined in terms of the effects of 2 interventions whereas effect modification is defined in terms of the effect of one intervention varying across strata of a second variable.

As per: On the distinction between interaction and effect modification.

In R code a covariate in the Cox requires:


An interaction term on the cox1 is:


But I do not know how I implement an effect modifier. Any ideas?


After further investigation and limited discussion with statisticians, it turns out that interaction terms and effect modifiers are two very different things. See this reference.

How I don't know how I can implement Effect Modifiers into R.


I believe to apply an effect modifier in R:


2 Answers 2


The distinction you quote seems to be semantics around the interpretation, not around what you do in the model. I.e. you'd still specify an interaction in the same way you show.

  • $\begingroup$ Thank's Bjön. I'm not a clinical statistician (more statistical mechanics), so I'm a little thrown how to respond to my colleagues with the idea that the coding is the same. For clarification: the coding is the same, but it's then how one interprets the results on the premise that I consider the new term as either an interaction term or an effect modifier? $\endgroup$ Commented May 24, 2019 at 11:10

Corraini et al, whom you cite in the update to your question, say on page 332: "... assessment of effect modification is to identify whether the effect of a treatment (or exposure) is different in groups of patients with different characteristics" and "Interaction is of interest when researchers want to obtain the joint effect of two (or more) exposures on a disease or outcome."

Both of those matters can be modeled with interaction terms in Cox models.The coxph() code doesn't know whether you consider a predictor to be an "exposure" or an "effect modifier." What matters is whether you choose to examine the relation of the "effect modifier" itself to survival.

Corraini et al illustrate effect-modification analysis in observational data with a study of hormone replacement therapy (HRT). The study did separate survival analyses with HRT as the predictor on 3 groups stratified by the putative effect modifier, body-mass index (BMI). What they did was effectively:

coxph(Surv(survTime,status) ~ HRT, data=df, subset = BMIgroup==group1)
coxph(Surv(survTime,status) ~ HRT, data=df, subset = BMIgroup==group2)
coxph(Surv(survTime,status) ~ HRT, data=df, subset = BMIgroup==group3)

The study found that HRT only reduced the risk of endometrial cancer significantly in the highest-BMI group, supporting BMI as an effect modifier of HRT in this context.

But that study could have also been analyzed with an interaction term between HRT and the 3 BMI groups in a single model instead of in 3 separate models. For example if that study had instead used:

coxph(Surv(survTime,status) ~ HRT*BMIgroup, data=df)


coxph(Surv(survTime,status) ~ HRT*strata(BMIgroup), data=df)

you would similarly have gotten information on how hazard ratios for HRT differ among the BMI groups.*

As @Björn says in his (much more succinct) answer, the distinction is mostly semantics in terms of how you wish to analyze and describe the results. Note that in the study cited as an example of effect modification (or with a HRT*strata(BMIgroup) interaction term), the effect of BMI per se on survival is not of interest and is not estimated. All you could say from those analyses is whether the effect of HRT depends on BMI.

The HRT*BMIgroup interaction term allows further estimation of the effect of BMIgroup. You can't distinguish whether the effect of HRT depends on BMIgroup or vice-versa; the interaction terms show how much their effects depend on each other. If you don't care particularly about how your effect modifier itself affects outcome, it suffices to perform and describe the results with stratified models.

*The HRT*BMIgroup formula assumes the same baseline hazard for all BMI groups; HRT*strata(BMIgroup) allows for different baseline hazards and thus is closer to what was done in the cited study.

  • $\begingroup$ Thank you, EdM. That was a fantastic explanation. $\endgroup$ Commented May 25, 2019 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.