Learn R Programming

convergenceDFM (version 0.1.4)

test_cointegration_control: Classical cointegration control (Johansen trace or eigen)

Description

Runs Johansen's cointegration test on the first min(2, ncol(X), ncol(Y)) factors from scores_X and scores_Y, and counts the number of cointegrating relations at the 5% level.

Usage

test_cointegration_control(
  factors_data,
  max_lag = 4,
  type = "trace",
  ecdet = "const",
  verbose = TRUE
)

Value

A list with:

  • test: the urca::ca.jo fitted object,

  • n_coint: integer number of cointegrating relations at 5%,

  • vectors: matrix of cointegrating vectors (or NULL if none).

Arguments

factors_data

A list with matrices scores_X and scores_Y (T x Kx) and (T x Ky), respectively.

max_lag

Integer; maximum lag K passed to urca::ca.jo().

type

Character; Johansen test type, one of "trace" or "eigen". Defaults to "trace".

ecdet

Character; deterministic terms, e.g. "const", "trend", or "none". Defaults to "const".

verbose

Logical; print progress and a summary of the test. Default TRUE.

Details

This function requires the optional package urca (declared in Suggests). It does not attempt to install packages at runtime; if urca is unavailable, an informative error is thrown.

The 5% critical values are taken from the "5pct" column of the cval slot returned by urca::ca.jo().

References

Johansen, S. (1991). Estimation and Hypothesis Testing of Cointegration Vectors in Gaussian Vector Autoregressive Models. Econometrica, 59(6), 1551-1580.

Johansen, S. (1995). Likelihood-Based Inference in Cointegrated Vector Autoregressive Models. Oxford University Press.

See Also

ca.jo

Examples

Run this code
# \donttest{
if (requireNamespace("urca", quietly = TRUE)) {
  set.seed(1)
  T <- 120
  X <- cbind(cumsum(rnorm(T)), cumsum(rnorm(T)))
  Y <- cbind(cumsum(rnorm(T)), cumsum(rnorm(T)))
  fd <- list(scores_X = X, scores_Y = Y)
  out <- test_cointegration_control(fd, max_lag = 2, verbose = FALSE)
  str(out)
}
# }

Run the code above in your browser using DataLab