search for: bothsex_gompsurv

Displaying 1 result from an estimated 1 matches for "bothsex_gompsurv".

2012 Apr 22
1
using a loop with an integration
...he life expectancy at any age. Is there a way I can use a loop with the integration that will quickly return life expectancy over a range of ages, say 0 to 80, so that I don't have to manually type in the age in which I'm interested? Please see the code below. Thanks so much. --Trey hk.bothsex_Gompsurv <- function (t) { x=c(0.02342671, 0.05837508) a3<-x[1] b3<-x[2] shift<-15 S.t<-exp(a3/b3*(1-exp(b3*(t-shift)))) return<-S.t } integrate(hk.bothsex_Gompsurv,0,Inf)$value/hk.bothsex_Gompsurv(0) # life expectancy at birth (change lower limit of integral and correspond...