fable vs forecast different Box Cox lambda's

Hi

Why are there different lambda values between fable and forecast for the 'same' data-set?

 library(fpp3)

 aus_production %>%
 	features(Gas, features = guerrero) %>%
  	pull(lambda_guerrero)	
#[1] 0.1205077
 
 Gas <- aus_production[, "Gas"]  
 
 
 library(fpp2)
 
 gas <- ts(Gas, start = c(1956,1), end = c(2010,2), frequency = 4)  

 BoxCox.lambda(gas, method = "guerrero") 
#[1] 0.1095382

Amarjit

I did some investigation and found that feasts::guerrero() produces subseries from all the data (even if the last subseries is incomplete) but forecast::BoxCox.lambda() removes the first few observations so that all subseries have the same length.

I checked the paper and have updated feasts to better match the described method: Updated `guerrero()` method to maintain a consistent subseries length · tidyverts/feasts@45cbe41 · GitHub

There is still a very slight difference in the results since feasts uses a lower limit of -0.9, and forecast uses -1. You can change the bounds of possible values for lambda using the lower and upper arguments.

library(fpp3)
aus_production %>%
  features(Gas, features = guerrero, .period = 4, lower = -1) %>%
  pull(lambda_guerrero)
#> [1] 0.1095382

Gas <- aus_production$Gas

library(fpp2)

gas <- ts(Gas, start = c(1956,1), end = c(2010,2), frequency = 4)  

BoxCox.lambda(gas, method = "guerrero") 
#> [1] 0.1095382

Created on 2022-08-24 by the reprex package (v2.0.1)

1 Like

Thanks Mitchell.

I have tried on elec in fpp2 3.2 Transformations and adjustments | Forecasting: Principles and Practice (2nd ed)
and get the same in fpp3.

[1] 0.2654076

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.