[R] Plot survival curves after coxph() with frailty() random effects terms
Andreu Ferrero
fromnorden at gmail.com
Fri Jun 23 16:17:39 CEST 2017
I would like to plot a survival curves of a group with different categories
after running a Cox model with frailty() random effects terms.
I just could display a survival plot of the covariable’s mean.
Here an example:
library(survival)
fit<-coxph(Surv(time, status) ~ sex+ frailty(litter, dist='gamma',
method='em'), rats)
summary(fit )
suf<-survfit(fit)
plot(suf, xscale=1, xlab = "Days", ylab="Survival", conf.int=FALSE)
lines(suf[1], lwd=2)
Warning message:
In `[.survfit`(suf, 1) : survfit object has only a single survival curve
#But if I use the next code I get the 2 groups.
surv_group <- survfit(Surv(time, status) ~ sex, rats)
lines(surv_group[1:2], lwd=2, conf.int=FALSE)
However, I am not sure about these 2 curves are well done, appropriate.
If any of you could help…
--
Andreu Ferrero Gregori
[[alternative HTML version deleted]]
More information about the R-help
mailing list