ARIMA vs STL+ARIMA

I am not sure when to use STL+ARIMA and when to use ARIMA only. Some guidance would be really helpful. Thanks in advance!

suppressWarnings(suppressMessages(library(fpp3)))
#                                       DATA
v1 <- c(27, 30.5, 37, 35, 28, 32, 30.5, 39, 22.5, 35.5, 36, 33, 35, 
        32.5, 29, 45, 34.5, 28, 35, 35, 35.5, 39, 36.5, 34.5, 37, 35.5, 
        33.5, 35, 36, 37, 35, 28.5, 27.5, 30, 42, 38.5, 33, 34, 43, 33, 
        34, 41, 36, 42, 42, 39, 45, 44, 34.5, 39, 50, 39, 44, 34, 47.5, 
        49, 40, 34.5, 36, 33.5, 34, 44, 28, 37, 41.5, 42, 30.5, 44.5, 
        32, 33, 36, 38, 31.5, 35, 33.5, 37, 37.5, 36, 36, 50.5, 49.5, 
        35, 40, 39, 43, 36, 37, 48.5, 37, 51, 50, 41, 35.5, 40, 35, 48, 
        35, 33.5, 43, 38, 47, 39, 53, 34, 33, 36, 40, 43, 30, 39.5, 48, 
        42, 49, 38, 42, 38, 35, 35, 69, 51.5)

# tsibble
tibble(
  year = rep(2008:2017, each = 12),
  m = month(rep(1:12, times = 10), label = TRUE),
  toy_variable = v1,
  month = yearmonth(paste(year, m)),
  index = month
)%>% 
  select(month, toy_variable) %>% 
  as_tsibble(index = month) -> toy_data
################
# AUTO ARIMA
##############
arima_only <- toy_data %>%
  model(ARIMA(toy_variable)) 
arima_only
#> # A mable: 1 x 1
#>   `ARIMA(toy_variable)`
#>                 <model>
#> 1        <ARIMA(0,1,1)>

arima_only %>% 
  forecast() %>% 
  autoplot()


#######################
# STL + AUTO ARIMA
#####################
stl_arima <- toy_data %>%
  model(stlf = decomposition_model(
    STL(toy_variable ~ trend(window = 13), robust = TRUE),
    ARIMA(season_adjust)))
stl_arima
#> # A mable: 1 x 1
#>                        stlf
#>                     <model>
#> 1 <STL decomposition model>
stl_arima %>% 
  forecast() %>%
  autoplot()

Created on 2020-09-27 by the reprex package (v0.3.0)

Arima, unless instructed otherwise, ends up providing a naïve forecast—the straight blue line.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Generally, when there's an important seasonal component to take into account. See \S 9.3 in fpp3

1 Like

Sorry for the late response. Under what circumstances should I opt for STL + ARIMA ?