[R-SIG-Finance] Rolling Correlation Matrixes

tonyp petrovaa at gmail.com
Mon Jun 20 00:23:21 CEST 2011

Hi Achim, 

Thanks for your prompt reply. Sounds R is a toy for you to play around with. 

 mycor <- function(x) {
     rval <- cor(x)

 I can see from the first code that you are suggesting a function for
calculating the lower triangle of the correlation matrix and the second
seems to apply a columnwise average somehow. I just don't see how it
calculates the empirical percentile to each entry of the last(pw) matrix.
maybe I misunderstand the function?

   apply(pw, 2, function(x) mean(x <= tail(x, 1))) 

Can you suggest me, if there is similar function as for pairs() that can be
customized. Once I calculate the last rolling correlation matrix and the
current percentiles I want to put in the lower half what your "mycor"
calculates and in the upper half the matched percentiles for the current
rolling cor matrix in a graphical way?

If anybody else can help me with it, I would totally appreciate it. :)

Thanks again. Seems that I have to learn this tool long way.

Best wishes, 


View this message in context: http://r.789695.n4.nabble.com/Rolling-Correlation-Matrixes-tp3609808p3610056.html
Sent from the Rmetrics mailing list archive at Nabble.com.

More information about the R-SIG-Finance mailing list