R6 class ModelCompareBase
R6 class ModelCompareBase
new()Initialize an object to compare several Univatiate Time Series Models
ModelCompareBase$new( data = NA, mdl_list, n.ahead = NA, batch_size = NA, step_n.ahead = TRUE, verbose = 0 )
dataThe dataframe containing the time series realizations (data should not contain time index)
mdl_listA named list of all models (see format below)
n.aheadThe number of observations used to calculate ASE or forecast ahead
batch_sizeIf any of the models used sliding ase method, then this number indicates the batch size to use
step_n.aheadIf using sliding window, should batches be incremented by n.ahead (Default = TRUE)
verboseHow much to print during the model building and other processes (Default = 0)
A new 'ModelCompareBase' object.
get_data()Returns the time series realization
ModelCompareBase$get_data()
The Time Series Realization
get_data_var_interest()Returns the dependent variable data only
ModelCompareBase$get_data_var_interest()
The dependent variable data only
get_batch_size()Returns the batch size value
ModelCompareBase$get_batch_size()
The Batch Size Value
set_batch_size()Sets the batch size value
ModelCompareBase$set_batch_size(batch_size)
batch_sizeBatch Size Value
get_n.ahead()Returns the n.ahead value
ModelCompareBase$get_n.ahead()
The n.ahead value
set_verbose()Adjust the verbosity level
ModelCompareBase$set_verbose(verbose = 0)
verbose0 = 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
get_model_names()Get all the model names
ModelCompareBase$get_model_names(only_sliding = FALSE)
only_slidingIf TRUE, this will only plot the ASEs for the models that used window ASE calculations
A vector of all model names
add_models()Add models to the existing object
ModelCompareBase$add_models(mdl_list, batch_size = -1)
mdl_listThe list of new models to add
batch_sizeThe batch size to use if model is using sliding ASE calculations
remove_models()Remove models from the object
ModelCompareBase$remove_models(mdl_names)
mdl_namesA vector of the model names to remove.
keep_models()Keep only the provided models
ModelCompareBase$keep_models(mdl_names)
mdl_namesA vector of the model names to keep.
compute_metrics()Computes the Metrics for the models
ModelCompareBase$compute_metrics(step_n.ahead = TRUE)
step_n.aheadIf TRUE, for rolling window calculations, the step size will be equal to n.ahead, else it will be equal to 1
plot_simple_forecasts()Plots the simple forecast for each model
ModelCompareBase$plot_simple_forecasts( lastn = FALSE, newxreg = NA, limits = FALSE, zoom = NA, plot = TRUE )
lastnIf TRUE, this will plot the forecasts forthe last n.ahead values of the realization (Default: FALSE)
newxregThe future exogenous variable values. Applicable to models that require the values of the new exogenous variables to be provided for future forecasts, e.g. nnfor::mlp()
limitsIf TRUE, this will also plot the lower and upper limits of the forecasts (Default: FALSE)
zoomA 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.
plotIf FALSE the plots are not plotted; useful when you want to just return the data (Default = TRUE)
plot_batch_forecasts()Plots the forecasts per batch for all models
ModelCompareBase$plot_batch_forecasts( only_sliding = TRUE, plot = TRUE, silent = FALSE )
only_slidingIf TRUE, this will only plot the batch forecasts for the models that used window ASE calculations
plotIf FALSE the plots are not plotted; useful when you want to just return the data (Default = TRUE)
silentIf FALSE, any warnings are suppressed
plot_batch_ases()Plots the ASEs per batch for all models
ModelCompareBase$plot_batch_ases( only_sliding = TRUE, plot = TRUE, silent = FALSE )
only_slidingIf TRUE, this will only plot the ASEs for the models that used window ASE calculations
plotIf FALSE the plots are not plotted; useful when you want to just return the data (Default = TRUE)
silentIf FALSE, any warnings are suppressed
plot_boxplot_ases()Plots the boxplot of the ASE values for the models
ModelCompareBase$plot_boxplot_ases(plot = TRUE)
plotIf FALSE the plots are not plotted; useful when you want to just return the data (Default = TRUE)
statistical_compare()Statistically compares the ASE values of the models using ANOVA and Tukey Adjustment for multiple comparison
ModelCompareBase$statistical_compare()
The results of the ANOVA test
get_tabular_metrics()Gets the metrics and results in tabular format
ModelCompareBase$get_tabular_metrics(only_sliding = FALSE, ases = TRUE)
only_slidingIf TRUE, this will only get results for models that use a sliding ASE calculation method. (Default: FALSE)
asesIf TRUE returns the ASE values for each batch. If FALSE returns the forecasts, and the lower and upper limits asscoiated with the forecasts
summarize_build()Returns the model Build Summary (if applicable)
ModelCompareBase$summarize_build()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.