Learn R Programming

GeomComb (version 1.0)

auto_combine: Automated Forecast Combination

Description

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.

Usage

auto_combine(x, criterion = "RMSE", param_list = NULL)

Arguments

x
An object of class 'foreccomb'. Contains training set (actual values + matrix of model forecasts) and optionally a test set.
criterion
Specifies loss criterion. Set criterion to either 'RMSE' (default), 'MAE', or 'MAPE'.
param_list
Can contain additional parameters for the different combination methods (see example below).

Value

Returns an object of class foreccomb_res that represents the results for the best-fit forecast combination method: that represents the results for the best-fit forecast combination method:

Details

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.

See Also

foreccomb, plot.foreccomb_res, summary.foreccomb_res, accuracy

Examples

Run this code
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")

# 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)

Run the code above in your browser using DataLab