简体   繁体   English

使用 ARIMA 进行每小时预测

[英]Hourly Forecasting using ARIMA

I want to forecast the hourly rate of electricity using ARIMA.我想使用 ARIMA 预测每小时的电费。 But, I won't be able to set the ts function correctly which results in no forecasting in Arima.但是,我无法正确设置 ts function,这会导致 Arima 无法进行预测。 My data has 24 entries per day.我的数据每天有 24 个条目。 My aim is to predict 2022-05-01 18:00:00我的目标是预测2022-05-01 18:00:00

Please help.请帮忙。

Here is code: start date: 07/01/2015 1:00, end date: 4/26/2022 15:00这是代码:开始日期:07/01/2015 1:00,结束日期:4/26/2022 15:00

data$Category  <- as.Date(data$Category, format = "%m/%d/%Y")
data <- data[order(data$Category), ]

Y <- ts(data[,2], start = c(2015,07,01), frequency = 365*23)
fit_arima <- auto.arima(Y, d=1, D=1, stepwise = FALSE, approximation = FALSE, trace = TRUE)
print(summary(fit_arima))
checkresiduals(fit_arima)

Data sample:数据样本:

Category    Series ID
07/01/2015 1:00 5244
07/01/2015 2:00 5152
07/01/2015 3:00 4948
07/01/2015 4:00 4485
07/01/2015 5:00 4231
07/01/2015 6:00 4158
07/01/2015 7:00 4324
07/01/2015 8:00 4686
07/01/2015 9:00 5060
07/01/2015 10:00    5347
07/01/2015 11:00    5504
07/01/2015 12:00    4368
07/01/2015 13:00    5440
07/01/2015 14:00    5280
07/01/2015 15:00    5227
07/01/2015 16:00    5195
07/01/2015 17:00    5195
07/01/2015 18:00    5252
07/01/2015 19:00    5200
07/01/2015 20:00    5228
07/01/2015 21:00    5244
07/01/2015 22:00    5277
07/01/2015 23:00    4517
08/01/2015 0:00 4629
08/01/2015 1:00 4996
08/01/2015 2:00 4910
08/01/2015 3:00 4655
08/01/2015 4:00 4230
08/01/2015 5:00 4000
08/01/2015 6:00 3943
08/01/2015 7:00 3907
08/01/2015 8:00 4830
08/01/2015 9:00 5298
08/01/2015 10:00    5638
08/01/2015 11:00    5874
08/01/2015 12:00    3910
08/01/2015 13:00    5864
08/01/2015 14:00    5943
08/01/2015 15:00    5893
08/01/2015 16:00    5744
08/01/2015 17:00    5573
08/01/2015 18:00    5392
08/01/2015 19:00    5290
08/01/2015 20:00    5231
08/01/2015 21:00    5152
08/01/2015 22:00    5063
08/01/2015 23:00    4125

The issue you may be having is that the frequency should be 24, not 365*23 since the cycle repeats every 24 rows/observations.您可能遇到的问题是频率应该是 24,而不是 365*23,因为循环每 24 行/观察重复一次。

As a suggestion ARIMA has trouble with daily/hourly/yearly seasonality which is more than likely present with electricity usage.作为一个建议,ARIMA 在每日/每小时/每年的季节性方面存在问题,这很可能与用电量有关。

If you are looking for an easy to operate forecasting model for hourly data consider TBATS (also in the forecast Package).如果您正在寻找一种易于操作的每小时数据预测 model,请考虑 TBATS(也在预测包中)。 It's a bit slow but it is very simple to use and handles multiple seasonality better.它有点慢,但使用起来非常简单,并且可以更好地处理多个季节性。 You could run both and see which one gives better forecast accuracy.您可以同时运行两者,看看哪一个能提供更好的预测准确性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM