[R-sig-finance] structural breaks in correlation
Krishna Kumar
kriskumar at earthlink.net
Thu Mar 23 04:24:51 CET 2006
Hi folks,
I am trying to understand structural breaks in correlation using the
strucchange package in R.
I am looking at a rolling window estimate of correlation (pearsons) to
identify breaks and see if the underlying process has changed.
> data(EuStockMarkets)
> dax <- log(EuStockMarkets[,"DAX"])
> ftse <- log(EuStockMarkets[,"FTSE"])
> dax.ret<-diff(dax)
> ftse.ret<-diff(ftse)
rollingcor <- function(ret, width) {
T<-dim(ret)[1]
results<-1:(T-width)
for (i in 1:(T-width)) {
indx<-i+width
results[i] <- cor(ret[i:indx,1],ret[i:indx,2] )
}
return(results)
}
>dax.ftse.cor<-rollingcor(cbind(dax.ret,ftse.ret),50)
> ordcus<-efp(dax.ftse.cor~1,type="OLS-CUSUM")
> plot(ordcus)
Is this the right way to test a rolling correlation estimate? And are
there other tests that are recommended besides the cusum test?
Appreciate your help,
Thanks,
Krishna
More information about the R-sig-finance
mailing list