long_term_lm: Long-term forecast

View source: R/long_term_lm.R

long_term_lmR Documentation

Long-term forecast

Description

This function predicts the long-term load data based on the provided time series and a set of macroeconomic variables.

Usage

long_term_lm(
  longterm_and_macro_data,
  test_set_steps = 2,
  testquant = 500,
  rdm_seed = sample(1:10000, 1),
  data_directory = tempdir(),
  verbose = FALSE
)

Arguments

longterm_and_macro_data

Dataframe. Containing the load data and macroeconomic indicators derived from get_macro_economic_data.

test_set_steps

Integer. Number of time periods in the test set.

testquant

Integer. Determines how many of the best ranked models are evaluated with cross validation.

rdm_seed

A random seed to keep results consistent

data_directory

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

verbose

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

Details

The model corresponds to

\bar{D}_L(t_L)=\beta_{L,1}+\beta_{L,2}x_1(t_L)+...+ \beta_{L,10}x_{10}(t_L) \epsilon_L(t_L).

where the covariates correspond to the loaded macroeconomic variables from get_macro_economic_data. The three best models out of all possible covariate combinations are chosen and saved. The predicted and actual time series of the three best models are plotted and saved as well.

Value

A list with the dataframe with the input data and results. A list with the plotted results of the three best models. And a list with the three best models. The dataset, plots, and the models are saved in the respective folder for the country.

longterm_predictions

A dataframe with the input data and additional columns for test_set_steps and for best three models longterm_model_predictions1, longterm_model_predictions2 and longterm_model_predictions3.

longterm_plots

A list with the respective plots for each model.

longterm_models

A list with the three best models.

See Also

See also function mid_term_lm and short_term_lm for the other prediction models and get_macro_economic_data for the covariate download.

Examples

example_longterm_predictions <- long_term_lm(example_longterm_and_macro_data,
  test_set_steps = 2, testquant = 500, rdm_seed = 421
)

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