tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Possible Errors in Chapter 5.9 in the text (Evaluating distributional forecast accuracy) #340

Closed dkent287 closed 2 years ago

dkent287 commented 2 years ago

I am working through chapter 5.9 in the text (Evaluating distributional forecast accuracy) and I seem to be running into some errors.

I've reproduced the code for the example below.

I get the following error:

Error in accuracy(., google_stock, list(qs = quantile_score), probs = 0.1) : 
  unused arguments (list(qs = quantile_score), probs = 0.1)

Here is the code:

library(fable)
library(fabletools)
library(feasts)
library(tsibble)
library(dplyr)
library(lubridate)
library(fpp3)
library(ggplot2)
library(GGally)
library(latex2exp)
library(seasonal)
library(glue)
library(purrr)

# assemble trainng data
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)

# assemble trainng data
google_jan_2016 <- google_stock %>%
  filter(yearmonth(Date) == yearmonth("2016 Jan"))

# fit models
google_fit <- google_2015 %>%
  model(
    Mean = MEAN(Close),
    `Naïve` = NAIVE(Close),
    Drift = RW(Close ~ drift())
  )

# generate forecasts
google_fc <- google_fit %>%
  forecast(google_jan_2016)

# calculating accuracy scores
google_fc %>%
  filter(.model == "Naïve", Date == "2016-01-04") %>%
  accuracy(google_stock, list(qs=quantile_score), probs=0.10)
robjhyndman commented 2 years ago

I cannot reproduce the error using this code and the current dev version of fabletools.

You also don't need to load all those packages. The example works with just fpp3 loaded.

dkent287 commented 2 years ago

Hmmm - now working fine for me. Likely a silly mistake on my part - but not sure I can see it. Thank-you!