# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# jcontest

Johansen constraint test

## Syntax

``` [h,pValue,stat,cValue,mles] = jcontest(Y,r,test,Cons) [h,pValue,stat,cValue,mles] = jcontest(Y,r,test,Cons,Name,Value) ```

## Description

`jcontest` tests linear constraints on either the error-correction speeds A or the cointegration space spanned by B in the reduced-rank VEC(q) model of yt:

`$\Delta {y}_{t}=A{B}^{\prime }{y}_{t-1}+{B}_{1}\Delta {y}_{t-1}+\dots +{B}_{q}\Delta {y}_{t-q}+DX+{\epsilon }_{t}.$`
Null hypotheses specifying constraints on A or B are tested against the alternative H(r) of cointegration rank less than or equal to r, without the constraints. The tests also produce maximum likelihood estimates of the parameters in the VEC(q) model, subject to the constraints.

``` [h,pValue,stat,cValue,mles] = jcontest(Y,r,test,Cons)``` performs the Johansen constraint test on a data matrix `Y`.

`[h,pValue,stat,cValue,mles] = jcontest(Y,r,test,Cons,Name,Value)` performs the Johansen constraint test on a data matrix `Y` with additional options specified by one or more `Name,Value` pair arguments.

## Input Arguments

`Y`

`numObs`-by-`numDims` matrix representing `numObs` observations of a `numDims`-dimensional time series yt, with the last observation the most recent. Observations containing `NaN` values are removed. Initial values for lagged variables in VEC model estimation are taken from the beginning of the data.

`r`

Scalar or vector of integers between 1 and `numDims`−1, inclusive, specifying the common rank of A and B, as inferred by `jcitest`.

`test`

Character vector, such as `'ACon'`, or cell vector of character vectors specifying the type of tests to be performed. Values are:

 `'ACon'` Test linear constraints on A. `'AVec'` Test specific vectors in A. `'BCon'` Test linear constraints on B. `'BVec'` Test specific vectors in B.

`Cons`

Matrix or cell vector of matrices specifying test constraints. For constraints on B, the number of rows in each matrix, `numDims1`, is the number of dimensions in the data, `numDims`, unless `model` is `H*`or `H1*`, in which case `numDims1` = `numDims` + 1 and constraints include the restricted deterministic term in the model.

 Test Cons `'ACon'` `numDims`-by-`numCons` matrix `R` specifying `numCons` constraints on A given by `R'*A = 0`. `numCons` must not exceed `numDims` − r. `'AVec'` `numDims`-by-`numCons` matrix specifying `numCons` of the error-correction speed vectors in A. `numCons` must not exceed r. `'BCon'` `numDims1`-by-`numCons` matrix `R` specifying `numCons` constraints on B given by `R'*B = 0`. `numCons` must not exceed `numDims` − r. `'BVec'` `numDims1`-by-`numCons` matrix specifying `numCons` of the cointegrating vectors in B. `numCons` must not exceed r.

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside single quotes (`' '`). You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

`'model'`

Character vector, such as `'H2'`, or cell vector of character vectors specifying the form of the deterministic components of the VEC(q) model of yt. Values of `model` are those considered by Johansen [3]:

ValueForm of Cyt−1 + DX
`'H2'`

AB´yt−1. There are no intercepts or trends in the cointegrated series and there are no deterministic trends in the levels of the data.

`'H1*'`

A(B´yt−1+c0). There are intercepts in the cointegrated series and there are no deterministic trends in the levels of the data.

`'H1'`

A(B´yt−1+c0)+c1. There are intercepts in the cointegrated series and there are deterministic linear trends in the levels of the data. This is the default value.

`'H*'`A(B´yt−1+c0+d0t)+c1. There are intercepts and linear trends in the cointegrated series and there are deterministic linear trends in the levels of the data.
`'H'`A(B´yt−1+c0+d0t)+c1+d1t. There are intercepts and linear trends in the cointegrated series and there are deterministic quadratic trends in the levels of the data.

Deterministic terms outside of the cointegrating relations, c1 and d1, are identified by projecting constant and linear regression coefficients, respectively, onto the orthogonal complement of A.

`'lags'`

Scalar or vector of nonnegative integers indicating the number q of lagged differences in the VEC(q) model of yt.

Lagging and differencing a time series reduce the sample size. Absent any presample values, if yt is defined for t  = 1:N, then the lagged series ytk is defined for t  =  k+1:N. Differencing reduces the time base to k+2:N. With q lagged differences, the common time base is q+2:N and the effective sample size is T  =  N − (q+1).

Default: 0

`'alpha'`

Scalar or vector of nominal significance levels for the tests. Values must be greater than zero and less than one. The default value is `0.05`.

Single-element values for inputs are expanded to the length of any vector value (the number of tests). Vector values must have equal length. If any value is a row vector, all outputs are row vectors.

## Output Arguments

`h`

Vector of Boolean decisions for the tests, with length equal to the number of tests. Values of `h` equal to `1` (`true`) indicate rejection of the null that the constraints hold in favor of the alternative that they do not. Values of `h` equal to `0` (`false`) indicate a failure to reject the null.

`pValue`

Vector of right-tail probabilities of the test statistics, with length equal to the number of tests.

`stat`

Vector of test statistics, with length equal to the number of tests. Statistics are likelihood ratios determined by the test.

`cValue`

Critical values for right-tail probabilities, with length equal to the number of tests. The asymptotic distributions of the test statistics are chi-square, with the degree-of-freedom parameter determined by the test.

`mles`

Structure of maximum likelihood estimates associated with the VEC(q) model of yt, subject to the constraints. Each structure has the following fields:

 `paramNames` Cell vector of parameter names, of the form:{`A`, `B`, `B1`,...,`Bq`, `c0`, `d0`, `c1`, `d1`}Elements depend on the values of `lags` and `model`. `paramVals` Structure of parameter estimates with field names corresponding to the parameter names in `paramNames`. `res` T-by-`numDims` matrix of residuals, where T is the effective sample size, obtained by fitting the VEC(q) model of y(t) to the input data. `EstCov` Estimated covariance Q of the innovations process εt. `rLL` Restricted loglikelihood of `Y` under the null. `uLL` Unrestricted loglikelihood of `Y` under the alternative. `dof` Degrees of freedom of the asymptotic chi-square distribution of the test statistic.

## Examples

collapse all

Load data on Australian and U.S. prices:

```load Data_JAustralian p1 = DataTable.PAU; % Log Australian Consumer Price Index p2 = DataTable.PUS; % Log U.S. Consumer Price Index s12 = DataTable.EXCH; % Log AUD/USD Exchange Rate Y = [p1 p2 s12]; plot(dates,Y) datetick('x','yyyy') legend(series(1:3),'Location','Best') grid on ```

Pretest the individual series for stationarity:

```[h0,pValue0] = jcontest(Y,1,'BVec',{[1 0 0]',[0 1 0]',[0 0 1]'}) ```
```h0 = 1x3 logical array 1 1 0 pValue0 = 0.0000 0.0000 0.0657 ```

Test for cointegration:

```[h1,pValue1] = jcitest(Y) ```
```************************ Results Summary (Test 1) Data: Y Effective sample size: 76 Model: H1 Lags: 0 Statistic: trace Significance level: 0.05 r h stat cValue pValue eigVal ---------------------------------------- 0 1 60.3393 29.7976 0.0010 0.4687 1 0 12.2749 15.4948 0.1446 0.1157 2 0 2.9315 3.8415 0.0869 0.0378 h1 = 1x3 table r0 r1 r2 _____ _____ _____ t1 true false false pValue1 = 1x3 table r0 r1 r2 _____ _______ ________ t1 0.001 0.14455 0.086906 ```

Test for purchasing power parity ():

```[h2,pValue2] = jcontest(Y,1,'BCon',[1 -1 -1]') ```
```h2 = logical 0 pValue2 = 0.0540 ```

## Algorithms

• The parameters A and B in the reduced-rank VEC(q) model are not uniquely identified. `jcontest` identifies B using the methods in [3], depending on the test.

• When constructing constraints, interpret the rows and columns of the `numDims`-by-r matrices A and B as follows:

• Row i of A contains the adjustment speeds of variable yi to disequilibrium in each of the r cointegrating relations.

• Column j of A contains the adjustment speeds of each of the `numDims` variables to disequilibrium in the jth cointegrating relation.

• Row i of B contains the coefficients of variable yi in each of the r cointegrating relations.

• Column j of B contains the coefficients of each `numDims` variable in the jth cointegrating relation.

• Tests on B answer questions about the space of cointegrating relations. Tests on A answer questions about common driving forces in the system. For example, an all-zero row in A indicates a variable that is weakly exogenous with respect to the coefficients in B. Such a variable might affect other variables, but it does not adjust to disequilibrium in the cointegrating relations. Similarly, a standard unit vector column in A indicates a variable that is exclusively adjusting to disequilibrium in a particular cointegrating relation.

• Constraints matrices `R` satisfying RA =  0 or RB =  0 are equivalent to A =  Hφ or B =  Hφ, where H is the orthogonal complement of R (`null(R')`) and φ is a vector of free parameters.

• `jcontest` compares finite-sample statistics to asymptotic critical values, and tests can show significant size distortions for small samples. See [2]. Larger samples lead to more reliable inferences.

• To convert VEC(q) model parameters in the `mles` output to vector autoregressive (VAR) model parameters, use the utility `vec2var`.

## References

[1] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.

[2] Haug, A. “Testing Linear Restrictions on Cointegrating Vectors: Sizes and Powers of Wald Tests in Finite Samples.” Econometric Theory. v. 18, 2002, pp. 505–524.

[3] Johansen, S. Likelihood-Based Inference in Cointegrated Vector Autoregressive Models. Oxford: Oxford University Press, 1995.

[4] Juselius, K. The Cointegrated VAR Model. Oxford: Oxford University Press, 2006.

[5] Morin, N. “Likelihood Ratio Tests on Cointegrating Vectors, Disequilibrium Adjustment Vectors, and their Orthogonal Complements.” European Journal of Pure and Applied Mathematics. v. 3, 2010, pp. 541–571.