[R] Plotting Coxph model with an interaction.

Sorkin, John j@ork|n @end|ng |rom @om@um@ry|@nd@edu
Thu May 20 19:28:20 CEST 2021


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)




More information about the R-help mailing list