[R] Plotting Coxph model with an interaction.

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu May 20 21:15:55 CEST 2021


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 Sorkin, John <jsorkin using som.umaryland.edu>
wrote:

> 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 I don't know how to plot a cox model with an interaction, i.e.
>
> coxfit <- coxph(Surv(futime, fustat) ~ age+rx+age*rx, data = ovarian)
> plot(survfit(fit, newdata=data.frame(???????)))
>
> Thank you,
> John
>
> John David Sorkin M.D., Ph.D.
> Professor of Medicine
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology and
> Geriatric Medicine
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list