i want to compare an arima model with a prophet model on yearly data.
In order to use prophet it seems i need to at least have a montly date-format, so i used yearmonth to convert the date to the ymd format. As result i have a timeseries with one month per year.
I can fit both model like that.
When i want to create the forecast though, i get following error from the ARIMA forecast:
invalid class “Period” object: periods must have integer values
I figured this is caused by the gaps in the monthly timeseries. The function fill_gaps does not fill the gaps however if i have a regular gaps in the yearmonth tsibble index.
The ARIMA models seem not to create forecasts on timeseries with expli gaps anyways
Is there any way to forecast with prophet and ARIMA together without interpolating the steries to be monthly?
Creating a forecast with ARIMA on a tsibble that only has the year as integer as index is no issue, prophet however doesn't allow that.
Here you find modified example code based on the fable prophet documentation.
library(tsibble)
library(dplyr)
library(fable.prophet)
library(fable)
cafe <- tsibbledata::aus_retail %>%
filter(Industry == "Cafes, restaurants and catering services")
fit <- cafe %>%
group_by(State,Industry,format(Month, "%Y"))%>%
# insert gaps
slice_max(order_by=Month)%>%
update_tsibble(index=Month)%>%
# doesn't fill gaps because they are regular
fill_gaps()%>%
model(
prophet = prophet(Turnover ~ season("year", 4, type = "multiplicative")),
arima=ARIMA(Turnover)
)
## error occurs here
fc <- fit %>%
forecast(h = 24)
Thanks for your help.