fabletools icon indicating copy to clipboard operation
fabletools copied to clipboard

add reconciliation with immutable forecasts

Open AngelPone opened this issue 3 years ago • 1 comments

see https://github.com/tidyverts/fabletools/issues/352. I implemented the immutability method only for sparse=TRUE for now.

examples:

tourism_full <- tsibble::tourism %>%
  aggregate_key((State/Region) * Purpose, Trips = sum(Trips))
fit <- tourism_full %>%
  filter(year(Quarter) <= 2015) %>%
  model(base = fable::ARIMA(Trips))
fit <- reconcile(
  fit,
  ols_td = min_trace(base, method = "ols", 
                    immu = is_aggregated(State) & is_aggregated(Purpose)),
  ols_purpose_mo = min_trace(base, method = "ols", 
                             immu = is_aggregated(State) & !is_aggregated(Purpose)),
  ols_state_mo = min_trace(base, method = "ols", 
                           immu = !is_aggregated(State) & is_aggregated(Purpose) & is_aggregated(Region))
)

AngelPone avatar Apr 25 '22 03:04 AngelPone

Looks great and simple, thanks! I'll use this code and rework it into a more general nicer interface for reconciliation. Could you add yourself as ctb for this package, and provide a NEWS entry that summarises this change?

mitchelloharawild avatar Apr 25 '22 07:04 mitchelloharawild