Subject: Issue with accuracy() function from fpp3 package
Message:
Hello,
I'm encountering an issue with the accuracy() function from the fpp3 package. My forecast object is of class fbl_ts, but when I try to use accuracy(tslm_forecast, data), I get an error saying "No accuracy method found for an object of class fbl_ts." I have confirmed that my package version is up to date (version 0.5).
Can someone please help me troubleshoot this issue? Is there something I might be missing or any known workarounds for this problem?
Thank you for your assistance!
code:
library(fpp3)
recent_production <- aus_production |>
filter(year(Quarter) >= 1992)
beer_train <- recent_production |>
filter(year(Quarter) <= 2007)
beer_fit <- beer_train |>
model(
Mean = MEAN(Beer),
`Naïve` = NAIVE(Beer),
`Seasonal naïve` = SNAIVE(Beer),
Drift = RW(Beer ~ drift())
)
beer_fc <- beer_fit |>
forecast(h = 10)
beer_fc |>
autoplot(
aus_production |> filter(year(Quarter) >= 1992),
level = NULL
) +
labs(
y = "Megalitres",
title = "Forecasts for quarterly beer production"
) +
guides(colour = guide_legend(title = "Forecast"))
accuracy(beer_fc, recent_production)
accuracy(beer_fc, recent_production)
error message: Error in accuracy.default(beer_fc, recent_production) :
No accuracy method found for an object of class fbl_tsNo accuracy method found for an object of class tbl_tsNo accuracy method found for an object of class tbl_dfNo accuracy method found for an object of class tblNo accuracy method found for an object of class data.frame
Referred here by Forecasting: Principles and Practice, by Rob J Hyndman and George Athanasopoulos