simulate.bootStMoMo: Simulate future sample paths from a Bootstrapped Stochastic...

Description Usage Arguments Details Value See Also Examples

View source: R/simulatebootStMoMo.R

Description

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.

Usage

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, ...)

Arguments

object

an object of class "bootStMoMo" with the bootstrapped parameters of a stochastic mortality model.

nsim

number of sample paths to simulate from each bootstrapped sample. Thus if there are nBoot bootstrapped samples the total number of paths will be nsim * nBoot.

seed

either NULL or an integer that will be used in a call to set.seed before simulating the time series. The default, NULL will not change the random generator state.

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 TRUE.

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. "fit"(default) uses the fitted rates and "actual" uses the actual rates from the final year.

kt.method

optional forecasting method for the period index. The alternatives are "mrwd"(default) and "iarima". See details.

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 auto.arima. This argument is only used when kt.method is "iarima".

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 TRUE. This argument is only used when kt.method is "iarima".

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 kt.lookback is provided then the last kt.lookback years of κ_t^{(i)}, i = 1,..N, are used.

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 gc.lookback is provided then the last gc.lookback years of γ_{t-x} are used.

...

other arguments.

Details

For further details see simulate.fitStMoMo.

Value

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 rates.

years

vector of years for which a simulations has been produced. This corresponds to the second dimension of rates.

kt.s

information on the simulated paths of the period indices of the model. This is a list with the simulated paths of κ_t (sim) and the years for which simulations were produced. If the mortality model does not have any age-period terms (i.e. N=0) this is set to NULL.

gc.s

information on the simulated paths of the cohort index of the model. This is a list with the simulated paths of γ_c (sim) and the cohorts for which simulations were produced. If the mortality model does not have a cohort effect this is set to NULL.

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.

See Also

bootstrap.fitStMoMo, simulate.fitStMoMo

Examples

 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)

amvillegas/StMoMo documentation built on Nov. 7, 2019, 5:39 a.m.