This function allows you to specify the method used to reconcile forecasts in accordance with its key structure.
reconcile(.data, ...) # S3 method for mdl_df reconcile(.data, ...)
.data | A mable. |
---|---|
... | Reconciliation methods applied to model columns within |
library(fable) lung_deaths_agg <- as_tsibble(cbind(mdeaths, fdeaths)) %>% aggregate_key(key, value = sum(value)) lung_deaths_agg %>% model(lm = TSLM(value ~ trend() + season())) %>% reconcile(lm = min_trace(lm)) %>% forecast() #> # A fable: 72 x 5 [1M] #> # Key: key, .model [3] #> key .model index value .mean #> <chr*> <chr> <mth> <dist> <dbl> #> 1 fdeaths lm 1980 Jan N(794, 5606) 794. #> 2 fdeaths lm 1980 Feb N(778, 5606) 778. #> 3 fdeaths lm 1980 Mar N(737, 5606) 737. #> 4 fdeaths lm 1980 Apr N(577, 5606) 577. #> 5 fdeaths lm 1980 May N(456, 5606) 456. #> 6 fdeaths lm 1980 Jun N(386, 5606) 386. #> 7 fdeaths lm 1980 Jul N(379, 5606) 379. #> 8 fdeaths lm 1980 Aug N(335, 5606) 335. #> 9 fdeaths lm 1980 Sep N(340, 5606) 340. #> 10 fdeaths lm 1980 Oct N(413, 5606) 413. #> # … with 62 more rows