View source: R/close_mortality_rates.R
close_mortality_rates | R Documentation |
This function closes the fitted and simulated mortality rates using the method of Kannisto.
close_mortality_rates( yv, sim_qxt, kannisto_nages, kannisto_nobs, parallel = FALSE )
yv |
The vector of years. |
sim_qxt |
The mortality rates to close. An array with dimensions (age, years, simulations). |
kannisto_nages |
The extrapolation ages used for closing the mortality rates. |
kannisto_nobs |
The number of observations used to extrapolate. |
parallel |
Logical. Use parallel processing to speed up the calculations? |
The argument sim_qxt
should be the output of the function
project_mortality_rates
An array of dimension (age, years, simulations) reporting the closed mortality rates.
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 <- 50 n_sim <- 10000 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.