coxed icon indicating copy to clipboard operation
coxed copied to clipboard

Generated survival curve does not match the KM estimate

Open IyarLin opened this issue 3 years ago • 0 comments

Hi,

Thanks for writing this package - it looks very promising. I have encountered a weird behavior though: It would seem that the observations generated by sim.survdata function do not align with the baseline survival underlying it.

Below is an example:

library(survival)
library(coxed)
set.seet(1)
X <- matrix(rep(0, N), ncol = 1) # no covariates
simdata <- sim.survdata(N=10000, T=30, num.data.frames=1, X = X)
est_surv <- survfit(Surv(y,failed) ~ 1, data = simdata$data)

plot(est_surv)
points(1:length(simdata$baseline$survivor), simdata$baseline$survivor, col = "red")

image

The underlying survival seems to be somewhat lower than the actual survival of the units generated by the procedure. I would appreciate your input as to what I'm missing here.

Many thanks,

Iyar

IyarLin avatar Sep 06 '22 16:09 IyarLin