mid_term_lm: Mid-term forecast

View source: R/mid_term_lm.R

mid_term_lmR Documentation

Mid-term forecast

Description

The mid-term load series is forecasted based on the provided load time series and weather data. The prediction is either based on the (lagged) temperature data in combination with transformed variables for heating and cooling days or on a spline regression applied on the temperature data to account for non-linear effects.

Usage

mid_term_lm(
  demand_and_weather_data,
  Tref = 18,
  test_set_steps = 730,
  method = "temperature transformation",
  data_directory = tempdir(),
  verbose = FALSE
)

Arguments

demand_and_weather_data

Dataframe. Containing the mid-term load data, the holidays and weather data obtained from get_weather_data.

Tref

Numeric. Reference temperature as basis for the calculation of cooling and heating days.

test_set_steps

Integer. Number of time periods in the test set.

method

String. Indicates which model selection process is used. If method="temperature transformation", the temperature values are transformed to heating and cooling degree days to capture the non-linear relationship of temperature and electricity demand. If the method is set to "spline" a spline regression is instead used without the transformation of the temperature data.

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

Value

A list with the dataframe with the input data and results. The plot with the midterm seasonality forecast. And the midterm model. The dataset, the plot, and the model are saved in the respective folder for the country.

midterm_predictions

A dataframe with the input and prediction data for the mid-term seasonality.

midterm_plot

A plot with the prediction results.

midterm_model

The mid-term seasonality model.

Examples


example_midterm_predictions <- mid_term_lm(example_midterm_demand_and_weather_data$demand,
  Tref = 18, test_set_steps = 730, method = "temperature transformation"
)


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