chjackson / flexsurv

The flexsurv R package for flexible parametric survival and multi-state modelling
http://chjackson.github.io/flexsurv/
54 stars 28 forks source link

Plotting Kaplan Meier curves for models with interval censoring #64

Closed chjackson closed 9 months ago

chjackson commented 5 years ago

The following gives a warning "Invalid status value, converted to NA"

simt <- rweibull(1000, 2, 0.5)
status <- ifelse(simt>0.6, 0, 1)
simt[status==0] <- 0.6
tmin <- simt
tmax <- ifelse(status==1, simt, 0.7)
fs1 <- flexsurvreg(Surv(tmin, tmax, type="interval2") ~ 1, dist="weibull")
plot(fs1)

It can be worked around by doing, e.g.

plot(survfit(Surv(tmin, tmax, type="interval2") ~ 1))
lines(fs1)
chjackson commented 9 months ago

Fixed in https://github.com/chjackson/flexsurv/commit/3b76de9481f96f4107124a3e3a427a6766e6b60e