[R-sig-finance] structural breaks in correlation
Krishna Kumar
kriskumar at earthlink.net
Thu Mar 23 12:46:17 CET 2006
Achim Zeileis wrote:
>On Wed, 22 Mar 2006 22:24:51 -0500 Krishna Kumar wrote:
>
>
>
>>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)
>>
>>
>
>You can compute this quantity much easier via:
> dax.ftse.cor <- rapply(diff(log(EuStockMarkets[,c("DAX", "FTSE")])),
> 50, function(x) cor(x[,1], x[,2]), by.column = FALSE)
>
>
>
>> > 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?
>>
>>
>I would not use the strategy above, because you introduce a(n
>additional) dependence into the series by computing the correlations
>beforehand. Instead you could simply use a regression model, e.g.
> dax <- diff(log(EuStockMarkets[,"DAX"]))
> ftse <- diff(log(EuStockMarkets[,"FTSE"]))
>and use a moving estimates test in this regression model, e.g., with a
>bandwidth of 10% of the data
> me <- efp(dax ~ ftse, type = "ME", h = 0.1)
> plot(me, functional = NULL)
>which would suggest a shift between 1992-1993 and 1997-1998. Other
>tests, not only moving estimates tests would yield similar results, for
>example a CUSUM-type test based on the model scores
> scus <- gefp(dax ~ ftse)
> plot(scus, aggregate = FALSE)
>For a recent survey of these and related tests, see
> Achim Zeileis (2005). "A Unified Approach to Structural Change Tests
> Based on ML scores, F statistics, and OLS residuals," Econometric
> Reviews, 24(4), 445-466.
>A preprint version is available from my Web page.
>
>hth,
>Z
>
>
>
Thanks Achim (btw. this is a nice package -thanks) I will take another
look at this and the reference.
Patrick, I was eventually going towards your mgarch as well.
Appreciate your help again,
Best,
Krishna
Best,
Kris
More information about the R-sig-finance
mailing list