I am comparing the results of the automatic lambda selection function BoxCox.lambda
from the forecast
package VS the fable
package automatic lambda selection features
As you can see below, the two functions did not return the same results. Moreover, when I apply the BoxCox.lamda
on a the same data, but once on a ts object and once on vector, the results are different.
Some body can explain me why it behaves like this ?
library(tidyverse)
library(tsibble)
library(lubridate)
library(fable)
library(tsibbledata)
library(forecast)
vic_cafe <- tsibbledata::aus_retail %>%
filter(
State == "Victoria",
Industry == "Cafes, restaurants and catering services"
) %>%
select(Month, Turnover)
lambda_fable <- vic_cafe %>% features(Turnover, guerrero) %>% pull(lambda_guerrero)
lambda_fable
#> [1] 0.1240828
lambda_forecast <- BoxCox.lambda(vic_cafe$Turnover, method = "guerrero")
lambda_forecast
#> [1] 0.02686482
lambda_forecast_ts <- BoxCox.lambda(as.ts(vic_cafe), method = "guerrero")
lambda_forecast_ts
#> [1] 0.1734189
The feasts::guerrero()
function from uses all of the data available, whereas forecast::BoxCox.lambda()
ignores data that doesn't fit exactly within the year.
Your vic_cafe
dataset starts in April, and so the feasts package will group seasons as April-March, but forecast will use January-December and remove the first part of the data.
Some more discussion can be found here, and I've added a mention of these differences in the documentation: https://github.com/tidyverts/feasts/commit/830fe4095cf6231e7bb179519cddfeadd9cd7531