fitg <- flexsurvreg(formula = Surv(futime, fustat) ~ age, data = ovarian, dist = "gengamma")
cs <- coxsnell_flexsurvreg(fitg)
## Model appears to fit well, with some small sample noise
surv <- survfit(Surv(cs$est, ovarian$fustat) ~ 1)
plot(surv, fun="cumhaz")
abline(0, 1, col="red")
Run the code above in your browser using DataLab