Allows you to extract elements of interest from the model which can be useful in understanding how they contribute towards the overall fitted values.

# S3 method for class 'mdl_df'
components(object, ...)

# S3 method for class 'mdl_ts'
components(object, ...)

Arguments

object

A mable.

...

Other arguments passed to methods.

Details

A dable will be returned, which will allow you to easily plot the components and see the way in which components are combined to give forecasts.

The components can also be visualised using the autoplot() method provided by the ggtime package.

Examples

library(fable)
library(tsibbledata)

# Forecasting with an ETS(M,Ad,A) model to Australian beer production
aus_production %>%
  model(ets = ETS(log(Beer) ~ error("M") + trend("Ad") + season("A"))) %>% 
  components()
#> # A dable: 222 x 7 [1Q]
#> # Key:     .model [1]
#> # :        log(Beer) = (lag(level, 1) + 0.941163396605833 * lag(slope, 1) +
#> #   lag(season, 4)) * (1 + remainder)
#>    .model Quarter `log(Beer)` level     slope  season remainder
#>    <chr>    <qtr>       <dbl> <dbl>     <dbl>   <dbl>     <dbl>
#>  1 ets    1955 Q1       NA    NA    NA         0.0492  NA      
#>  2 ets    1955 Q2       NA    NA    NA        -0.142   NA      
#>  3 ets    1955 Q3       NA    NA    NA        -0.0823  NA      
#>  4 ets    1955 Q4       NA     5.54  0.00159   0.175   NA      
#>  5 ets    1956 Q1        5.65  5.55  0.00477   0.0615   0.0111 
#>  6 ets    1956 Q2        5.36  5.54  0.00191  -0.151   -0.00899
#>  7 ets    1956 Q3        5.42  5.54 -0.000262 -0.0900  -0.00713
#>  8 ets    1956 Q4        5.73  5.54  0.000554  0.178    0.00264
#>  9 ets    1957 Q1        5.57  5.54 -0.00139   0.0543  -0.00643
#> 10 ets    1957 Q2        5.43  5.54  0.00106  -0.143    0.00830
#> # ℹ 212 more rows