Re: [R] Plotting Coxph model with an interaction.

2021-05-20 Thread Gerrit Eichner
Hi, John, it should work the same way as without interaction (but make sure to use the fitted object "coxfit", not just "fit" in our call of survfit, and note that age*rx already expands to age + rx + age:rx so that age + rx is redundant in your formula): coxfit <- coxph(Surv(futime, fustat) ~ a

Re: [R] Plotting Coxph model with an interaction.

2021-05-20 Thread Bert Gunter
Perhaps this might be useful: https://rpubs.com/tf_peterson/interactionplotDemo Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, May 20, 2021 at 10:29 AM S

[R] Plotting Coxph model with an interaction.

2021-05-20 Thread Sorkin, John
Colleagues, I hope someone can tell me how to plot a cox model that contains an interaction term. I know that plot(survfit(. . . . )) can be used to plot a Cox model, i.e.. coxfit <- coxph(Surv(futime, fustat) ~ age+rx, data = ovarian) plot(survfit(fit, newdata=data.frame(age=60,rx=2))) but