Login
Login

Reply To: Issue with JohansenTest

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

#2782
hao.ding
Member

Hi Kevin,

I think I have your data (if it is the same as in your previous email.)
Due to the differences in algorithms, results computed by SuanShu are not exactly the same with those in MATLAB. However, SuanShu and R can return the same results (Johansen statistics). The R code is attached in case you want to check it.

Usually the critical values of Johansen test are taken from the critical value table, you can take a look at the table by typing “co.ja” in R. And the details of the program will show in the screen. Inside the program you can find the critical value table (search for key word cv.none, cv.const, and cv.trend). Currently this table in SuanShu is not public. You can refer to the table in R, the values are very similar.

R code for Johensen Test:

data1<-c(1.06590909090909, 1.04393939393939, 0.991666666666666, 0.989393939393939, 0.988636363636363, 0.946969696969696, 0.931818181818181, 0.893939393939394, 0.872727272727272, 0.926515151515151, 0.825757575757575, 0.821969696969696, 0.825757575757575, 0.834090909090909, 0.899242424242424, 0.852272727272727, 0.916666666666666, 0.916666666666666, 0.949242424242424, 0.931818181818182, 0.909090909090909, 0.988636363636364, 0.98030303030303, 1.02424242424242, 0.963636363636364, 1.05075757575757, 1.04166666666666, 1.10454545454545, 1.13863636363636, 1.14166666666666, 1.13333333333333, 1.07651515151515, 1.06439393939394, 1.02575757575757, 1.04545454545454, 1.01515151515151, 1.0590909090909, 1.04545454545454, 1.03030303030303, 1.25757575757575, 1.28863636363636, 1.38181818181818, 1.38257575757575, 1.47954545454545, 1.42121212121212, 1.48333333333333, 1.47045454545454, 1.46212121212121, 1.36818181818181, 1.29621212121212, 1.2840909090909, 1.27196969696969, 1.24242424242424, 1.3, 1.31212121212121, 1.30151515151515, 1.3030303030303, 1.33484848484848, 1.31818181818181, 1.27651515151515, 1.26969696969696, 1.36363636363636, 1.40454545454545, 1.3810606060606, 1.38636363636363, 1.37878787878787, 1.36439393939393, 1.36060606060606, 1.45, 1.44318181818181, 1.51212121212121, 1.49848484848484, 1.42575757575757, 1.48257575757575, 1.50757575757575, 1.48636363636363, 1.50833333333333, 1.43030303030302, 1.41515151515151, 1.36742424242424, 1.34015151515151, 1.31969696969696, 1.31590909090909, 1.26515151515151, 1.22954545454545, 1.27272727272727, 1.29090909090909, 1.22272727272727, 1.24848484848484, 1.24924242424242, 1.23484848484848, 1.23636363636363, 0.928787878787878, 0.867424242424241, 0.888636363636363, 0.912878787878787, 0.941666666666666, 0.943181818181817, 0.94621212121212, 0.962121212121211, 0.949242424242423, 0.954545454545453, 1.01893939393939, 0.984090909090908, 0.998484848484847, 0.969696969696969, 0.992424242424241, 0.999999999999999, 0.986363636363635, 0.973484848484847, 0.987121212121211, 0.989393939393938, 1.01439393939393, 0.979545454545453, 0.951515151515151, 0.940151515151514, 0.987121212121211, 1.01439393939393, 1.06515151515151, 1.12121212121212, 1.11060606060606, 1.12348484848484, 1.12121212121212, 1.08030303030302, 1.07575757575757, 1.06363636363636, 1.07121212121212, 1.05454545454545, 0.99621212121212, 1.02272727272727, 1.08787878787878, 1.09090909090908, 1.08787878787878, 1.08181818181818, 1.08484848484848, 1.04015151515151, 1.06666666666666, 1.05984848484848, 1.06818181818181, 1.07424242424242, 1.1060606060606, 1.13181818181818, 1.15757575757575, 1.17575757575757, 1.22954545454545, 1.20454545454545, 1.18333333333333, 1.21287878787878, 1.22045454545454, 1.21363636363636, 1.22651515151515, 1.2310606060606, 1.21212121212121, 1.21742424242424, 1.21136363636363, 1.21363636363636, 1.23712121212121, 1.23484848484848, 1.23030303030302, 1.2340909090909, 1.26590909090909, 1.25075757575757, 1.17499999999999, 1.21515151515151, 1.20075757575757, 1.22424242424242, 1.23181818181818, 1.29924242424242, 1.33712121212121, 1.33636363636363, 1.37348484848484, 1.41893939393939, 1.44318181818181, 1.50833333333333, 1.48863636363636, 1.46287878787878, 1.42348484848484, 1.42424242424242, 1.4310606060606, 1.42727272727272, 1.43333333333333, 1.45757575757575, 1.45757575757575, 1.48181818181818, 1.4590909090909, 1.44393939393939, 1.4310606060606, 1.42045454545454, 1.43333333333333, 1.46590909090908, 1.4810606060606, 1.4810606060606, 1.50833333333333, 1.53787878787878, 1.51439393939393, 1.61287878787878, 1.64242424242424, 1.64924242424242, 1.59545454545454, 1.64393939393939) data2<-c(1.07440925087983, 1.05580693815987, 1.04374057315233, 0.990447461035696, 1.06334841628959, 1.07591754650578, 1.04524886877828, 0.970839617898441, 0.938662644544997, 0.933634992458521, 0.919557566616389, 1.00703871292106, 1.07893413775766, 1.1236802413273, 1.25439919557566, 1.18049270990447, 1.28004022121669, 1.29462041226747, 1.37154348919054, 1.24685771744595, 1.32830568124685, 1.28154851684263, 1.35545500251382, 1.33232780291603, 1.2875816993464, 1.40774258421317, 1.34741075917546, 1.39215686274509, 1.54399195575666, 1.4630467571644, 1.45801910507792, 1.35243841126194, 1.35344394167923, 1.28104575163398, 1.36752136752136, 1.35444947209653, 1.48114630467571, 1.45500251382604, 1.42785319255907, 1.40774258421317, 1.49874308697838, 1.55806938159879, 1.49321266968325, 1.57214680744092, 1.46857717445952, 1.56862745098039, 1.54298642533936, 1.55052790346907, 1.48667672197083, 1.38964303670185, 1.35847159376571, 1.37707390648567, 1.29411764705882, 1.37154348919054, 1.37104072398189, 1.3700351935646, 1.32277526395173, 1.35595776772247, 1.35294117647058, 1.26948215183509, 1.25439919557566, 1.27953745600804, 1.29864253393665, 1.27501256913021, 1.25641025641025, 1.24183006535947, 1.19658119658119, 1.20010055304172, 1.30216189039718, 1.3076923076923, 1.38813474107591, 1.39467068878833, 1.35796882855706, 1.42533936651583, 1.45500251382604, 1.39265962795374, 1.40824534942181, 1.38009049773755, 1.33735545500251, 1.2559074912016, 1.236802413273, 1.23780794369029, 1.28858722976369, 1.25842131724484, 1.23730517848164, 1.25892408245349, 1.2664655605832, 1.1850175967823, 1.20311714429361, 1.19356460532931, 1.19356460532931, 1.18099547511312, 1.15837104072398, 1.15937657114127, 1.17948717948717, 1.20663650075414, 1.20663650075414, 1.20060331825037, 1.35243841126193, 1.39567621920563, 1.37254901960784, 1.40271493212669, 1.420814479638, 1.4007038712921, 1.40623428858722, 1.37053795877325, 1.42483660130718, 1.46606334841628, 1.40271493212669, 1.37405731523378, 1.39969834087481, 1.3700351935646, 1.35746606334841, 1.30970336852689, 1.31372549019607, 1.34539969834087, 1.46354952237305, 1.44595274007038, 1.52639517345399, 1.55203619909502, 1.54248366013071, 1.51935646053293, 1.53996983408748, 1.45600804424333, 1.50075414781297, 1.4927099044746, 1.47812971342382, 1.4524886877828, 1.38260432378079, 1.39517345399698, 1.48717948717948, 1.49069884364001, 1.46706887883358, 1.50125691302161, 1.37606837606837, 1.37657114127702, 1.38612368024132, 1.35344394167923, 1.40472599296128, 1.42332830568124, 1.52136752136752, 1.57466063348416, 1.58371040723981, 1.64555052790346, 1.67420814479637, 1.6586224233283, 1.57466063348416, 1.64705882352941, 1.70035193564605, 1.66515837104072, 1.66716943187531, 1.67169431875314, 1.69733534439416, 1.71845148315736, 1.68828557063851, 1.65510306686777, 1.72197083961789, 1.77023629964806, 1.73956762192056, 1.7094017094017, 1.771744595274, 1.75615887380593, 1.67320261437908, 1.69079939668174, 1.72197083961789, 1.75565610859728, 1.75465057817998, 1.84514831573655, 1.86274509803921, 1.9270990447461, 1.93815987933634, 1.87933634992458, 1.90296631473101, 1.98592257415786, 1.95123177476118, 1.93715434891905, 1.84514831573654, 1.8743086978381, 1.83207642031171, 1.77476118652589, 1.7315233785822, 1.75967823026646, 1.70437405731523, 1.76822523881347, 1.76822523881347, 1.70889894419306, 1.66163901458018, 1.64655605832076, 1.66113624937154, 1.73755656108597, 1.71191553544494, 1.7506284565108, 1.77224736048265, 1.80090497737556, 1.80995475113122, 1.84565108094519, 1.87481146304675, 1.88235294117646, 1.8225238813474, 1.84514831573654) library(urca) reEigen<-ca.jo(data.frame(data1, data2), type="eigen", ecdet="none",K=2) reTrace<-ca.jo(data.frame(data1, data2), type="trace", ecdet="none",K=2) summary(reEigen) summary(reTrace)