[R-SIG-Finance] How to automatically extract test result from Johansen test?
R. Michael Weylandt
michael.weylandt at gmail.com
Sat Mar 31 03:27:59 CEST 2012
Your example is actually from the urca package which is a dependency
of vars -- both are by Dr. Pfaff and I'd highly recommend his book on
all this jazz: Analysis of Integrated and Cointegrated Time Series
DISCLAIMER: I am not a scholar [nor even a particularly well read
student] of unit root analysis so the following is complete bunk at p
Like I said: just like (almost?) every other statistical test, it
depends on your desired significance level. Fix that and then then you
simply compare the test statistics for different cointegration orders
to see if any of them are statistically significant at that level.
However, this has to be done correctly and here's why my memory gets
sjd.vecm at teststat > sjd.vecm at cval[, "10pct"]
being higher than the critical value is "good" for this test.
In my quick study of Johansen, I thought one had to start from r=0 and
test sequentially up to r<=3 to do these things "properly" [i.e., if
you can't eliminate the null hypothesis of no cointegrating vector,
you shouldn't move on to testing the null hypothesis of one
cointegrating vector] but that doesn't seem to be suggested by the
summary tables ... one idea that comes to mind (and I'm really just
guessing here) is that r is the opposite of what I think it is -- so
one starts at r <=3 which is the more general hypothesis and
progresses to the stricter r = 0.
Whatever the correct procedure is, it seems that one needs to be
careful of unpenalized model selection here, but that might be already
taken care of in Johansen's method: I simply don't know. If you get
Pfaff's book I'm sure this is explained: I don't have a copy handy and
it's far too cold and rainy to walk to the library right now.
Sorry I can't be of more help,
On Fri, Mar 30, 2012 at 4:43 PM, Michael <comtech.usa at gmail.com> wrote:
> Thank you for your help!
> I am following the example in the "vars" package in R, shown below:
> sjd <- denmark[, c("LRM", "LRY", "IBO", "IDE")]
> sjd.vecm <- ca.jo(sjd, ecdet = "const", type="eigen", K=2, spec="longrun",
> I got the following stats:
>> sjd.vecm at teststat
>  2.352233 6.342730 10.361950 30.087451
>> sjd.vecm at cval
> 10pct 5pct 1pct
> r <= 3 | 7.52 9.24 12.97
> r <= 2 | 13.75 15.67 20.20
> r <= 1 | 19.77 22.00 26.81
> r = 0 | 25.56 28.14 33.24
> How shall I draw a conclusion of "pass/fail" automatically and
> Could you please show me using the above example?
> Thank you!
> On Fri, Mar 30, 2012 at 11:08 AM, R. Michael Weylandt
> <michael.weylandt at gmail.com> wrote:
>> Actually, it looks like ca.jo objects are S4 so it's a little bit
>> harder: take a look at ?`ca.jo-class` (note the backticks) to see the
>> 26 slots available. I'm not sure if the ones you want have dedicated
>> extractor methods but you can get them with ?slot directly. There's
>> not an absolute pass/fail (like most other statistical tests) so you
>> have to pick your desired significance threshold, but that's not hard.
>> As Brian said though, it makes most sense to do this inside your loop
>> Hope this helps,
>> Michael Weylandt
>> On Fri, Mar 30, 2012 at 12:00 PM, Brian G. Peterson <brian at braverock.com>
>> > On Fri, 2012-03-30 at 10:53 -0500, Michael wrote:
>> >> How to automatically extract test result from Johansen test?
>> >> Hi all,
>> >> I am using the "ca.jo" function to do the Johansen test.
>> >> It's outputting a lot of results.
>> >> If I am running this on a large number of assets, is there a way to
>> >> automatically extract and condense the test outputs to just "pass/fail"
>> >> and
>> >> "residuals"?
>> >> Thanks a lot!
>> > Like all R objects, it is a list internally. Extract what you need in
>> > the same loop that's doing the test.
>> > Please at least try before posting.
>> > --
>> > Brian G. Peterson
>> > http://braverock.com/brian/
>> > Ph: 773-459-4973
>> > IM: bgpbraverock
>> > _______________________________________________
>> > R-SIG-Finance at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> > -- Subscriber-posting only. If you want to post, subscribe first.
>> > -- Also note that this is not the r-help list where general R questions
>> > should go.
More information about the R-SIG-Finance