JohansenTest - Johansen Cointegration Test

Returns the Johansen (cointegration) test statistics for two or more time series.



JohansenTest(X, Order, Mask, k, p, Test, r, Alpha, Return_type)

X is a two dimensional array of cells where each column represent a separate time series.

Order is the time order in the data series (i.e. the first data point's corresponding date (earliest date = 1 (default), latest date = 0)).

Order Description
1 ascending (the first data point corresponds to the earliest date) (default)
0 descending (the first data point corresponds to the latest date)

Mask is the boolean array to choose the explanatory variables in the model. If missing, all variables in X are included.

k is the number of lagged difference terms used when computing the estimator.

p is the order of the time polynomial in the null hypothesis: (-1 = no deterministic term, 0 = constant-only (default), 1 = constant and trend).

Method Description
-1 no deterministic part
0 deterministic constant only
1 deterministic constant and trend

Test is a flag to select test: 0 = trace (default), 1 = maximal eigenvalue test.

r is the number of cointegrating relationships between the variables (if missing, r = 1).

Alpha is the statistical significance of the test (i.e. alpha). If missing or omitted, a 5% alpha is assumed.

Return_type is a switch to select the return output (1 = test statistics (default), 2 = critical value).

Method Description
1 Test Statistics (e.g. Z-score)
2 Critical Value


  1. Each column in the input matrix corresponds to a separate time series variable.
  2. The input matrix can have no more than twelve (12) columns (or variables).
  3. Each row in the input matrix corresponds to an observation.
  4. The number of cointegrating relationships should be no greater than the number of input variables.
  5. The time series data are homogeneous or equally spaced.
  6. The time series may include missing values (e.g. #N/A) at either end.
  7. There are two types of Johansen tests: one with trace and one with eigenvalue. Each test will produce slightly different inferences.
    • The null hypothesis for the trace test is the number of cointegration vectors r ≤ ?
    • The null hypothesis for the eigenvalue test is r = ?
  8. The function was added in version 1.62 DEWDROP.

Files Examples


  • Johansen, Søren (1991). "Estimation and Hypothesis Testing of Cointegration Vectors in Gaussian Vector Autoregressive Models". Econometrica 59 (6): 1551–1580.
  • Johansen (1988), 'Statistical Analysis of Co-integration vectors', Journal of Economic Dynamics and Control, 12, pp. 231-254.
  • MacKinnon, Haug, Michelis (1996) 'Numerical distribution functions of likelihood ratio tests for cointegration', Queen's University Institute for Economic Research Discussion paper.
Have more questions? Submit a request