Estimates a VARIMA model of a given order.
VARIMA(formula, identification = c("kronecker_indices", "none"), ...)
# S3 method for class 'VARIMA'
forecast(
object,
new_data = NULL,
specials = NULL,
bootstrap = FALSE,
times = 5000,
...
)
# S3 method for class 'VARIMA'
fitted(object, ...)
# S3 method for class 'VARIMA'
residuals(object, ...)
# S3 method for class 'VARIMA'
tidy(x, ...)
# S3 method for class 'VARIMA'
glance(x, ...)
# S3 method for class 'VARIMA'
report(object, ...)
# S3 method for class 'VARIMA'
generate(x, new_data, specials, ...)
# S3 method for class 'VARIMA'
IRF(x, new_data, specials, impulse = NULL, orthogonal = FALSE, ...)
Model specification (see "Specials" section).
The identification technique used to estimate the model.
Further arguments for arima
A model for which forecasts are required.
A tsibble containing the time points and exogenous regressors to produce forecasts for.
(passed by fabletools::forecast.mdl_df()
).
If TRUE
, then forecast distributions are computed using simulation with resampled errors.
The number of sample paths to use in estimating the forecast distribution when bootstrap = TRUE
.
A fitted model.
A character string specifying the name of the variable that is shocked (the impulse variable).
If TRUE, orthogonalised impulse responses will be computed.
A model specification.
A one row tibble summarising the model's fit.
Exogenous regressors and common_xregs
can be specified in the model
formula.
The pdq
special is used to specify non-seasonal components of the model.
pdq(p = 0:5, d = 0:2, q = 0:5)
p | The order of the non-seasonal auto-regressive (AR) terms. If multiple values are provided, the one which minimises ic will be chosen. |
d | The order of integration for non-seasonal differencing. If multiple values are provided, one of the values will be selected via repeated KPSS tests. |
q | The order of the non-seasonal moving average (MA) terms. If multiple values are provided, the one which minimises ic will be chosen. |
Exogenous regressors can be included in an VARIMA model without explicitly using the xreg()
special. Common exogenous regressor specials as specified in common_xregs
can also be used. These regressors are handled using stats::model.frame()
, and so interactions and other functionality behaves similarly to stats::lm()
.
The inclusion of a constant in the model follows the similar rules to stats::lm()
, where including 1
will add a constant and 0
or -1
will remove the constant. If left out, the inclusion of a constant will be determined by minimising ic
.
xreg(...)
... | Bare expressions for the exogenous regressors (such as log(x) ) |
library(tsibbledata)
aus_production %>%
autoplot(vars(Beer, Cement))
fit <- aus_production %>%
model(VARIMA(vars(Beer, Cement) ~ pdq(4,1,1), identification = "none"))
#> Warning: NaNs produced
fit
#> # A mable: 1 x 1
#> `VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identification = "none")`
#> <model>
#> 1 <VARIMA(4,1,1) w/ mean>
fit %>%
forecast(h = 50) %>%
autoplot(tail(aus_production, 100))
fitted(fit)
#> # A tsibble: 218 x 4 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer Cement
#> <chr> <qtr> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q1 NA NA
#> 2 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q2 NA NA
#> 3 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q3 NA NA
#> 4 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q4 NA NA
#> 5 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q1 NA NA
#> 6 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q2 219. 586.
#> 7 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q3 229. 637.
#> 8 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q4 302. 649.
#> 9 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1958 Q1 246. 561.
#> 10 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1958 Q2 205. 629.
#> # ℹ 208 more rows
residuals(fit)
#> # A tsibble: 218 x 4 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer Cement
#> <chr> <qtr> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q1 NA NA
#> 2 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q2 NA NA
#> 3 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q3 NA NA
#> 4 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1956 Q4 NA NA
#> 5 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q1 NA NA
#> 6 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q2 9.42 17.6
#> 7 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q3 -2.72 -51.3
#> 8 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1957 Q4 11.6 -33.3
#> 9 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1958 Q1 7.42 60.3
#> 10 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identificati… 1958 Q2 1.85 -1.86
#> # ℹ 208 more rows
tidy(fit)
#> # A tibble: 22 × 4
#> .model term .response estimate
#> <chr> <chr> <chr> <dbl>
#> 1 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… cons… Beer 1.42
#> 2 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer -0.688
#> 3 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer -0.695
#> 4 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer 0.0678
#> 5 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer 0.0105
#> 6 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer -0.695
#> 7 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer -0.585
#> 8 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer 0.0105
#> 9 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer 0.0228
#> 10 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… lag(… Beer 0.228
#> # ℹ 12 more rows
glance(fit)
#> # A tibble: 1 × 5
#> .model sigma2 kronecker_indices AIC BIC
#> <chr> <list> <list> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1,… <dbl[…]> <NULL> 14.9 15.3
report(fit)
#> Series: Beer, Cement
#> Model: VARIMA(4,1,1) w/ mean
#>
#> Coefficients for Beer:
#> constant lag(Beer,1) lag(Beer,2) lag(Beer,3) lag(Beer,4)
#> Est. 1.4186 -0.6881 -0.6952 0.0678 0.0105
#> lag(Cement,1) lag(Cement,2) lag(Cement,3) lag(Cement,4) lag(e_Beer,1)
#> Est. -0.6952 -0.5852 0.0105 0.0228 0.2283
#> lag(e_Cement,1)
#> Est. 0.0303
#>
#> Coefficients for Cement:
#> constant lag(Beer,1) lag(Beer,2) lag(Beer,3) lag(Beer,4)
#> Est. 12.6111 -2.2695 -1.4415 -0.0744 0.0142
#> lag(Cement,1) lag(Cement,2) lag(Cement,3) lag(Cement,4) lag(e_Beer,1)
#> Est. -1.4415 -1.2072 0.0142 0.3621 -1.4886
#> lag(e_Cement,1)
#> Est. 0.0916
#>
#> Residual covariance matrix:
#> Beer Cement
#> Beer 318.8404 102.5564
#> Cement 102.5564 7693.1460
#>
#> AIC = 14.91 BIC = 15.25
generate(fit, h = 10)
#> # A tsibble: 10 x 6 [1Q]
#> # Key: .model, .rep [1]
#> .model .rep Quarter .innov[,"Beer"] Beer Cement
#> <chr> <chr> <qtr> <dbl> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2010 Q3 -24.2 389. 2527.
#> 2 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2010 Q4 -0.0200 502. 2433.
#> 3 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2011 Q1 8.00 432. 2193.
#> 4 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2011 Q2 -15.3 365. 2443.
#> 5 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2011 Q3 -22.0 376. 2469.
#> 6 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2011 Q4 25.2 530. 2358.
#> 7 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2012 Q1 4.70 436. 2106.
#> 8 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2012 Q2 -9.36 353. 2469.
#> 9 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2012 Q3 1.28 385. 2389.
#> 10 "VARIMA(vars(Beer, Cement) ~ pdq(… 1 2012 Q4 -0.390 532. 2347.
#> # ℹ 1 more variable: .innov[2] <dbl>
IRF(fit, h = 10, impulse = "Beer")
#> # A tsibble: 10 x 4 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer Cement
#> <chr> <qtr> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2010 Q3 1 0
#> 2 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2010 Q4 0.0836 -0.781
#> 3 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2011 Q1 -0.00975 0.0600
#> 4 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2011 Q2 0.0844 0.225
#> 5 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2011 Q3 0.909 0.0902
#> 6 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2011 Q4 0.114 -1.09
#> 7 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2012 Q1 -0.0210 0.130
#> 8 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2012 Q2 0.131 0.317
#> 9 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2012 Q3 0.853 0.0579
#> 10 "VARIMA(vars(Beer, Cement) ~ pdq(4, 1, 1), identifi… 2012 Q4 0.133 -1.16