Preetam Pal
2015-Oct-04 16:43 UTC
[R] Johansen Test of Cointegration:How to access rows in R output
Hi guys, I ran ca.jo(data,type="trace", ecdet="none",k=2) i.e. Johansen's Trace test on R-Studio (package: "urca")and got the output below: I have 3 questions about this: A> How do I programmatically access the columns("test", "10pct" etc) in any row corresponding to, say, r < = 1 in the output? I mean, I shall only provide the r-value as an input and all the (column name, column value) pairs will be outputted to me. B> How do I write a code that will check if the null hypotheses for r =0, <= 1, <= 2 and so on (in this order) are rejected or not; and in case one of them is rejected, it checks the next higher value of r and gives the final inference , something like "Null not rejected for r <= *appropriate r-value from this table* " or "All nulls rejected" or "No null rejected'. C> Also, I need to extract the eigen vectors from the Cointegration Matrix below to get the cointegrated transfoms. I have attached the data for your perusal. If I need to provide anything more, please let me know. Regards, Preetam ###################### # Johansen-Procedure # ###################### Test type: trace statistic , with linear trend in cointegration Eigenvalues (lambda): [1] 7.935953e-01 5.444372e-01 4.985327e-01 2.562245e-01 5.551115e-16 Values of teststatistic and critical values of test: test 10pct 5pct 1pct r <= 3 | 6.81 10.49 12.25 16.26 r <= 2 | 22.68 22.76 25.32 30.45 r <= 1 | 40.77 39.06 42.44 48.45 r = 0 | 77.06 59.14 62.99 70.05 Eigenvectors, normalised to first column: (These are the cointegration relations) GDP.l2 HPA.l2 FX.l2 Y.l2 trend.l2 GDP.l2 1.000000000 1.0000000 1.00000000 1.00000000 1.0000000 HPA.l2 2.525511110 0.1569079 0.08077351 -0.22777550 -0.9178250 FX.l2 -8.643729121 -2.5815150 0.17158404 -0.47053012 -4.8528875 Y.l2 0.805229998 -1.4241546 0.07767540 0.02303305 0.5213294 trend.l2 0.006283314 0.0385276 -0.01512016 0.01986813 -0.9516072 Weights W: (This is the loading matrix) GDP.l2 HPA.l2 FX.l2 Y.l2 trend.l2 GDP.d 0.03055313 -0.04681978 -0.8376985 -0.04220534 -1.271960e-17 HPA.d -0.22649596 -0.24287691 -1.6358880 2.03813569 -8.002467e-17 FX.d 0.10327579 0.15150469 -0.1649066 0.37449910 -2.570250e-18 Y.d -0.35200485 0.56808024 -5.7829738 0.01000965 1.730461e-16 -------------- next part -------------- GDP HPA FX Y 0.514662421 0.635997077 1.37802145 1.773342598 0.936722 3.127683176 1.391916535 3.709809052 0.101482324 1.270555421 0.831157511 0.226267793 0.017548634 2.456061547 1.003945759 9.510258161 0.236462416 0.988324147 0.223682679 5.026671536 0.372005149 2.177631629 0.904226065 4.219235789 0.153915709 4.620341653 0.033410743 3.17396006 0.524887329 1.050861084 0.518201484 7.950098612 0.776616937 0.503349512 0.666089868 3.320938471 0.760074361 3.635853456 0.470220952 6.380945175 0.802986662 1.260738545 0.452674872 1.036040804 0.375145127 0.20035625 1.837306306 6.486871565 0.002568896 3.532359526 0.556752154 8.536594244 0.754309276 3.952381767 0.247402168 8.559081716 0.585966577 4.01463047 1.184382133 0.148121669 0.39767356 1.553753452 0.983129422 5.378373676 0.859898623 4.73191381 0.828795696 3.367809329 0.741376169 4.993350692 1.758051281 5.516460988 0.329240391 3.465836416 1.701655508 1.249497907 0.078661064 3.298298811 0.04575857 5.132921426 0.270971873 0.46627043 1.739487411 4.94697541 0.731072625 0.940642982 0.728747166 7.583041122 0.385038046 3.51048946 0.021866584 7.361148458 0.530760376 1.204422978 0.415530715 1.163503483 0.555323667 4.777712592 1.844184811 8.596644394
Pfaff, Bernhard Dr.
2015-Oct-05 07:39 UTC
[R] Johansen Test of Cointegration:How to access rows in R output
RTFM: help("ca.jo-class") library(urca) example(ca.jo) class(sjf.vecm) slotNames(sjf.vecm) slot(sjf.vecm, "cval") slot(sjf.vecm, "teststat") slot(sjf.vecm, "V") slot(sjf.vecm, "Vorg") Best, Bernhard -----Urspr?ngliche Nachricht----- Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von Preetam Pal Gesendet: Sonntag, 4. Oktober 2015 18:43 An: r-help at r-project.org Betreff: [R] Johansen Test of Cointegration:How to access rows in R output Hi guys, I ran ca.jo(data,type="trace", ecdet="none",k=2) i.e. Johansen's Trace test on R-Studio (package: "urca")and got the output below: I have 3 questions about this: A> How do I programmatically access the columns("test", "10pct" etc) in A> any row corresponding to, say, r < = 1 in the output? I mean, I shall only provide the r-value as an input and all the (column name, column value) pairs will be outputted to me. B> How do I write a code that will check if the null hypotheses for r B> =0, <= 1, <= 2 and so on (in this order) are rejected or not; and in case one of them is rejected, it checks the next higher value of r and gives the final inference , something like "Null not rejected for r <= *appropriate r-value from this table* " or "All nulls rejected" or "No null rejected'. C> Also, I need to extract the eigen vectors from the Cointegration C> Matrix below to get the cointegrated transfoms. I have attached the data for your perusal. If I need to provide anything more, please let me know. Regards, Preetam ###################### # Johansen-Procedure # ###################### Test type: trace statistic , with linear trend in cointegration Eigenvalues (lambda): [1] 7.935953e-01 5.444372e-01 4.985327e-01 2.562245e-01 5.551115e-16 Values of teststatistic and critical values of test: test 10pct 5pct 1pct r <= 3 | 6.81 10.49 12.25 16.26 r <= 2 | 22.68 22.76 25.32 30.45 r <= 1 | 40.77 39.06 42.44 48.45 r = 0 | 77.06 59.14 62.99 70.05 Eigenvectors, normalised to first column: (These are the cointegration relations) GDP.l2 HPA.l2 FX.l2 Y.l2 trend.l2 GDP.l2 1.000000000 1.0000000 1.00000000 1.00000000 1.0000000 HPA.l2 2.525511110 0.1569079 0.08077351 -0.22777550 -0.9178250 FX.l2 -8.643729121 -2.5815150 0.17158404 -0.47053012 -4.8528875 Y.l2 0.805229998 -1.4241546 0.07767540 0.02303305 0.5213294 trend.l2 0.006283314 0.0385276 -0.01512016 0.01986813 -0.9516072 Weights W: (This is the loading matrix) GDP.l2 HPA.l2 FX.l2 Y.l2 trend.l2 GDP.d 0.03055313 -0.04681978 -0.8376985 -0.04220534 -1.271960e-17 HPA.d -0.22649596 -0.24287691 -1.6358880 2.03813569 -8.002467e-17 FX.d 0.10327579 0.15150469 -0.1649066 0.37449910 -2.570250e-18 Y.d -0.35200485 0.56808024 -5.7829738 0.01000965 1.730461e-16 ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. *****************************************************************