tidyverts / feasts

Feature Extraction And Statistics for Time Series
https://feasts.tidyverts.org/
291 stars 23 forks source link

Differences between feasts and forecast on guerrero lambda calculation #114

Closed robjhyndman closed 4 years ago

robjhyndman commented 4 years ago

See https://stackoverflow.com/q/63346756/144157

library(tidyverse)
library(tsibble)
library(feasts)
#> Loading required package: fabletools
#> Registered S3 methods overwritten by 'fabletools':
#>   method      from 
#>   glance.NULL broom
#>   tidy.NULL   broom

vic_cafe <- tsibbledata::aus_retail %>%
  filter(
    State == "Victoria",
    Industry == "Cafes, restaurants and catering services"
  ) %>%
  select(Month, Turnover)

vic_cafe %>% features(Turnover, guerrero) %>% pull(lambda_guerrero)
#> [1] 0.1240828

forecast::BoxCox.lambda(as.ts(vic_cafe), method = "guerrero")
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
#> [1] 0.1734189

Created on 2020-08-11 by the reprex package (v0.3.0)

mitchelloharawild commented 4 years ago

The difference is that forecast trims the data to start with the beginning of the year, but feasts does not. {forecast} will always take Jan-Dec as the seasonal groups, but {feasts} will use Apr-Mar as the season when the data starts in April.

{feasts} also doesn't remove the start/end of the series if they don't exactly fit in the seasonal period (for example, partial years).

Should this behaviour be changed? My understanding is that the method isn't specific to starting at standard seasonal origins (although results will slightly differ).

robjhyndman commented 4 years ago

Ah, ok. {feasts} is the preferable approach.