I have a ts model fit that is a 'mable' with 2 models:
pacman::p_load(tidyverse, fable, fpp3, feasts)
# aus exports:
## Extract data of interest
oz_exports <- global_economy %>%
filter(Country =='Australia') %>%
select(Exports)
## take a look
oz_exports %>% autoplot(Exports)
## looks like upwards trend with some potential seasonality - try Snaive with drift()
## Define and estimate a model
fit <- oz_exports %>%
model(NAIVE(Exports),
RWDrift = RW(Exports ~ drift()))
I wanted to look at the residuals with gg_tsresiduals
:
fit %>% gg_tsresiduals
Error: gg_tsresiduals() must be used with a mable containing only one model.
OK. I tried subsetting fit to get just one model to pass to gg_tsresiduals()
at a time.
Here's what fit looks like:
fit
# A mable: 1 x 2
`NAIVE(Exports)` RWDrift
<model> <model>
1 <NAIVE> <RW w/ drift>
A 1*2 mable.
Tried:
fit$`NAIVE(Exports)`
<lst_mdl[1]>
[1] <NAIVE>
fit$`NAIVE(Exports)` %>% gg_tsresiduals()
Error: gg_tsresiduals() must be used with a mable containing only one model.
Not a mable, it's a list. I need a 1*1 mable to pass to gg_tsresiduals function.
Then tried
fit[1]
# A tibble: 1 × 1
`NAIVE(Exports)`
<model>
1 <NAIVE>
> fit[1] %>% gg_tsresiduals()
Error: gg_tsresiduals() must be used with a mable containing only one model.
How can I pass a single model within a fit that contains multiple models to gg_tsresiduals()?