1

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!

Carine
  • 11
  • 4

1 Answers1

2

You can access the predicted values of Gompertz in the est column of its summary:

m1G <- summary(Gompertz)[[1]]
plot(est~time, data=m1G)

enter image description here

If you need to calculate the function at different time points than the original data, you can use

t <- 0:1000
summary(Gompertz, t=t)[[1]][,"est"]
dww
  • 30,425
  • 5
  • 68
  • 111
  • Thanks for the answer. However m1G is giving time 5, 11, 12, 13, 15,... Is it possible to receive the output of Gompertz for every time point? I.e. 1, 2, 3, 4, ... Thanks for your help. – Carine Aug 27 '18 at 07:48
  • I found the solution: `t <- seq(0, 1000, by=1) summary(Gompertz,t=t)[[1]][,"est"]` – Carine Aug 28 '18 at 09:53
  • well done! I admit I was also a bit stumped. So thanks for the Accept vote. I'll update the answer with your comment to help others. – dww Aug 28 '18 at 11:50