I'm trying to implement the Holt-Winters method in R. I have a time series whose data contains measurements over 24 hours of the day. I have a total of 5 years of data, that is, 43824 observations. I divided them into 43656 training and 168 tests. When I apply the method, I see that the values such as RMSE and MAPE are not bad, but when I plot them, it is seen that the real data and the predictions are not compatible. I'm sharing the codes: do you think I'm doing something wrong? Also, I can set the parameters of the Holt-Winters method with a for loop or something like a grid, but is there anything I can set in a shorter time?
data
date hour tem
<dttm> <dttm> <dbl>
1 2018-01-01 00:00:00 1899-12-31 00:00:00 7.68
2 2018-01-01 00:00:00 1899-12-31 01:00:00 7.30
3 2018-01-01 00:00:00 1899-12-31 02:00:00 7.21
4 2018-01-01 00:00:00 1899-12-31 03:00:00 7.53
5 2018-01-01 00:00:00 1899-12-31 04:00:00 7.78
6 2018-01-01 00:00:00 1899-12-31 05:00:00 7.93
ts
df2<-msts(r$tem, seasonal.periods=c(24,365.25*24))
componendf2_df2 <- decompose(df2)
plot(componendf2_df2)
decompose
code
HW5 <- HoltWinters(train, alpha=0.07, beta=0.05011, gamma=0.008011,seasonal = "multiplicative")
HW5_for <- forecast(HW5, h=168, level=0.95)
accuracy(HW5_for$mean,test )
output
ME RMSE MAE MPE MAPE ACF1 Theil's U
Test set 0.1607322 1.272415 0.8948736 0.7688493 28.02144 0.9874498 5.969364
graph
test%>%
autoplot() +
autolayer(test, series = "actual")+
autolayer(HW5_for$mean, series = "fit")