-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add support for reconciling disjoint hierarchies #106
Comments
From an email I sent related to this issue:
|
An update. It is now possible to create these disjoint sets using aggregate_key. library(fable)
#> Loading required package: fabletools
library(tsibble)
lung_deaths_long <- as_tsibble(cbind(mdeaths, fdeaths))
lung_deaths_long %>%
aggregate_key(key, value = sum(value)) %>%
stretch_tsibble(.init = 71)
#> # A tsibble: 429 x 4 [1M]
#> # Key: .id, key [6]
#> key index value .id
#> <chr> <mth> <dbl> <int>
#> 1 fdeaths 1974 Jan 901 1
#> 2 fdeaths 1974 Feb 689 1
#> 3 fdeaths 1974 Mar 827 1
#> 4 fdeaths 1974 Apr 677 1
#> 5 fdeaths 1974 May 522 1
#> 6 fdeaths 1974 Jun 406 1
#> 7 fdeaths 1974 Jul 441 1
#> 8 fdeaths 1974 Aug 393 1
#> 9 fdeaths 1974 Sep 387 1
#> 10 fdeaths 1974 Oct 582 1
#> # … with 419 more rows
lung_deaths_long %>%
stretch_tsibble(.init = 71) %>%
aggregate_key(0 + .id/key, value = sum(value))
#> # A tsibble: 429 x 4 [1M]
#> # Key: .id, key [6]
#> .id key index value
#> <int> <chr> <mth> <dbl>
#> 1 1 <aggregated> 1974 Jan 3035
#> 2 2 <aggregated> 1974 Jan 3035
#> 3 1 <aggregated> 1974 Feb 2552
#> 4 2 <aggregated> 1974 Feb 2552
#> 5 1 <aggregated> 1974 Mar 2704
#> 6 2 <aggregated> 1974 Mar 2704
#> 7 1 <aggregated> 1974 Apr 2554
#> 8 2 <aggregated> 1974 Apr 2554
#> 9 1 <aggregated> 1974 May 2014
#> 10 2 <aggregated> 1974 May 2014
#> # … with 419 more rows
lung_deaths_long %>%
aggregate_key(key, value = sum(value)) %>%
stretch_tsibble(.init = 71) %>%
model(mdl = ETS(value)) %>%
reconcile(mdl = min_trace(mdl)) %>%
forecast()
#> Warning: Reconciliation in fable is highly experimental. The interface will
#> likely be refined in the near future.
#> Loading required namespace: SparseM
#> Reconciliation of disjoint hierarchical structures is not yet supported. Created on 2019-08-13 by the reprex package (v0.3.0) |
This seems to be unstable for some reason (non-positive-definite covariance), perhaps the
.id
is being used in reconciliation in some way.The text was updated successfully, but these errors were encountered: