tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Bug in bottom_up() #266

Closed GeorgeAthana closed 4 years ago

GeorgeAthana commented 4 years ago

tourism_full <- tsibble::tourism %>% aggregate_key((State/Region)*Purpose, Trips = sum(Trips)) tourism_fit_ets <- tourism_full %>% filter(year(Quarter)<=2015) %>% model( ets=ETS(Trips), ) %>% reconcile( bu_ets = bottom_up(ets), wls_ols = min_trace(ets, method="ols") )

tourism_fc_ets <- tourism_fit_ets %>% forecast(h="2 years")

tourism_fc_ets %>%
filter(is_aggregated(State),is_aggregated(Region),!is_aggregated(Purpose)) %>% autoplot(tourism_full, level=NULL) + facet_wrap(vars(Purpose), scales = "free_y")

tourism_fc_ets %>%
filter(!is_aggregated(State),is_aggregated(Region),is_aggregated(Purpose)) %>% autoplot(tourism_full, level=NULL) + facet_wrap(vars(State), scales = "free_y")

mitchelloharawild commented 4 years ago

Issue is rooted in redundant nodes, fixed in 251fcc22e9ad76fee0a0f62def2835f0d3ff62bc