nested_cross_validation: Nested cross validation for Multiresolution Forecasts

Description Usage Arguments Details Value Author(s) References Examples

View source: R/nested_cross_validation.R

Description

This function computes a nested cross validation (with the rolling forecasting origin). The data is split into 3 datasets: training, test and evaluation dataset. The best model is selected on the test and its performance is measured on the evaluation dataset.

Usage

1
2
nested_cross_validation(UnivariateData, Horizon=14, EvaluationLength=2, TestLength=2,
Method = "r", MultivariateData=NULL, NumMV=1, NumClusters = 1)

Arguments

UnivariateData

[1:n] Numerical vector with n values.

Horizon

Number indicating horizon for forecast from 1 to horizon.

EvaluationLength

Number indicating how many points are used for cross validation for the evaluation dataset.

TestLength

Number indicating how many points are used for cross validation for the test dataset.

Method

String indicating which method to use. Available methods: 'r' = Autoregression. 'nn' = Neural Network.

MultivariateData

Not implemented yet.

NumMV

Not implemented yet.

NumClusters

Number of clusters used for parallel computing.

Details

The evaluation function (optimization function) is built with a rolling forecasting origin (rolling_window function), which computes a h-step ahead forecast (for h = 1, ..., horizon) for window_size many steps. The input space is searched with an evolutionary optimization method. The deployed forecast method can be an autoregression or a neural network (multilayer perceptron with one hidden layer).

Value

Best

[1:Scales+1] Numerical vector with integers associated with the best found number of coefficients per wavelet scale (1:Scales) and number of coefficients for the smooth approximation level in the last entry.

Error

[1:Window, 1:Horizon] Numerical Matrix with 'Window' many rows entries indicating one time point with 'Horizon' many forecast errors.

Forecast

[1:Window, 1:Horizon] Numerical Matrix with 'Window' many rows entries indicating one time point with 'Horizon' many forecasts.

Author(s)

Quirin Stier

References

Hyndman, R. and Athanasopoulos, G. Forecasting: principles and practice. OTexts, 3 edition. 2018.

Examples

1
2
3
4
5
6
data(entsoe)
res = nested_cross_validation(entsoe$value, Horizon = 2, EvaluationLength=2,
TestLength=2, Method="r", MultivariateData=NULL, NumMV=1, NumClusters=1)
BestCoefficientCombination = res$Best
Error = res$Error
Forecast = res$Forecast

Quirinms/MRFR documentation built on Dec. 18, 2021, 8:43 a.m.