% grou" /> % grou" /> % grou"/>

What is the reason for the error reported for the ETS and ARIMA accuracy checks?

535 Views Asked by At

The code is as follows.

library(fable)
library(tsibble)
library(dplyr)

tourism_melb <- tourism %>%
  filter(Region == "Melbourne")
tourism_melb %>%
  group_by(Purpose) %>%
  slice(1)

tourism_melb %>%
  autoplot(Trips)

fit <- tourism_melb %>%
  model(
    ets = ETS(Trips ~ trend("A")),
    arima = ARIMA(Trips)
  )

fit %>%
  accuracy() %>%
  arrange(MASE)

Error in accuracy.default(.) : No accuracy method found for an object of class mdl_dfNo 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

What is the reason for the error in the last step?

1

There are 1 best solutions below

7
Eva On

This might be some configuration issue at your computer. I get some output instead of errors when I run your code.I am pasting the output from my console below, when I run your code.

> library(fable)
Loading required package: fabletools
> library(tsibble)

Attaching package: ‘tsibble’

The following objects are masked from ‘package:base’:

    intersect, setdiff, union

> library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> 
> tourism_melb <- tourism %>%
+   filter(Region == "Melbourne")
> tourism_melb %>%
+   group_by(Purpose) %>%
+   slice(1)
# A tsibble: 4 x 5 [1Q]
# Key:       Region, State, Purpose [4]
# Groups:    Purpose [4]
  Quarter Region    State    Purpose  Trips
    <qtr> <chr>     <chr>    <chr>    <dbl>
1 1998 Q1 Melbourne Victoria Business 405. 
2 1998 Q1 Melbourne Victoria Holiday  428. 
3 1998 Q1 Melbourne Victoria Other     79.9
4 1998 Q1 Melbourne Victoria Visiting 666. 
> 
> tourism_melb %>%
+   autoplot(Trips)
> 
> fit <- tourism_melb %>%
+   model(
+     ets = ETS(Trips ~ trend("A")),
+     arima = ARIMA(Trips)
+   )
> 
> fit %>%
+   accuracy() %>%
+   arrange(MASE)
# A tibble: 8 × 13
  Region    State  Purpose .model .type     ME  RMSE   MAE
  <chr>     <chr>  <chr>   <chr>  <chr>  <dbl> <dbl> <dbl>
1 Melbourne Victo… Holiday ets    Trai…  4.67   50.5  37.2
2 Melbourne Victo… Busine… ets    Trai…  3.31   56.4  42.9
3 Melbourne Victo… Busine… arima  Trai…  2.54   58.2  46.0
4 Melbourne Victo… Holiday arima  Trai… -4.64   54.3  41.4
5 Melbourne Victo… Other   arima  Trai… -0.344  21.7  17.0
6 Melbourne Victo… Other   ets    Trai… -0.142  21.7  17.0
7 Melbourne Victo… Visiti… ets    Trai…  8.17   60.9  51.4
8 Melbourne Victo… Visiti… arima  Trai…  6.89   63.1  51.7
# … with 5 more variables: MPE <dbl>, MAPE <dbl>,
#   MASE <dbl>, RMSSE <dbl>, ACF1 <dbl>
# ℹ Use `colnames()` to see all variable names