VECM: Estimate a VECM model

View source: R/vecm.R

VECMR Documentation

Estimate a VECM model

Description

Searches through the vector of lag orders to find the best VECM model which has lowest AIC, AICc or BIC value. The model is estimated using the Johansen procedure (maximum likelihood).

Usage

VECM(formula, ic = c("aicc", "aic", "bic"), r = 1L, ...)

Arguments

formula

Model specification (see "Specials" section).

ic

The information criterion used in selecting the model.

r

The number of cointegrating relationships

...

Further arguments for arima

Details

Exogenous regressors and common_xregs can be specified in the model formula.

Value

A model specification.

Specials

AR

The AR special is used to specify the lag order for the auto-regression.

AR(p = 0:5)
p The order of the auto-regressive (AR) terms. If multiple values are provided, the one which minimises ic will be chosen.

xreg

Exogenous regressors can be included in an VECM 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))

Examples


lung_deaths <- cbind(mdeaths, fdeaths) %>%
  as_tsibble(pivot_longer = FALSE)

fit <- lung_deaths %>%
  model(VECM(vars(mdeaths, fdeaths) ~ AR(3)))

report(fit)

fit %>%
  forecast() %>%
  autoplot(lung_deaths)

fable documentation built on Sept. 25, 2024, 1:08 a.m.