plot_model: Plot the Models Performance on the Testing Partitions

plot_modelR Documentation

Plot the Models Performance on the Testing Partitions

Description

Plot the Models Performance on the Testing Partitions

Usage

plot_model(model.obj, model_ids = NULL)

Arguments

model.obj

A train_model object

model_ids

A character, defines the trained models to plot, if set to NULL (default), will plot all the models

Details

The plot_model provides a visualization of the models performance on the testing paritions for the train_model function output

Value

Animation of models forecast on the testing partitions compared to the actuals

Examples

 ## Not run: 
# Defining the models and their arguments
methods <- list(ets1 = list(method = "ets",
                            method_arg = list(opt.crit = "lik"),
                            notes = "ETS model with opt.crit = lik"),
                ets2 = list(method = "ets",
                            method_arg = list(opt.crit = "amse"),
                            notes = "ETS model with opt.crit = amse"),
                arima1 = list(method = "arima",
                              method_arg = list(order = c(2,1,0)),
                              notes = "ARIMA(2,1,0)"),
                arima2 = list(method = "arima",
                              method_arg = list(order = c(2,1,2),
                                                seasonal = list(order = c(1,1,1))),
                              notes = "SARIMA(2,1,2)(1,1,1)"),
                hw = list(method = "HoltWinters",
                          method_arg = NULL,
                          notes = "HoltWinters Model"),
                tslm = list(method = "tslm",
                            method_arg = list(formula = input ~ trend + season),
                            notes = "tslm model with trend and seasonal components"))
# Training the models with backtesting
md <- train_model(input = USgas,
                  methods = methods,
                  train_method = list(partitions = 6, 
                                      sample.out = 12, 
                                      space = 3),
                  horizon = 12,
                  error = "MAPE")
# Plot the models performance on the testing partitions
plot_model(model.obj = md)

# Plot only the ETS models
plot_model(model.obj = md , model_ids = c("ets1", "ets2"))

## End(Not run)

TSstudio documentation built on Aug. 9, 2023, 9:06 a.m.