Replies: 1 comment
|
You just need to divide the results by the scaling factor. See https://robjhyndman.com/hyndsight/rolling_mase.html for a discussion of this issue -- that is about MASE, but the same principles apply to RMSSE. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
In a previews discussion (link), you showed very clearly how to calculate RMSEs for a combination of models in a cross-validation setting using the forecast package. I display the code here again
`library(forecast)
library(fpp3)
google_stock <- gafa_stock |>
filter(Symbol == "GOOG", year(Date) >= 2015) |>
mutate(day = row_number()) |>
update_tsibble(index = day, regular = TRUE)
google_2015 <- google_stock |> filter(year(Date) == 2015)
google_tscv_m1 <- tsCV(google_2015$Close, h = 8, function(x, h) {
auto.arima(x) |>
forecast(h = h)
})
google_tscv_m2 <- tsCV(google_2015$Close, h = 8, function(x, h) {
Arima(x, order = c(1, 1, 0), lambda = 0, biasadj = TRUE) |>
forecast(h = h)
})
google_tscv_comb <- tsCV(google_2015$Close, h = 8, function(x, h) {
fc1 <- Arima(x, order = c(1, 1, 0), lambda = 0, biasadj = TRUE) |>
forecast(h = h)
fc2 <- auto.arima(x) |> forecast(h = h)
fc2$mean <- 0.5 * (fc1$mean + fc2$mean)
return(fc2)
})
common_times <- apply(
!is.na(google_tscv_m1) &
!is.na(google_tscv_m2) &
!is.na(google_tscv_comb),
1,
all
)
mse <- rbind(
m1 = colMeans(google_tscv_m1[common_times, ]^2),
m2 = colMeans(google_tscv_m2[common_times, ]^2),
comb = colMeans(google_tscv_comb[common_times, ]^2)
)
mse
#> h=1 h=2 h=3 h=4 h=5 h=6 h=7 h=8
#> m1 138.8834 300.1304 444.5767 575.8839 691.6277 800.2433 918.4026 1022.969
#> m2 133.9775 297.6269 448.3832 581.2425 698.6947 796.2140 909.7168 1005.752
#> comb 135.7658 297.3055 443.5407 573.8943 688.6614 790.0591 904.4725 1003.522`
My question now is how I can calculate the scaled RMSEs for each model separately and for their combination using the forecast package
All reactions