I'm using flexsurv
to compute expected lifetime for a given population by fitting a weibull curve to the data.
library(survival)
library(flexsurv)
data <- read.csv(file)
survival_col = data[["survival"]]
duration_col = data[["duration"]]
w <- flexsurvreg(Surv(duration_col,survival_col) ~ 1,data=data, dist="weibull")
Given w
, how can I compute the area under the curve, so to speak, to get the expected lifetime?