Uses a fitted model to augment the response variable with fitted values and
residuals. Response residuals (back-transformed) are stored in the .resid
column, while innovation residuals (transformed) are stored in the .innov
column.
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"))) %>%
augment()
#> # A tsibble: 218 x 6 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer .fitted .resid .innov
#> <chr> <qtr> <dbl> <dbl> <dbl> <dbl>
#> 1 ets 1956 Q1 284 267. 17.0 0.0111
#> 2 ets 1956 Q2 213 224. -10.6 -0.00899
#> 3 ets 1956 Q3 227 236. -9.02 -0.00713
#> 4 ets 1956 Q4 308 303. 4.62 0.00264
#> 5 ets 1957 Q1 262 272. -9.61 -0.00643
#> 6 ets 1957 Q2 228 218. 9.96 0.00830
#> 7 ets 1957 Q3 236 234. 2.34 0.00183
#> 8 ets 1957 Q4 320 306. 13.6 0.00761
#> 9 ets 1958 Q1 272 273. -1.49 -0.000974
#> 10 ets 1958 Q2 233 225. 7.90 0.00637
#> # ℹ 208 more rows