structural breaks in correlation

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

structural breaks in correlation

Krishna Kumar-2
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

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: structural breaks in correlation

Achim Zeileis
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

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: structural breaks in correlation

Patrick Burns-2
Another way to look at changes in correlation is
via multivariate GARCH models.  In my experience
they tend not to support the idea of structural breaks.
(But then they are presuming that there are no breaks.)

Patrick Burns
[hidden email]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

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
>
>_______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>
>  
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: structural breaks in correlation

Krishna Kumar-2
In reply to this post by Achim Zeileis
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

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

The "ast" package is good?

Ricardo Zambrano Aguilera
In reply to this post by Krishna Kumar-2
Hi everyone , i have a big doubt.
 the ast library  to me was always useful, but recently i´m was
analyzing the whole concept specially, the arimaId , and i think that, this package actually is not official.
that´s my question... why not??
thanks a lot

















> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

RV: The "ast" package is good?

Ricardo Zambrano Aguilera
In reply to this post by Krishna Kumar-2


> Hi everyone , i have a big doubt.
>  the ast library  to me was always useful, but recently i´m was
> analyzing the whole concept specially, the arimaId , and i think that, this package actually is not official.
> that´s my question... why not??
> thanks a lot
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: The "ast" package is good?

Spencer Graves
In reply to this post by Ricardo Zambrano Aguilera
          I'm not familiar with the "ast" library.  I couldn't find it on CRAN
(www.r-project.org -> CRAN -> [select a mirror] -> packages).  That does
NOT mean it's not any good;  it just means that the author(s) /
maintainer(s) have not submitted it.  RSiteSearch("ast package")
revealed that other users have similarly asked about "ast" (e.g.,
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/62346.html).

          Have you asked Prof. Masarotto why he has not contributed it to CRAN?
  I don't know, but I can speculate that he might want to debug it more,
or he may need to enhance the documentation to meet CRAN standards.  Of
course, if you volunteered to do some of this for him, you might be able
to help make it happen;  this is after all how the R project has grown.

          hope this helps,
          spencer graves

Ricardo Zambrano Aguilera wrote:

> Hi everyone , i have a big doubt.
>  the ast library  to me was always useful, but recently i´m was
> analyzing the whole concept specially, the arimaId , and i think that, this package actually is not official.
> that´s my question... why not??
> thanks a lot
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>
>
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance