[R] Correlation Loops in time series

TMiller thomas.mueller at student.unisg.ch
Wed Jul 31 15:16:25 CEST 2013

Hello, I've got the following problem.
I have to matrices each containing 200 time series.
Now I want to calculate the correlation of the first time series of each of
the matrices.
I use the following command:
cor(mts1[,1],mts2[,1], use="complete.obs", method=c("pearson"))
cor(mts1[,2],mts2[,2], use="complete.obs", method=c("pearson"))
cor(mts1[,3],mts2[,3], use="complete.obs", method=c("pearson"))
and so on..
I would like to repeat this for each of the 200 time series. As it is quite
painful to change the command 200 times I wanted to ask if there's a loop
function that can cover these series in a fast way?
Thanks in advance for your help

View this message in context: http://r.789695.n4.nabble.com/Correlation-Loops-in-time-series-tp4672732.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list