[R-SIG-Finance] ca.jo help

spencerg spencer.graves at prodsyse.com
Sun May 17 03:00:18 CEST 2009


      1.  Your sample code is not self contained, which means that I can 
not replicate what you did. 


      2.  Have you looked at Pfaff (2008) Analysis of Integrated and 
Cointegrated Time Series with R, 2nd ed. (Springer)?  I don't know if 
Pfaff discusses "ca.jo" in this book, but it might be worth reviewing -- 
for more than just this. 


      3.  Have you asked Pfaff directly?  He is listed as the maintainer 
of that package, and maintainers are often available to answer questions 
like this. 


      4.  What have you done to compare your example with the examples 
on the "ca.jo" help page?  By comparing "str(johansen_pn)" with "str" of 
the objects in the two examples, you might be able to see something. 


      5.  Have you tried "traceback()" after receiving the error?  This 
often does not work, but it works often enough to make it worthwhile. 


      6.  If none of the above produce enlightenment, you could try 
"debug(ca.jo)", then issue the command below that produced the error.  
When you then repeat the command, it will put you in the environment of 
the function and stop.  From there, you can walk through the code line 
by line looking at the objects created, etc., until you find the error. 
This has worked for me. 


      Hope this helps. 
      Spencer Graves

Charles Evans wrote:
> This is in regard to the ca.jo() function in the urca package in R.
>
> I am a PhD candidate in Finance at Florida Atlantic University in Boca 
> Raton, FL, USA.  As part of my research I must perform cointegration 
> tests on the price and NAV time series of 51 ETFs.  I am able to run 
> Augmented Dickey-Fuller and Phillips-Perron tests in R.  However, I am 
> having a devil of a time getting ca.jo() to work.  If anyone can 
> provide guidance, I would be most appreciative.
>
> I suspect that the problem is related to how I have my data 
> organized.  I have one set of price data (called pt) for 51 ETFs with 
> one ETF daily price series per column and T+1 rows; the first row 
> contains headers.  The first column contains dates.  I have another 
> set of NAV data (called nt) organized in the same way.  The ETFs have 
> different incept dates, and the tables contain NA values.
>
> I want to test for price/NAV cointegration using the Johansen 
> procedures – both eignevalue and trace test – for each of the 51 
> pairs.  When I create a time series for, e.g., price[,49] and NAV[,49] 
> using the cbind() function I get:
>
>
>
> > johansen_pn <- ts(cbind(pt[,49],nt[,49]))
> > ca.jo(johansen_pn, type = c("trace"), ecdet = c("const"), K = 2, 
> spec=c("longrun"), season = NULL, dumvar = NULL)
>
> Error in dimnames(x) <- dn :
> length of 'dimnames' [2] not equal to array extent
>
>
>
> I have tried n different ways to construct the "x" (here, johansen_pn) 
> variable, and I get the same dimnames error every time.
>
> Can anyone suggest a remedy or a cookbook explanation of how to use 
> ca.jo() properly?
>
> Charles Evans
> cevans at chyden.net
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



More information about the R-SIG-Finance mailing list