Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETS trend from components() is different to that calculated using the trend formula - if alpha and beta parameters are both set to 0.5 #403

Open
PhilBla opened this issue Nov 4, 2023 · 3 comments

Comments

@PhilBla
Copy link

PhilBla commented Nov 4, 2023

Not absolutely sure this is a bug but can't figure out why the Holt linear trend equations produces different slope values to those given by the components() view of an ETS model. I have posted a reproducible example on Cross Validated

https://stats.stackexchange.com/questions/630437/i-cannot-replicate-the-slope-for-an-ets-model-with-alpha-0-5-and-beta-0-5-usi

I am not skilled enough to look through the code, but hope that you can confirm that it should be possible to replicate the level and trend using the Holt equations.

Philip

@robjhyndman
Copy link
Member

The equation in your post uses beta*. The function uses beta. See https://otexts.com/fpp3/ets.html#etsaan-holts-linear-method-with-additive-errors for the connection

@PhilBla
Copy link
Author

PhilBla commented Nov 5, 2023

Thanks very much Rob for taking the time to respond to my question. It is a steep learning curve, and I hope you have the patience to answer one more. Having spent time rewatching and rereading chapter 8.5 and some more time reevaluating the formulas, I remain unable to calculate the first estimated slope value using the components function values and β=αβ*

Q. So if the ETS model is specified with parameters: trend(method = "A", alpha = 0.5, beta = 0.5))
is α = alpha and β* = beta ? or is β = beta ?

... to calculate the new estimated slope the equation is: bt = bt−1 + βεt - where β=αβ*
which (if β* = beta) becomes bt-1 + (0.5*0.5) * εt

If I use 0.5*0.5 I can't get the same answer as the components function. If I just use 0.5 it works. So my conclusion is β (without the *) must be equivalent to the trend parameter beta.

Code
library(fpp3)
aus_economy <- global_economy |> filter(Code == "AUS") |> mutate(Pop = Population / 1e6)

fit <- aus_economy |>
model(AAN = ETS(Pop ~ error("A") + trend(method = "A", alpha = 0.5, beta = 0.5) + season("N")))
report(fit)

options(pillar.sigfig = 10)
summary <- components(fit) |> left_join(fitted(fit), by = c("Country", ".model", "Year"))
summary

CalculatedSlope <- summary$slope[1] + (0.5 * summary$remainder[2])
CalculatedSlope - summary$slope[2] # CalculatedSlope is correct - so β must be = beta

CalculatedSlope <- summary$slope[1] + ((0.5 *0.5) * summary$remainder[2])
CalculatedSlope - summary$slope[2] # CalculatedSlope is different

@robjhyndman
Copy link
Member

The package always uses beta (not beta*).

The first estimate of slope (at time 0) is optimized. You can't compute it from the other components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants