[R] Plotting adjusted KM curve
j|ox @end|ng |rom mcm@@ter@c@
Mon Apr 5 04:45:41 CEST 2021
I think that what you're looking for is
plot(survfit(fit1Cox, newdata=data.frame(age=rep(65, 2),
assuming, of course, that sex is a factor with levels "female" and "male".
I hope this helps,
John Fox, Professor Emeritus
Hamilton, Ontario, Canada
On 2021-04-04 9:34 p.m., Sorkin, John wrote:
> I am using the coxph to model survival time. How do I plot an adjusted Kaplan Meir plot resulting from coxph? The code I would like to run would start with:
> # run cox model
> fit1Cox <- coxph(surv_object ~age+sex,data=mydata)
> I have no idea what would follow.
> I would like to plot adjusted KM curves for men vs. women at age 65.
> Thank you,
> [[alternative HTML version deleted]]
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help