I am plotting a Kaplan-Meier (KM) curve for the readmission data which is available in the R package frailtypack. I used these simple codes which stratifies the curve by sex variable:
library(survival)
library(frailtypack)
data(readmission)
readmission
sobj<-Surv(readmission$time,readmission$event==1)
km.plot <- survfit(sobj ~readmission$sex, data = readmission)
km.plot
plot(km.plot,lty=c(1,2),lwd=2)
legend(x="bottomleft",lty=c(1,2),lwd=2, legend=c("Male","Female"))
The data is on recurrent events (i.e. subjects have multiple failure times). The output from "km.plot" tells me that there are substantial censored event times for both males and females. Under this I expect the KM curves to level-off to non-zero survival probabilities but that of the female goes zero. I still get this when I produce the plot for only the first event times, neglecting subsequent ones.
I think something is probably wrong with my code but finding it hard to figure it out. I greatly appreciate any help on this