Message-ID: <CAH2QH=dOuUJRtAD0Tvy0UNPv2er7Ox_54a+DfffvxSGjTtb1FQ@mail.gmail.com>
Date: 2017-06-23T14:17:39Z
From: Andreu Ferrero
Subject: Plot survival curves after coxph() with frailty() random effects terms
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]]