[R-SIG-Finance] ca.jo help

Charles Evans cevans at chyden.net
Thu May 14 19:49:49 CEST 2009

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

More information about the R-SIG-Finance mailing list