| ENS | R Documentation |
Fits and forecasts mortality rates using mortality ensemble.
ENS(
x,
M,
wm = rep(1/7, 7),
curve = c("gompertz", "makeham", "oppermann", "thiele", "wittsteinbumsted", "perks",
"weibull", "vandermaen", "beard", "heligmanpollard", "rogersplanck", "siler",
"martinelle", "thatcher", "gompertz2", "makeham2", "oppermann2", "thiele2",
"wittsteinbumsted2", "perks2", "weibull2", "vandermaen2", "beard2",
"heligmanpollard2", "rogersplanck2", "siler2", "martinelle2", "thatcher2"),
h = 10,
jumpoff = 1
)
x |
vector of ages. |
M |
matrix of mortality rates (rows as years and columns as ages). |
wm |
vector of weights for LC, RH, APC, M5, M6, M7, and STAR models (default = 1/7). |
curve |
name of mortality curve for smoothing ensemble mortality rates (including gompertz, makeham, oppermann, thiele, wittsteinbumsted, perks, weibull, vandermaen, beard, heligmanpollard, rogersplanck, siler, martinelle, thatcher, gompertz2, makeham2, oppermann2, thiele2, wittsteinbumsted2, perks2, weibull2, vandermaen2, beard2, heligmanpollard2, rogersplanck2, siler2, martinelle2, thatcher2, where first 14 curves' parameters are unconstrained and last 14 curves' parameters are generally restricted to be positive). |
h |
forecast horizon (default = 10). |
jumpoff |
if 1, forecasts are based on estimated parameters only; if 2, forecasts are anchored to observed mortality rates in final year (default = 1). |
Ensemble forecast is obtained as a weighted average of forecasts from individual stochastic mortality models. See LCS(), RHS(), APCS(), CBDS(), CBDCS(), CBDQCS(), and STARS() for more details of different stochastic mortality models.
An object of class ENS with associated S3 methods forecast and plot.
x <- 60:69
a <- c(-4.8499,-4.7676,-4.6719,-4.5722,-4.4847,-4.3841,-4.2813,-4.1863,-4.0861,-3.9962)
b <- c(0.0801,0.0909,0.0948,0.0951,0.0965,0.1014,0.1042,0.1141,0.1110,0.1118)
k <- c(12.11,10.69,11.18,9.64,9.35,8.21,6.89,5.74,4.56,3.60,
3.27,2.04,1.11,-0.44,-1.05,-1.03,-1.84,-2.90,-4.03,-4.12,
-5.18,-5.64,-6.00,-6.51,-6.91,-6.90,-8.32,-8.53,-9.69,-9.31)
set.seed(123)
M <- exp(outer(k,b)+matrix(a,nrow=30,ncol=10,byrow=TRUE)+rnorm(300,0,0.035))
fit <- ENS(x=x,M=M,curve="makeham",h=30,jumpoff=2)
forecast::forecast(fit)
plot(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.