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, Tobacco, Bricks))
#> Warning: Removed 20 rows containing missing values or values outside the scale range
#> (`geom_line()`).
fit <- aus_production[complete.cases(aus_production),] %>%
model(VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4,1,1), identification = "none"))
#> Warning: NaNs produced
fit
#> # A mable: 1 x 1
#> `VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), identification = "none")`
#> <model>
#> 1 <VARIMA(4,1,1) w/ mean>
fit %>%
forecast(h = 50) %>%
autoplot(tail(aus_production, 100))
#> Warning: Removed 20 rows containing missing values or values outside the scale range
#> (`geom_line()`).
fitted(fit)
#> # A tsibble: 194 x 5 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer Bricks Cement
#> <chr> <qtr> <dbl> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1956 Q1 NA NA NA
#> 2 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1956 Q2 NA NA NA
#> 3 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1956 Q3 NA NA NA
#> 4 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1956 Q4 NA NA NA
#> 5 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1957 Q1 NA NA NA
#> 6 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1957 Q2 231. 211. 582.
#> 7 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1957 Q3 257. 235. 615.
#> 8 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1957 Q4 323. 220. 624.
#> 9 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1958 Q1 262. 186. 572.
#> 10 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1… 1958 Q2 229. 215. 646.
#> # ℹ 184 more rows
residuals(fit)
#> # A tsibble: 194 x 5 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer Bricks Cement
#> <chr> <qtr> <dbl> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1956 Q1 NA NA NA
#> 2 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1956 Q2 NA NA NA
#> 3 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1956 Q3 NA NA NA
#> 4 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1956 Q4 NA NA NA
#> 5 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1957 Q1 NA NA NA
#> 6 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1957 Q2 -3.00 2.74 21.8
#> 7 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1957 Q3 -17.9 -10.4 -34.2
#> 8 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1957 Q4 18.0 10.1 -30.1
#> 9 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1958 Q1 12.8 10.2 24.0
#> 10 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, … 1958 Q2 -5.77 1.40 -7.26
#> # ℹ 184 more rows
tidy(fit)
#> # A tibble: 48 × 4
#> .model term .response estimate
#> <chr> <chr> <chr> <dbl>
#> 1 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … cons… Beer 2.55
#> 2 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer -1.02
#> 3 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.0757
#> 4 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.185
#> 5 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.185
#> 6 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.0757
#> 7 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.185
#> 8 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.185
#> 9 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer -0.516
#> 10 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, 1, 1), … lag(… Beer 0.185
#> # ℹ 38 more rows
glance(fit)
#> # A tibble: 1 × 5
#> .model sigma2 kronecker_indices AIC BIC
#> <chr> <list> <list> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Bricks, Cement) ~ p… <dbl[…]> <NULL> 20.4 21.2
report(fit)
#> Series: Beer, Bricks, 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. 2.5463 -1.0182 0.0757 0.1846 0.1846
#> lag(Bricks,1) lag(Bricks,2) lag(Bricks,3) lag(Bricks,4) lag(Cement,1)
#> Est. 0.0757 0.1846 0.1846 -0.5161 0.1846
#> lag(Cement,2) lag(Cement,3) lag(Cement,4) lag(e_Beer,1)
#> Est. 0.1846 -0.5161 0.0665 -0.0318
#> lag(e_Bricks,1) lag(e_Cement,1)
#> Est. -0.8122 0.0767
#>
#> Coefficients for Bricks:
#> constant lag(Beer,1) lag(Beer,2) lag(Beer,3) lag(Beer,4)
#> Est. 0.8533 -0.1126 -0.118 0.1031 0.1031
#> lag(Bricks,1) lag(Bricks,2) lag(Bricks,3) lag(Bricks,4) lag(Cement,1)
#> Est. -0.118 0.1031 0.1031 0.3723 0.1031
#> lag(Cement,2) lag(Cement,3) lag(Cement,4) lag(e_Beer,1)
#> Est. 0.1031 0.3723 -0.0347 0.2659
#> lag(e_Bricks,1) lag(e_Cement,1)
#> Est. -0.062 -0.189
#>
#> Coefficients for Cement:
#> constant lag(Beer,1) lag(Beer,2) lag(Beer,3) lag(Beer,4)
#> Est. 16.8306 -1.4869 -0.7411 0.9391 0.9391
#> lag(Bricks,1) lag(Bricks,2) lag(Bricks,3) lag(Bricks,4) lag(Cement,1)
#> Est. -0.7411 0.9391 0.9391 -0.6556 0.9391
#> lag(Cement,2) lag(Cement,3) lag(Cement,4) lag(e_Beer,1)
#> Est. 0.9391 -0.6556 -0.2145 -1.3557
#> lag(e_Bricks,1) lag(e_Cement,1)
#> Est. 1.1801 -0.2689
#>
#> Residual covariance matrix:
#> Beer Bricks Cement
#> Beer 239.6616 19.7358 106.3942
#> Bricks 19.7358 405.9554 493.7381
#> Cement 106.3942 493.7381 5033.4689
#>
#> AIC = 20.37 BIC = 21.18
generate(fit, h = 10)
#> # A tsibble: 10 x 7 [1Q]
#> # Key: .model, .rep [1]
#> .model .rep Quarter .innov[,"Beer"] Beer Bricks Cement
#> <chr> <chr> <qtr> <dbl> <dbl> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Bricks,… 1 2004 Q3 -21.6 405. 474. 2244.
#> 2 "VARIMA(vars(Beer, Bricks,… 1 2004 Q4 -0.879 489. 466. 2211.
#> 3 "VARIMA(vars(Beer, Bricks,… 1 2005 Q1 -14.4 430. 427. 2048.
#> 4 "VARIMA(vars(Beer, Bricks,… 1 2005 Q2 -12.1 383. 478. 2126.
#> 5 "VARIMA(vars(Beer, Bricks,… 1 2005 Q3 3.56 415. 482. 2192.
#> 6 "VARIMA(vars(Beer, Bricks,… 1 2005 Q4 20.8 507. 443. 2072.
#> 7 "VARIMA(vars(Beer, Bricks,… 1 2006 Q1 -1.34 438. 390. 1901.
#> 8 "VARIMA(vars(Beer, Bricks,… 1 2006 Q2 -32.9 357. 458. 1956.
#> 9 "VARIMA(vars(Beer, Bricks,… 1 2006 Q3 -1.42 415. 490. 2076.
#> 10 "VARIMA(vars(Beer, Bricks,… 1 2006 Q4 -33.5 464. 447. 2037.
#> # ℹ 1 more variable: .innov[2:3] <dbl>
IRF(fit, h = 10, impulse = "Beer")
#> # A tsibble: 10 x 5 [1Q]
#> # Key: .model [1]
#> .model Quarter Beer Bricks Cement
#> <chr> <qtr> <dbl> <dbl> <dbl>
#> 1 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2004 Q3 1 0 0
#> 2 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2004 Q4 0.0136 -0.378 -0.131
#> 3 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2005 Q1 0.227 -0.0757 0.0261
#> 4 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2005 Q2 0.247 0.0367 -0.138
#> 5 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2005 Q3 0.662 -0.149 0.128
#> 6 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2005 Q4 0.129 -0.257 -0.637
#> 7 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2006 Q1 0.246 0.00538 0.196
#> 8 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2006 Q2 0.243 -0.0572 0.0492
#> 9 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2006 Q3 0.621 -0.140 0.0103
#> 10 "VARIMA(vars(Beer, Bricks, Cement) ~ pdq(4, … 2006 Q4 0.182 -0.229 -0.623