Home 21090308 › Forums › Numerical Method › Bug Reports › Issue with JohansenTest › Reply To: Issue with JohansenTest

Hi kevin,

The method “r” in JohansenTest returns the number of stationary vectors, which are linear combination of input time series.

For example, if we are testing m time series, the value of r could be 0,1,…,m.

r=0: The m time series are not cointegrated.

1<=r 1" when the number of time series is 2.
Therefore the test is equivalent to "johansenTest.r(coint, level) == 2", because the largest value r could get is 2.
In SuanShu, the procedure to compute r is:
step 1: compute the statistics when r=0 and r=1.
step 2: compute the asymptotic Johansen distribution when r=0 and r=1.
step 3: based on the input significant level, compute the quantile of the distribution when r=0 and r=1.
step 4: compare the statistic of r=0 with quantile from distribution of r=0.
- If the statistics is larger than quantile, then null hypothesis r=0 is rejected. And we move on to consider the case r=1.
- Else we output r=0.
-If we are considering r=1 and we can reject the null hypothesis r=1, then r=2.
-Else we output r=1.
So to answer your question, the results from SuanShu are consistent. To get r=2, we need to compare two statistics, one is the statistics when r=0, and the other is the statistics when r=1. The vector you get from "johansenTest.getStats(coint)" are two statistics. The first value in the vector is the statistics when r=0. And the second value in the vector is for r=1.
For example, consider data set A, the statistics is 23.02 and 10.38.
when r=0, we will compare 23.02 with the quantile from Johansen distribution for r=0.
If r=0 could be rejected, then we will compare 10.38 with the quantile from the Johansen distribution for r=1. If r=1 could be rejected, we conclude that r=2.
Hope this helps.