You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can tell it's doing: fc_start <- <last index value> + (<time diff between start and end> + 1 ) / <no of samples>
while it should be: fc_start <- <last index value> + <time diff between start and end> / <no of intervals>
or, equivalently: fc_start <- <last index value> + <time diff between start and end> / (<no of samples> - 1)
data<-tsibble::tsibble(
week= (lubridate::today() +lubridate::period(weeks= seq(1, 9, 4))) |>tsibble::yearweek(),
number=1:3,
index=week
)
data|>fabletools::model(arima=fable::ARIMA(number~ pdq() + PDQ())) |>fabletools::forecast(h=1)
#> Error in `mutate()`:#> ! Problem while computing `arima = (function (object, ...) ...`.#> Caused by error in `forecast()`:#> ! Forecasts from an ARIMA model must start one step beyond the end of the trained data.#> Backtrace:#> ▆#> 1. ├─fabletools::forecast(...)#> 2. ├─fabletools:::forecast.mdl_df(...)#> 3. │ └─dplyr::mutate_at(...)#> 4. │ ├─dplyr::mutate(.tbl, !!!funs)#> 5. │ └─dplyr:::mutate.data.frame(.tbl, !!!funs)#> 6. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())#> 7. │ ├─base::withCallingHandlers(...)#> 8. │ └─mask$eval_all_mutate(quo)#> 9. ├─fabletools (local) `<fn>`(...)#> 10. └─fabletools:::forecast.lst_mdl(...)#> 11. └─fabletools:::mapply_maybe_parallel(...)#> 12. └─base::mapply(FUN = .f, ..., MoreArgs = MoreArgs, SIMPLIFY = SIMPLIFY)#> 13. ├─fabletools (local) `<fn>`(dots[[1L]][[1L]], dots[[2L]][[1L]], h = 1, point_forecast = `<named list>`)#> 14. └─fabletools:::forecast.mdl_ts(...)#> 15. ├─fabletools::forecast(...)#> 16. └─fable:::forecast.ARIMA(object$fit, new_data, specials = specials, times = times, ...)#> 17. └─rlang::abort("Forecasts from an ARIMA model must start one step beyond the end of the trained data.")
The calculation of fc_start seems to work if you use an interval of single weeks, months, quarters, but not for anything else.
bottervanger
changed the title
wrong fc_start for weekly (and I guess monthly and quarterly data)
ARIMA forecasts using horizon don't work for x weekly, monthly and quarterly data where x > 1
Apr 14, 2023
bottervanger
changed the title
ARIMA forecasts using horizon don't work for x weekly, monthly and quarterly data where x > 1
ARIMA forecasts don't work for x weekly, monthly and quarterly data where x > 1
Apr 19, 2023
See reprex below.
The calculation of fc_start seems to be wrong.
From what I can tell it's doing:
fc_start <- <last index value> + (<time diff between start and end> + 1 ) / <no of samples>
while it should be:
fc_start <- <last index value> + <time diff between start and end> / <no of intervals>
or, equivalently:
fc_start <- <last index value> + <time diff between start and end> / (<no of samples> - 1)
Created on 2023-04-13 with reprex v2.0.2
Edit: wrap text in code to prevent angle brackets being swallowed
Edit: add missing term to calculation interpretation
The text was updated successfully, but these errors were encountered: