build.scenarios: Build Scenarios for do.BBackTesting function

Description Usage Arguments Author(s) See Also Examples

View source: R/do_BBackTesting.R

Description

This is a utility function used in the do.BBackTesting function to define the rolling evaluation windows.

Usage

1
build.scenarios(y, strategy = c(f = 20, h = 20, s = 2))

Arguments

y

Numerical vector indicating the years in input data. Optional. Default: NULL.

strategy

Fitting-Forecasting strategy. Format: numerical vector. The strategy c(f, h, s) consists in f number of years to use in fitting, h number of years to forecast and the step s to roll the evaluation window.

Author(s)

Marius D. Pascariu

See Also

do.BBackTesting

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
y <- 1900:2016

# Strategy
S <- c(f = 20, h = 20, s = 1)
# This means that:
# - 20 years of data are used to fit the models;
# - forecast 20 years and evaluate the results;
# - roll the evaluation window 1 year and repeat the process.

# 78 scenarios are created using this years and strategy.
W <- build.scenarios(y, S)
W

# The first scenario will be:
W[[1, "fit"]]
W[[1, "forecast"]]

# The last scenario will be:
W[[78, "fit"]]
W[[78, "forecast"]]

mpascariu/MortalityForecast documentation built on Dec. 10, 2018, 2:33 a.m.