Computes the fit for all the available forecast combination methods on the provided dataset with respect to the loss criterion. Returns the best fit method.
auto_combine(x, criterion = "RMSE", param_list = NULL)
An object of class 'foreccomb'. Contains training set (actual values + matrix of model forecasts) and optionally a test set.
Specifies loss criterion. Set criterion to either 'RMSE' (default), 'MAE', or 'MAPE'.
Can contain additional parameters for the different combination methods (see example below).
Returns an object of class foreccomb_res
that represents the results for the best-fit forecast combination method:
Returns the best-fit forecast combination method.
Returns the individual input models that were used for the forecast combinations.
Returns the combination weights obtained by applying the best-fit combination method to the training set.
Returns the fitted values of the combination method for the training set.
Returns range of summary measures of the forecast accuracy for the training set.
Returns forecasts produced by the combination method for the test set. Only returned if input included a forecast matrix for the test set.
Returns range of summary measures of the forecast accuracy for the test set. Only returned if input included a forecast matrix and a vector of actual values for the test set.
Returns the data forwarded to the method.
The function auto_combine
allows to quickly apply all the different forecast combination methods onto the provided time series
data and selects the method with the best fit.
The user can choose from 3 different loss criteria for the best-fit evaluation:
root mean square error (criterion='RMSE'
), mean absolute error (criterion='MAE'
), and
mean absolute percentage error (criterion='MAPE'
).
In case the user does not want to optimize over the parameters of some of the combination methods,
auto_combine
allows to specify the parameter values for these methods explicitly (see Examples).
The best-fit results are stored in an object of class 'foreccomb_res', for which separate plot and summary functions are provided.
obs <- rnorm(100)
preds <- matrix(rnorm(1000, 1), 100, 10)
train_o<-obs[1:80]
train_p<-preds[1:80,]
test_o<-obs[81:100]
test_p<-preds[81:100,]
data<-foreccomb(train_o, train_p, test_o, test_p)
# Evaluating all the forecast combination methods and returning the best.
# If necessary, it uses the built-in automated parameter optimisation methods
# for the different methods.
best_combination<-auto_combine(data, criterion = "MAPE")
#> Optimization algorithm chooses number of retained models for trimmed eigenvector approach...
#> Algorithm finished. Optimized number of retained models: 4
#> Loading required package: forecast
#> Optimization algorithm chooses number of retained models for trimmed bias-corrected eigenvector approach...
#> Algorithm finished. Optimized number of retained models: 10
#> Optimization algorithm chooses trim factor for trimmed mean approach...
#> Algorithm finished. Optimized trim factor: 0.4
#> Optimization algorithm chooses trim factor for winsorized mean approach...
#> Algorithm finished. Optimized trim factor: 0.16
# Same as above, but now we restrict the parameter ntop_pred for the method comb_EIG3 to be 3.
param_list<-list()
param_list$comb_EIG3$ntop_pred<-3
best_combination_restricted<-auto_combine(data, criterion = "MAPE", param_list = param_list)
#> Optimization algorithm chooses number of retained models for trimmed bias-corrected eigenvector approach...
#> Algorithm finished. Optimized number of retained models: 10
#> Optimization algorithm chooses trim factor for trimmed mean approach...
#> Algorithm finished. Optimized trim factor: 0.4
#> Optimization algorithm chooses trim factor for winsorized mean approach...
#> Algorithm finished. Optimized trim factor: 0.16