tsbacktest: Walk Forward Model Backtest

tsbacktest.arima.specR Documentation

Walk Forward Model Backtest

Description

Generates an expanding window walk forward backtest.

Usage

## S3 method for class 'arima.spec'
tsbacktest(
  object,
  start = floor(NROW(object$target$y_orig)/2),
  end = NROW(object$target$y_orig),
  h = 1,
  alpha = NULL,
  trace = FALSE,
  ...
)

## S3 method for class 'bsts.spec'
tsbacktest(
  object,
  start = floor(NROW(object$target$y_orig)/2),
  end = NROW(object$target$y_orig),
  h = 1,
  alpha = NULL,
  trace = FALSE,
  n_iter = 5000,
  ...
)

Arguments

object

an object of class “bsts.spec” or “arima.spec”.

start

numeric data index from which to start the backtest.

end

numeric data index on which to end the backtest. The backtest will end 1 period before that date in order to have at least 1 out of sample value to compare against.

h

forecast horizon. As the expanding window approaches the “end”, the horizon will automatically shrink to the number of available out of sample periods.

alpha

optional numeric vector of coverage rates for which to calculate the quantiles.

trace

whether to show the progress bar. The user is expected to have set up appropriate handlers for this using the “progressr” package.

...

not currently used.

n_iter

number of MCMC iterations.

Value

A list with the following data.tables:

  • prediction : the backtest table with forecasts and actuals

  • metrics: a summary performance table showing metrics by forecast horizon (MAPE, MSLRE, BIAS and MIS if alpha was not NULL).

Note

The function can use parallel functionality as long as the user has set up a plan using the future package.


tsmodels/tsforeign documentation built on June 22, 2022, 2:09 p.m.