life_exp | R Documentation |
This function calculates the estimated period and/or cohort life
expectancies based on the closed, fitted and simulated mortality rates, as
retreived from the function close_mortality_rates
.
life_exp(le_yv, le_type, le_ages, sim_qxt_cl, parallel = TRUE)
le_yv |
The vector of years on which estimations are made. |
le_type |
Character vector, specifying the type of life expectancy:
|
le_ages |
The vector of ages for which life expectancy estimations are made. |
sim_qxt_cl |
The closed mortality rates to close. An array with dimensions (closed ages, years, simulations). |
parallel |
Logical. Use parallel processing to speed up calculations? |
The argument sim_qxt_cl
should be the output of the function
close_mortality_rates
A list containing
$per A list of length(le_ages) containing matrices of dimension length(le_yv) x (number of simulations) that contain the estimated period life expectancies.
$coh A list of length(le_ages) containing matrices of dimension length(le_yv) x (number of simulations) that contain the estimated cohort life expectancies.
lst <- MultiMoMo::european_mortality_data dat_M <- lst$M dat_F <- lst$F xv <- 0:90 yv = yvSPEC <- 1970:2018 Countries <- names(dat_M$UNI) CountrySPEC <- "BE" fit_M <- fit_li_lee(xv, yv, yvSPEC, CountrySPEC, dat_M, "NR", TRUE, FALSE) fit_F <- fit_li_lee(xv, yv, yvSPEC, CountrySPEC, dat_F, "NR", TRUE, FALSE) arima_spec <- list(K.t_M = "RWD", k.t_M = "AR3.1", K.t_F = "RWD", k.t_F = "AR5.0") n_ahead <- 52 + 120 n_sim <- 1000 est_method <- "PORT" proj_par <- project_parameters(fit_M, fit_F, n_ahead, n_sim, arima_spec, est_method) proj_rates <- project_mortality_rates(fit_M, fit_F, proj_par) kannisto_nages <- 30 kannisto_nobs <- 11 close_rates_M <- close_mortality_rates(yvSPEC, proj_rates$Male, kannisto_nages, kannisto_nobs) close_rates_F <- close_mortality_rates(yvSPEC, proj_rates$Female, kannisto_nages, kannisto_nobs) le_yv <- 1970:2070 le_ages <- c(0,65) le_type <- c("per", "coh") le_M <- life_exp(le_yv, le_type, le_ages, close_rates_M)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.