tsbacktest.tsgarch.spec {tsgarch} | R Documentation |
Walk Forward Rolling Backtest
Description
Generates an expanding window walk forward backtest with option for rolling the forecast by filtering (see details).
Usage
## S3 method for class 'tsgarch.spec'
tsbacktest(
object,
start = floor(length(object$target$y_orig))/2,
end = length(object$target$y_orig),
h = 1,
estimate_every = 1,
rolling = FALSE,
trace = FALSE,
...
)
Arguments
object |
an object of class “tsgarch.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. |
estimate_every |
number of periods at which the model is re-estimated (defaults to 1). |
rolling |
this indicates whether forecasts are made only on the estimation date (FALSE) or whether to filter the data 1 period at a time and forecast from the filtered data (TRUE). |
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. |
Details
The rolling option allows to re-estimate the data every n periods whilst filtering the data 1-step ahead between re-estimation dates so that overlapping forecasts are generated.
Value
A list which includes a data.table having the following columns:
estimation_date: the date at which the model was estimated.
convergence: whether both kkt1 and kkt2 were TRUE ( Kuhn Karush Tucker conditions) from the kktchk function in optimx.
filter_date: the date on which a prediction was generated. For rolling prediction this means that an estimated model was filtered for new data prior to re-predicting.
horizon: the forecast horizon of the prediction.
size: the length of the data used in estimation.
forecast_date: the date corresponding to the forecast.
mu: the conditional mean prediction.
sigma: the conditional volatility prediction.
skew: the distribution skew parameter (non-time varying hence constant across each estimation window).
shape: the distribution shape parameter (non-time varying hence constant across each estimation window).
shape: the distribution lambda parameter (non-time varying hence constant across each estimation window).
actual: the actual observation corresponding to the forecast date.
Additional slots in the list include the distribution used and other information relating to the backtest setup.
Note
The function can use parallel functionality as long as the user has
set up a plan
using the future package.