VAR and ARIMA and their forecast combination with respect to the same variable #125
nickcox896
started this conversation in
General
Replies: 2 comments
-
library(fpp3)
h <- 10
training <- us_change |> filter(year(Quarter) <= 2010)
var <- training |>
model(m1 = VAR(vars(Consumption, Income)))
arima <- training |>
model(m2 = ARIMA(Consumption))
fc <- forecast(arima, h = h) |>
left_join(
forecast(var, h = h) |>
as_tibble() |>
transmute(Quarter, VAR_fc = mean(.distribution)[, 1]),
by = "Quarter"
) |>
mutate(ave = (.mean + VAR_fc) / 2)
fc
#> # A fable: 10 x 6 [1Q]
#> # Key: .model [1]
#> .model Quarter Consumption .mean VAR_fc ave
#> <chr> <qtr> <dist> <dbl> <dbl> <dbl>
#> 1 m2 2011 Q1 N(0.79, 0.38) 0.791 0.813 0.802
#> 2 m2 2011 Q2 N(0.83, 0.4) 0.827 0.692 0.760
#> 3 m2 2011 Q3 N(0.63, 0.42) 0.631 0.683 0.657
#> 4 m2 2011 Q4 N(0.81, 0.46) 0.814 0.753 0.783
#> 5 m2 2012 Q1 N(0.78, 0.46) 0.780 0.742 0.761
#> 6 m2 2012 Q2 N(0.75, 0.46) 0.747 0.748 0.747
#> 7 m2 2012 Q3 N(0.74, 0.47) 0.745 0.778 0.762
#> 8 m2 2012 Q4 N(0.78, 0.47) 0.779 0.772 0.776
#> 9 m2 2013 Q1 N(0.77, 0.47) 0.767 0.764 0.766
#> 10 m2 2013 Q2 N(0.77, 0.47) 0.767 0.771 0.769Created on 2026-04-15 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thank you! To obtain all the foreast measures for the combination I tried It seems to be working but I am not sure if it is the correct approach. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Suppose we want to forecast the Consumption variable, using two models (VAR and ARIMA). So,
The goal is to take the simple average of forecasts from models m1 and m2 (forecast combination) with
respect to the common variable Consumption and compute the measures of accuracy for this combination.
Is that possible with the fable package, using something like
Beta Was this translation helpful? Give feedback.
All reactions