6 Advanced modelling

6.1 Batch

https://github.com/tidyverts/fable/wiki/Tidy-forecasting-with-the-fable-package

Estimating multiple models is a key feature of fable. Most time series can be naturally disaggregated using a series of factors known as keys. These keys are used to uniquely identify separate time series, each of which can be modelled separately.

UKLungDeaths %>% 
  gather("sex", "deaths") %>% 
  model(ETS(deaths))
## # A mable: 2 x 2
## # Key:     sex [2]
##   sex     `ETS(deaths)`
##   <chr>   <model>      
## 1 mdeaths <ETS(M,A,A)> 
## 2 fdeaths <ETS(M,N,M)>

6.2 Decomposition

https://github.com/tidyverts/fable/wiki/Combining-models

Objects which support a components method can then have their components modelled separately. The working name for this functionality is model_components, however a shorter (single word) verb is preferred.

The user should be able to specify how each of the components are modelled, and the components method should define how each component is combined (and perhaps some default models that can be used).

library(feasts)
## 
## Attaching package: 'feasts'
## The following object is masked from 'package:grDevices':
## 
##     X11
md_decomp <- UKLungDeaths %>%
  STL(mdeaths ~ season(window = 12))
md_decomp
## # A dable:           72 x 6 [1M]
## # STL Decomposition: mdeaths = trend + season_year + remainder
##       index mdeaths trend season_year remainder seas_adjust
##       <mth>   <dbl> <dbl>       <dbl>     <dbl>       <dbl>
##  1 1974 Jan    2134 1510.        594.     30.0        1540.
##  2 1974 Feb    1863 1523.        581.   -241.         1282.
##  3 1974 Mar    1877 1536.        469.   -127.         1408.
##  4 1974 Apr    1877 1549.        163.    165.         1714.
##  5 1974 May    1492 1560.       -193.    124.         1685.
##  6 1974 Jun    1249 1571.       -317.     -5.09       1566.
##  7 1974 Jul    1280 1583.       -366.     63.4        1646.
##  8 1974 Aug    1131 1593.       -466.      3.69       1597.
##  9 1974 Sep    1209 1604.       -476.     81.0        1685.
## 10 1974 Oct    1492 1615.       -243.    120.         1735.
## # … with 62 more rows

md_decomp %>% 
  model_components(???)

6.4 Boosting