Learn R Programming

oRaklE (version 1.0.2)

combine_models: Combine forecast models

Description

This function combines the three separate forecasts for the low, mid and high frequency model. The three separate forecasts need to be run first.

Usage

combine_models(
  longterm_predictions,
  midterm_predictions,
  shortterm_predictions,
  longterm_model_number = 1,
  data_directory = tempdir(),
  verbose = FALSE
)

Value

A list with the dataframe with the combined model results. A dataframe with selected model metrics. And a list with the plotted results. The combined model predictions, plots, and metrics are saved in the respective folder for the country.

combined_model_predictions

A dataframe with the combined model results.

combined_model_metrics

A dataframe with model metrics.

combined_model_plots

A list with the plot for the full timeseries, a plot with two sample weeks, and a stacked plot with both.

Arguments

longterm_predictions

Dataframe. The object resulting from function long_term_lm.

midterm_predictions

Dataframe. The object resulting from function mid_term_lm.

shortterm_predictions

Dataframe. The object resulting from function short_term_lm.

longterm_model_number

Integer. Specifies which of the 3 best long-term models should be used.

data_directory

The path to the directory where the results, metrics and plots will be saved. The default is set to a temporary directory.

verbose

A boolean value indicating if you want the generated plots and final result metrics to be shown (set to TRUE if yes).

Examples

Run this code
example_full_model_predictions <- combine_models(example_longterm_predictions,
  example_midterm_predictions, example_shortterm_predictions,
  longterm_model_number = 1
)

Run the code above in your browser using DataLab