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

forecast with reconciliation does not work in time series with only one non-zero observation #309

Open
bahmanrostamitabar opened this issue Mar 30, 2021 · 1 comment
Assignees

Comments

@bahmanrostamitabar
Copy link

I am trying to run an experiment where I have time series that contains only one non-zero observation.

Th experiment runs for the following example where I have two non-zero observations:

library(fpp3)
tibble(
  y = c(3,rep(0,198),1),
  key = c(rep("A",100),rep("B",100)),
  t = c(seq(100),seq(100))
) %>%
  as_tsibble(key=key, index=t) %>%
  aggregate_key(key, y=sum(y)) %>%
  model(ets=ETS(y)) %>%
  reconcile(mint = min_trace(ets, method="mint_shrink")) %>% 
  forecast(h=7)

The following example contains a time series with only one non-zero observation, when I run the experiment I get an error:

library(fpp3)
tibble(
  y = c(3,rep(0,198),0),
  key = c(rep("A",100),rep("B",100)),
  t = c(seq(100),seq(100))
) %>%
  as_tsibble(key=key, index=t) %>%
  aggregate_key(key, y=sum(y)) %>%
  model(ets=ETS(y)) %>%
  reconcile(mint = min_trace(ets, method="mint_shrink")) %>% 
  forecast(h=7)
@mitchelloharawild mitchelloharawild self-assigned this Apr 6, 2021
@mitchelloharawild
Copy link
Member

The issue here is that the second ("B") ETS model is fitted to a dataset with 0 non-zero observations.
As a result, the residuals of this series are 0 and subsequently the MinT shrink weights for this series are invalid. In this case it is most appropriate to use alternative reconciliation weights such as "wls_struct".

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