Description Usage Arguments Details Value See Also Examples
View source: R/simulatebootStMoMo.R
Simulate future sample paths from a Bootstrapped Stochastic Mortality Model. The period indexes κ_t^{(i)}, i = 1,..N, are modelled using ether a Multivariate Random Walk with Drift (MRWD) or N independent ARIMA(p, d, q) models. The cohort index γ_{t-x} is modelled using an ARIMA(p, d, q). By default an ARIMA(1, 1, 0) with a constant is used.
1 2 3 4 5 6 | ## S3 method for class 'bootStMoMo'
simulate(object, nsim = 1, seed = NULL, h = 50,
oxt = NULL, gc.order = c(1, 1, 0), gc.include.constant = TRUE,
jumpchoice = c("fit", "actual"), kt.method = c("mrwd", "iarima"),
kt.order = NULL, kt.include.constant = TRUE, kt.lookback = NULL,
gc.lookback = NULL, ...)
|
object |
an object of class |
nsim |
number of sample paths to simulate from each bootstrapped
sample. Thus if there are |
seed |
either |
h |
number of years ahead to forecast. |
oxt |
optional array/matrix/vector or scalar of known offset to be added in the simulations. This can be used to specify any a priori known component to be added to the simulated predictor. |
gc.order |
a specification of the ARIMA model for the cohort effect: the three components (p, d, q) are the AR order, the degree of differencing, and the MA. The default is an ARIMA(1, 1, 0). |
gc.include.constant |
a logical value indicating if the ARIMA model
should include a constant value. The default is |
jumpchoice |
option to select the jump-off rates, i.e. the rates
from the final year of observation, to use in projections of mortality
rates. |
kt.method |
optional forecasting method for the period index.
The alternatives are |
kt.order |
an optional matrix with one row per period index
specifying the ARIMA models: for the ith row (ith period index) the three
components (p, d, q) are the AR order, the degree of differencing,
and the MA order. If absent the arima models are fitted using
|
kt.include.constant |
an optional vector of logical values
indicating if the ARIMA model for the ith period index should include a
constant value. The default is |
kt.lookback |
optional argument to specify the look-back window to use
in the estimation of the time series model for the period indexes. By
default all the estimated values are used. If
|
gc.lookback |
optional argument to specify the look-back window to use
in the estimation of the ARIMA model for the cohort effect. By
default all the estimated values are used in estimating the ARIMA
model. If |
... |
other arguments. |
For further details see simulate.fitStMoMo
.
A list of class "simStMoMo"
with components
rates |
a three dimensional array with the future simulated rates. |
ages |
vector of ages corresponding to the first dimension of
|
years |
vector of years for which a simulations has been produced.
This corresponds to the second dimension of |
kt.s |
information on the simulated paths of the period indices of
the model. This is a list with the simulated paths of κ_t
( |
gc.s |
information on the simulated paths of the cohort index of the
model. This is a list with the simulated paths of γ_c
( |
oxt.s |
a three dimensional array with the offset used in the simulations. |
fitted |
a three dimensional array with the in-sample rates of the model for the years for which the mortality model was fitted (and bootstrapped). |
jumpchoice |
Jump-off method used in the simulation. |
kt.method |
method used in the modelling of the period index. |
model |
the bootstrapped model from which the simulations were produced. |
bootstrap.fitStMoMo
, simulate.fitStMoMo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #Long computing times
## Not run:
#Lee-Carter: Compare projection with and without parameter uncertainty
library(fanplot)
LCfit <- fit(lc(), data = EWMaleData)
LCResBoot <- bootstrap(LCfit, nBoot = 500)
LCResBootsim <- simulate(LCResBoot)
LCsim <- simulate(LCfit, nsim = 500)
plot(LCfit$years, log(LCfit$Dxt / LCfit$Ext)["10", ],
xlim = range(LCfit$years, LCsim$years),
ylim = range(log(LCfit$Dxt / LCfit$Ext)["10", ],
log(LCsim$rates["10", , ])),
type = "l", xlab = "year", ylab = "log rate",
main = "Mortality rate projection at age 10 with and without parameter uncertainty")
fan(t(log(LCResBootsim$rates["10", , ])),start = LCResBootsim$years[1],
probs = c(2.5, 10, 25, 50, 75, 90, 97.5), n.fan = 4,
fan.col = colorRampPalette(c(rgb(0, 0, 1), rgb(1, 1, 1))), ln = NULL)
fan(t(log(LCsim$rates["10", 1:(length(LCsim$years) - 3), ])),
start = LCsim$years[1], probs = c(2.5, 10, 25, 50, 75, 90, 97.5),
n.fan = 4, fan.col = colorRampPalette(c(rgb(1, 0, 0), rgb(1, 1, 1))),
ln = NULL)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.