I have a survival kapplan-Meier curves and I want to extrapolate different model curves (e.g. Weibull, Gompertz,...) using the flexsurv package. I have succeed to do the extrapolation but I do not find the solution to create a matrix of the extrapolation plot.
library(survival)
library(flexsurv)
kmsurvival <- survfit (Surv(time, status) ~ 1, data=lung)
summary(kmsurvival)
plot(kmsurvival, xlab="Time", ylab="Survival probability")
Gompertz<-flexsurvreg(Surv(time, status)~1, data=lung, dist="gompertz")
plot(Gompertz)
I would like to create an output of KM survival curve and the extrapolation like in the plots.
For example with the KM curve (20 first time points):
v1 <- rep(NA,20)
v2<-1:20
for(i in 1:20){
v1[i] <- summary(kmsurvival, i)$surv
i=i+1
}
m1KM<-data.frame(v2,v1)
I would like to do the same with the Gompertz extrapolation, but I am not able to access the results applying this curve for each time point. Any help??? Thanks!