[Rd] mean function on correlation matrices (PR#2540)
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
Tue Feb 11 12:24:03 2003
rs381@wbic.cam.ac.uk writes:
> Full_Name: Raymond Salvador
> Version: R 1.6.2
> OS: Windows ME
> Submission from: (NULL) (131.111.93.195)
>
>
> The mean function applied on individual components of several correlation
> matrices
> gives a wrong result (gives the first value instead of the mean).
>
> Here there is a simple example
>
> x1 <- rnorm(10,1,1)
> y1 <- rnorm(10,1,1)
> z1 <- cbind(x1,y1)
> w1 <- cor(z1)
> x2 <- rnorm(10,1,1)
> y2 <- rnorm(10,1,1)
> z2 <- cbind(x2,y2)
> w2 <- cor(z2)
>
> w1[1,2]
> w2[1,2]
> mean(w1[1,2], w2[1,2])
Yes, and?
> mean(2,6)
[1] 2
> mean(c(2,6))
[1] 4
The mean function just doesn't work the way you expected. Please read
the help page before reporting bugs.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907