Box-Cox (Guerrero) giving different results for parameter

I'm getting different results for the Box-Cox parameter using two different methods. Why is this happening? (I'm trying to follow the Mathematical Adjustments subsection in FPP3.)


h02 <- PBS %>%
  filter(ATC2 == "H02") %>%
  summarise(Cost = sum(Cost)/1e6)

h02 %>%
  features(Cost, features = guerrero) %>%
#[1] 0.03146112

# -0.2283991

# -0.2283929

Referred here by Forecasting: Principles and Practice, by Rob J Hyndman and George Athanasopoulos

I get 0.03146112 for guerrero(h02$Cost, .period = 12), where .period is the length of the seasonal period.

The documentation for the guerrero() function also notes that the forecast::BoxCox.lambda() function will give a slightly different value if the data does not start at the start of the seasonal period, and the h02 data starts in July. After converting H02 from tsibble to ts format, the value from forecast::BoxCox.lambda() is 0.03147061.

1 Like

The Guerrero estimate of \lambda uses the seasonal period of the data. When you use

h02 %>%
  features(Cost, features = guerrero)

the time index is available, so the function can determine the seasonal period.

But when you use guerrero(h02$Cost) the time index is lost, so it assumes that the data is non-seasonal and gives a different estimate of \lambda.

As @EconProf has already noted, the forecast and feasts package give different results due to the timing of the start of the seasonal period.


Great, thanks so much for the help!

This topic was automatically closed 21 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.