Re: [R] moving correlation coef ?

From: vincent <vincent_at_7d4.com>
Date: Thu 30 Jun 2005 - 15:15:55 EST

Sundar Dorai-Raj a écrit :

> Perhaps ?cov.wt will work for you? Your example would be identical to:
>
> set.seed(1)
> X <- rnorm(100); Y <- rnorm(100)
> # using cov.wt
> rho1 <- cov.wt(cbind(X, Y), 1:100, cor = TRUE)$cor[1, 2]
> # your weighting scheme
> rho2 <- cor(X[rep(1:100, 1:100)], Y[rep(1:100, 1:100)])
> all.equal(rho1, rho2)
> # [1] TRUE
>
> HTH,
>
> --sundar

Thank you very much Sundar for your advices. I will try this way.
Have a good day.
Vincent



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 30 15:18:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:07 EST