[R] moving correlation coef ?

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Wed Jun 29 16:31:54 CEST 2005



vincent wrote:
> Hello,
> 
> R gives us the correlation functions cor(). (Many thanks ;-))
> Does it also exist a "moving correlation" coefficient ?
> (like the moving average).
> If not, could someone give me some infos or link
> on how to practically implement such a function in R.
> 
> (I did search for "moving correlation" on the R homepage
> but didn't find anything.)
> 
> Thank you.
> Vincent
> 


See ?running in the gtools package:

library(gtools)
X <- rnorm(100); Y <- rnorm(100)
running(X, Y, cor)

HTH,

--sundar




More information about the R-help mailing list