[英]How can I apply Seasonal Exponential Smoothing forecasting method to hourly data in R
I am trying to forecast next-day hourly electricity prices for 2016 using the exponential smoothing method.我正在尝试使用指数平滑法预测 2016 年的次日每小时电价。 The data-set that I am using contains hourly price data for the period 2014-01-01 00:00 to 2016-12-31 23:00.我使用的数据集包含 2014-01-01 00:00 到 2016-12-31 23:00 期间的每小时价格数据。 My goal is to reproduce the results in Beigaitė & Krilavičius (2018)我的目标是在Beigaitė & Krilavičius (2018)中重现结果
As electricity price data exhibits multiple seasonalities (daily, weekly, and yearly), I have defined a msts object for the period 2014-01-01 to 2015-12-31由于电价数据表现出多个季节性(每日、每周和每年),我定义了一个 msts object 用于 2014-01-01 至 2015-12-31 期间
msts.elspot.prices.2014_2015 <- msts(df.elspot.prices.2014_2015$Price, seasonal.periods = c(24, 168, 8760), ts.frequency = 8760, start = 2014)
I want to use this msts object to forecast the next day (2016-01-01) hourly electricity prices using the hw()
function from the forecast
package and store the point forecasts in the data frame containing the actual hourly electricity prices for the year 2016. I want to use this msts object to forecast the next day (2016-01-01) hourly electricity prices using the hw()
function from the forecast
package and store the point forecasts in the data frame containing the actual hourly electricity prices for the year 2016 年。
df.elspot.prices.2016$pred.hw <- hw(msts.elspot.prices.2014_2015, h = 24)$mean
However, I am unable to use the hw()
function as I get the following error message:但是,由于收到以下错误消息,我无法使用hw()
function:
Error in ets(x, "AAA", alpha = alpha, beta = beta, gamma = gamma, phi = phi, : `
Frequency too high
After looking online, it appears that the ets()
function can only accept the parameter frequency
to be max 24
.上网查了一下, ets()
function 似乎只能接受参数frequency
为 max 24
。 As I am working with hourly data, this is much far below the frequency of my data.当我处理每小时数据时,这远低于我的数据频率。
Is there a way I can achieve my desired results using the hw()
function?有没有一种方法可以使用hw()
function 实现我想要的结果? Are there any other packages/functions that could help me achieve my desired results?是否有任何其他软件包/功能可以帮助我实现我想要的结果?
I appreciate your help!我感谢您的帮助!
After looking a bit more, I've came across this question where a user wanted to use the hw
method to forecast half-hourly electricity demand using the taylor
dataset available in the forecast
package.在看了更多之后,我遇到了这个问题,用户想使用hw
方法来预测半小时电力需求,使用forecast
package 中可用的taylor
数据集。
As Professor Rob Hyndman suggest in the response to the linked question, the double seasonal Holt Winters model method dshw
from the forecast
package can be used to deal with half-hourly data.正如 Rob Hyndman 教授在对相关问题的回答中所建议的那样, forecast
package 中的双季节 Holt Winters model 方法dshw
可用于处理半小时数据。
After removing the yearly seasonality parameter ( seasonal.periods = 8760
) in the definition of my msts
object, I've ran the model and it provided a pretty accurate result.在我的msts
object 的定义中删除年度季节性参数 ( seasonal.periods = 8760
) 后,我运行了 model,它提供了非常准确的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.