ModelCombine: R6 class ModelCompareMultivariate

Description Methods

Description

R6 class ModelCompareMultivariate

R6 class ModelCompareMultivariate

Methods

Public methods


Method new()

Initialize an object to compare several Univatiate Time Series Models

Usage
ModelCombine$new(
  data = NA,
  var_interest = NA,
  uni_models = NA,
  var_models = NA,
  mlp_models = NA,
  verbose = 0
)
Arguments
data

The dataframe containing the time series realizations (data should not contain time index)

var_interest

The output variable of interest (dependent variable)

uni_models

A vector of ModelCompareUnivariate objects

var_models

A vector of ModelCompareMultivariateVAR objects

mlp_models

A vector of ModelCompareNNforCaret objects (only picks the best caret model)

verbose

How much to print during the process (Default = 0)

Returns

A new 'ModelCombine' object.


Method get_data()

Returns the time series realization

Usage
ModelCombine$get_data()
Returns

The Time Series Realization


Method get_var_interest()

Returns the dependent variable name

Usage
ModelCombine$get_var_interest()
Returns

The dependent variable name


Method get_data_var_interest()

Returns the dependent variable data only

Usage
ModelCombine$get_data_var_interest()
Returns

The dependent variable data only


Method set_verbose()

Adjust the verbosity level

Usage
ModelCombine$set_verbose(verbose = 0)
Arguments
verbose

0 = Minimal Printing only (usualy limited to step being performed) 1 = Basic printing of model builds, etc. 2 = Reserved for debugging mode. May slow down the run due to excessive printing, especially when using batches


Method plot_simple_forecasts()

Plots the simple forecast for each model

Usage
ModelCombine$plot_simple_forecasts(
  lastn = FALSE,
  newxreg = NA,
  limits = FALSE,
  zoom = NA
)
Arguments
lastn

If TRUE, this will plot the forecasts forthe last n.ahead values of the realization (Default: FALSE)

newxreg

The future exogenous variable values to be used for prediction. Applicable to models that require the values of the new exogenous variables to be provided for future forecasts, e.g. nnfor::mlp()

limits

If TRUE, this will also plot the lower and upper limits of the forecasts (Default: FALSE)

zoom

A number indicating how much to zoom into the plot. For example zoom = 50 will only plot the last 50 points of the realization Useful for cases where realizations that are long and n.ahead is small.


Method plot_batch_forecasts()

Plots the forecasts per batch for all models

Usage
ModelCombine$plot_batch_forecasts(only_sliding = TRUE)
Arguments
only_sliding

If TRUE, this will only plot the batch forecasts for the models that used window ASE calculations


Method plot_batch_ases()

Plots the ASEs per batch for all models

Usage
ModelCombine$plot_batch_ases(only_sliding = TRUE)
Arguments
only_sliding

If TRUE, this will only plot the ASEs for the models that used window ASE calculations


Method plot_boxplot_ases()

Plots the boxplot of the ASE values for the models

Usage
ModelCombine$plot_boxplot_ases()

Method statistical_compare()

Statistically compares the ASE values of the models using ANOVA and Tukey Adjustment for multiple comparison

Usage
ModelCombine$statistical_compare()
Returns

The results of the ANOVA test


Method get_tabular_metrics()

Gets the metrics and results in tabular format

Usage
ModelCombine$get_tabular_metrics(only_sliding = FALSE, ases = TRUE)
Arguments
only_sliding

If TRUE, this will only get results for models that use a sliding ASE calculation method. (Default: FALSE)

ases

If TRUE returns the ASE values for each batch. If FALSE returns the forecasts, and the lower and upper limits asscoiated with the forecasts


Method compute_simple_forecasts()

Computes the simple forecasts using all the models

Usage
ModelCombine$compute_simple_forecasts(lastn = FALSE, newxreg = NA)
Arguments
lastn

If TRUE, this will get the forecasts for the last n.ahead values of the realization (Default: FALSE). If there is a ModelCompareNNforCaret object passed to this object, then lastn must be TRUE.

newxreg

The future exogenous variable values to be used for prediction. Applicable to models that require the values of the new exogenous variables to be provided for future forecasts, e.g. nnfor::mlp()

Returns

The forecasted values


Method create_ensemble()

Creates an ensemble model based on all the models provided

Usage
ModelCombine$create_ensemble(cuts = NA)

Method predict_ensemble()

Makes a prediction based on the ensemble model

Usage
ModelCombine$predict_ensemble(naive = FALSE, comb = "median", newxreg = NA)
Arguments
naive

If TRUE, the ensemble will be a simple mean of the prediction of all the models If FALSE, the ensemble will use a glm model created from the batch predictions of all the models

comb

If 'naive' = TRUE, how to combine the predictions. Allowed values are 'mean' or 'median'

newxreg

The future exogenous variable values to be used for prediction. Applicable to models that require the values of the new exogenous variables to be provided for future forecasts, e.g. nnfor::mlp()

Returns

The predictions from each model along with the ensemble prediction


Method clone()

The objects of this class are cloneable with this method.

Usage
ModelCombine$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


josephsdavid/tswgewrapped documentation built on July 31, 2020, 9:36 a.m.