

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:(Twidth)
for (i in 1:(Twidth)) {
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="OLSCUSUM")
> 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/rsigfinance


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:(Twidth)
> for (i in 1:(Twidth)) {
> 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="OLSCUSUM")
> > 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 19921993 and 19971998. Other
tests, not only moving estimates tests would yield similar results, for
example a CUSUMtype 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), 445466.
A preprint version is available from my Web page.
hth,
Z
_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/rsigfinance


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.burnsstat.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:(Twidth)
>> for (i in 1:(Twidth)) {
>> 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="OLSCUSUM")
>> > 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 19921993 and 19971998. Other
>tests, not only moving estimates tests would yield similar results, for
>example a CUSUMtype 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), 445466.
>A preprint version is available from my Web page.
>
>hth,
>Z
>
>_______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/rsigfinance>
>
>
>
_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/rsigfinance


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:(Twidth)
>> for (i in 1:(Twidth)) {
>> 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="OLSCUSUM")
>> > 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 19921993 and 19971998. Other
>tests, not only moving estimates tests would yield similar results, for
>example a CUSUMtype 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), 445466.
>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/rsigfinance


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

