Skip to content

accuracy by horizon #341

@robjhyndman

Description

@robjhyndman

MRE:

library(fpp3)
#> ── Attaching packages ──────────────────────────────────────────── fpp3 0.4.0 ──
#> ✓ tibble      3.1.6          ✓ tsibble     1.1.1     
#> ✓ dplyr       1.0.7          ✓ tsibbledata 0.4.0.9000
#> ✓ tidyr       1.1.4          ✓ feasts      0.2.2     
#> ✓ lubridate   1.8.0          ✓ fable       0.3.1     
#> ✓ ggplot2     3.3.5
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> x lubridate::date()    masks base::date()
#> x dplyr::filter()      masks stats::filter()
#> x tsibble::intersect() masks base::intersect()
#> x tsibble::interval()  masks lubridate::interval()
#> x dplyr::lag()         masks stats::lag()
#> x tsibble::setdiff()   masks base::setdiff()
#> x tsibble::union()     masks base::union()

fit <- aus_arrivals %>%
  filter(year(Quarter) <= 2009) %>% 
  model(ets = ETS(Arrivals))
fc <- fit %>% 
  forecast(h = 11) %>%
  group_by(Origin, .model) %>%
  mutate(h = row_number()) %>%
  ungroup()
fc %>% 
  accuracy(aus_arrivals, by=c(".model","h"))
#> Error: The result is not a valid tsibble.
#> ℹ Do you need `as_tibble()` to work with data frame?

Created on 2022-01-12 by the reprex package (v2.0.1)

Not a problem if there is no key in the fable other than .model.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions