Open ruqianchen opened 1 year ago
For reference, the intermediate step output is a tibble with no time column to use as index for the tsibble that forecast
requires.
> lung_deaths_agg %>%
+ model(lm = TSLM(value ~ trend() + season())) %>%
+ reconcile(lm = min_trace(lm))
# A tibble: 3 × 2
key lm
<chr> <model>
1 fdeaths <TSLM>
2 mdeaths <TSLM>
3 <aggregated> <TSLM>
I am unable to reproduce this issue, could you please check that your packages are up to date? If they are, please provide your session info with a reprex via reprex::reprex(si = TRUE)
.
library(fable)
#> Loading required package: fabletools
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()
#> Loading required namespace: crayon
#> # 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
Created on 2023-01-09 with reprex v2.0.2
The sample code here https://fabletools.tidyverts.org/reference/reconcile.html no longer works. When I ran it, I received the message " no applicable method for 'forecast'".
Details:
Thanks!