Thanks @mitchelloharawild ! In my original data set, average of three models is performing the best. I am trying to use your suggested code here to use average as my main model. Initially, when I tried the following, it gave me this error:
Error: Can't convert distribution> to character>.
path <- ("FC")
df %>%
model(
snaive = SNAIVE(Sales ~ lag("year")),
ets = ETS(Sales),
arima = ARIMA(Sales)
)%>%
mutate(average = (ets + arima + snaive) / 3)%>%
forecast(h = "3 years")%>%
write_csv(path) # Write to a csv
# Read in the CSV
read_csv(path)
Then I tried taking mean and variance as per your suggestion. Variance didn't work, but mean worked and I was able to save it also.
path <- ("FC")
df %>%
model(
snaive = SNAIVE(Sales ~ lag("year")),
ets = ETS(Sales),
arima = ARIMA(Sales)
)%>%
mutate(average = (ets + arima + snaive) / 3)%>%
forecast(h = "3 years")%>%
summarise(mean = mean(Sales))%>%
write_csv(path) # Write to a csv
# Read in the CSV
df1 <- read_csv(path)
Then, I updated my packages to see if variance works and now even mean doesn't work using the same code as above and gives the following error:
Error: The result is not a valid tsibble.
i Do you need as_tibble() to work with data frame?
I am struggling with saving the final results.
Thanks for your help!
Any suggestion on the above problem of saving the results!
Has anyone encountered this issue?
Thanks for helping!
I see. This is fixed in the development versions of the package. I'm planning to submit an update to CRAN soon.
Thanks @mitchelloharawild ! Do I need to change anything in terms of my code mainly for saving the forercasted values?
The code above should work with the next version.
Perfect! Thank you @mitchelloharawild ! Please do let me know when you update the next version as I cannot save my results until then and cannot proceed further
So, waiting on you! Thanks again for your help!
The updated v0.2.0 distributional package is now on CRAN which should fix the file writing issue.
Thanks @mitchelloharawild ! But I still have the same problems even after updating all packages:
Error: Can't convert distribution> to character>. - (If I don't use mean to see the forecasted values)
Error: The result is not a valid tsibble. (If I use mean to see the values)
i Do you need as_tibble() to work with data frame?
Thanks again for your help!
Can you check what version of distributional you have?
packageVersion("distributional")
Could you try as.character(distributional::dist_normal(0,1))?
Yes, it works! It gives the mean values. and probably I can also get the intervals.
Thank you @mitchelloharawild !
system
Closed
August 15, 2020, 12:45am
34
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.