This function decomposes the load data into three components: a yearly long-term trend, a daily mid-term seasonality, and an hourly short-term seasonality. If the data is available only at a daily resolution, the calculation of hourly seasonality is skipped. The results of the decomposition are returned as a list of dataframes. The series are plotted additionally.
decompose_load_data(load_data, data_directory = tempdir(), verbose = FALSE)A list of three data frames with
A data frame of the long-term trend, including columns for country, year, and yearly average hourly demand.
A data frame of the mid-term component, including country, date, year, month, day, weekday, average hourly demand, and seasonal average hourly demand. Where seasonal average hourly demand corresponds to the difference between the yearly average demand per hour and the daily average demand per hour of the respective day.
A data frame of the short-term component, including country, date, year, month, day, weekday, hour, hourly demand, and hourly demand trend and trend and season corrected. Where hourly demand trend and season corrected corresponds to the difference between the daily average demand per hour and the actual demand in the respective hour, effectively showing the intra-day pattern.
A list with all created plots.
A data frame object with "load", "date", "unit", and "country" columns
Consisting of the load values, numeric.
Consisting of the datetime values, datetime (e.g. POSIXct).
Indicating the unit, e.g. MW, character.
Indicating the country's ISO2C code, character.
The path to the directory where the data will be saved. The default is set to a temporary directory.
A boolean value indicating if you want the generated plots to be shown (set to TRUE if yes)
example_decomposed_data <- decompose_load_data(example_demand_data_filled)
Run the code above in your browser using DataLab