I would like to plot the interaction effects of a Cox model derived from the survival
package. How to do that? I am using the lung
dataset shipped with the package as an example:
library(survival)
lung$sex <- factor(lung$sex, levels = 1:2, labels = c("male", "female"))
lung <- with(lung, lung[complete.cases(time, status, sex, age, ph.karno), ])
cph <- coxph(formula = Surv(time, status)~ (age + sex + ph.karno)^2, data=lung)
How to plot the interactions age:sexfemale
, age:ph.karno
, and sexfemale:ph.karno
? Thank you for any help!