combine_models: Combine forecast models

View source: R/combine_models.R

combine_modelsR Documentation

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
)

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).

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.

Examples

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

oRaklE documentation built on June 8, 2025, 12:41 p.m.