carl_pch carl_pch - 9 months ago 28
R Question

Extract Information from R's Johansen Procedure (ca.jo) summary

I would like to extract the critical value of test (and only this) information after running the

ca.jo()
function from the model summary in R.

library(urca)
data(finland)
sjf <- finland
sjf.vecm <- ca.jo(sjf, ecdet = "none", type="eigen", K=2,
spec="longrun", season=4)
summary(sjf.vecm)


As shown, while
summary()
returns a long list of results, it does not provide the functionality of getting more specified information through the use of
summary(sjf.vecm)$[target info]
.

######################
# Johansen-Procedure #
######################

Test type: maximal eigenvalue statistic (lambda max) , with linear trend

Eigenvalues (lambda):
[1] 0.30932660 0.22599561 0.07308056 0.02946699

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct
r <= 3 | 3.11 6.50 8.18 11.65
r <= 2 | 7.89 12.91 14.90 19.19
r <= 1 | 26.64 18.90 21.07 25.75
r = 0 | 38.49 24.78 27.14 32.14

Eigenvectors, normalised to first column:
(These are the cointegration relations)

lrm1.l2 lny.l2 lnmr.l2 difp.l2
lrm1.l2 1.0000000 1.000000 1.0000000 1.000000
lny.l2 -0.9763252 -1.323191 -0.9199865 1.608739
lnmr.l2 -7.0910749 -2.016033 0.2691516 -1.375342
difp.l2 -7.0191097 22.740851 -1.8223931 -15.686927

Weights W:
(This is the loading matrix)

lrm1.l2 lny.l2 lnmr.l2 difp.l2
lrm1.d 0.033342108 -0.020280528 -0.129947614 -0.002561906
lny.d 0.022544782 -0.005717446 0.012949130 -0.006265406
lnmr.d 0.053505000 0.046876449 -0.007367715 0.002173242
difp.d 0.005554849 -0.017353903 0.014561151 0.001531004


How can I get the results only from the critical value table, reformat it in some way and produce a table that looks like:

Test | test | 10pct | 5pct | 1pct
----------------------------------------
r <= 3 | 3.11 | 6.50 | 8.18 | 11.65
r <= 2 | 7.89 | 12.91 | 14.90 | 19.19
r <= 1 | 26.64 | 18.90 | 21.07 | 25.75
r = 0 | 38.49 | 24.78 | 27.14 | 32.14

G5W G5W
Answer Source

You can save the results of the summary and then explore its contents with

S = summary(sjf.vecm)
str(S)

Looking at that, you can see how to get the result that you want.

cbind(S@teststat, S@cval)
                   10pct  5pct  1pct
r <= 3 |  3.110626  6.50  8.18 11.65
r <= 2 |  7.892417 12.91 14.90 19.19
r <= 1 | 26.642484 18.90 21.07 25.75
r = 0  | 38.489175 24.78 27.14 32.14