## Importing mortality data from the USA available on the Human Mortality Database (HMD):
data(USA)
# Example 1: --------------------------------
USA1990 = USA[USA$Year == 1990,]
Ex = USA1990$Ex.Total[1:91]
Dx = USA1990$Dx.Total[1:91]
x = 0:90
fit <- hp(x, Ex, Dx, model = "binomial", M = 1000, bn = 0, thin = 10)
expectancy(fit)
# Example 2: -------------------------------
# Using some arguments:
Ex = USA1990$Ex.Total[1:106]
expectancy(fit, Ex = Ex, age = c(0,20,30,60,105),
max_age = 105, prob = 0.99, graph = FALSE)
Run the code above in your browser using DataLab