forecastML (version 0.5.0)

plot.forecast_results: Plot an object of class forecast_results

Description

A forecast plot for each horizon for each model in predict.forecast_model().

Usage

# S3 method for forecast_results
plot(x, data_actual = NULL,
  actual_indices = NULL, models = NULL, horizons = NULL,
  windows = NULL, facet_plot = c("model", "model_forecast_horizon"),
  group_filter = NULL, ...)

Arguments

x

An object of class 'forecast_results' from predict.forecast_model().

data_actual

A data.frame containing the target/outcome name and any grouping columns.

actual_indices

Required if data_actual is given. A vector or 1-column data.frame of numeric row indices or dates (class 'Date') with length nrow(data_actual). The data can be historical and/or holdout/test data, forecasts and actuals are matched by row.names().

models

Optional. Filter results by user-defined model name from train_model().

horizons

Optional. Filter results by horizon.

windows

Optional. Filter results by validation window number.

facet_plot

Adjust the plot display through ggplot2::facet_grid(). facet_plot = NULL plots results in one facet.

group_filter

Optional. A string for filtering plot results for grouped time-series (e.g., "group_col_1 == 'A'"); passed to dplyr::filter() internally.

...

Not used.

Value

Forecast plot of class 'ggplot'.