I'm using example data from the Forecasting: Principles and Practice textbook chapter on VAR models here to make forecast plots using the fable
package.
I'd like to be able to select a single plot from those returned by autoplot
. For example, in the code below, how can I select and display the plot for Income
only? I'd also like to be able to access the forecast point values and upper and lower bounds for the model with Income
as the response variable.
When I try to see the results of the forecast()
call, I get an "ERROR while rich displaying an object" so I can't see how to subset this object. This could be because I'm running this analysis on Deepnote (like a Jupyter notebook), I'm unsure. But perhaps filtering or selecting or subsetting in some way before or after calling forecast()
will get me the data and plot I'm looking for.
library(fpp3)
fit <- us_change %>%
model(
aicc = VAR(vars(Consumption, Income)),
bic = VAR(vars(Consumption, Income), ic = "bic")
)
fit %>%
select(aicc) %>%
forecast() %>%
autoplot(us_change %>% filter(year(Quarter) > 2010))