[R] Correlation among correlation matrices cor() - Interpret
(Ted Harding)
Ted.Harding at manchester.ac.uk
Fri Oct 10 12:40:53 CEST 2008
On 10-Oct-08 08:07:34, Michael Just wrote:
> Hello,
> If I have two correlation matrices (e.g. one for each of two
> treatments) and then perform cor() on those two correlation
> matrices is this third correlation matrix interpreted as the
> correlation between the two treatments?
>
> In my sample below I would interpret that the treatments are 0.28
> correlated. Is this correct?
>
>> var1<- c(.000000000008, .09, .1234, .5670008, .00110011002200,
>> 8, 9, 12.34, 56.7, 1015245698745859)
>> var2<- c(11, 222, 333, 4444, 55555, 1.1, 2.2, 3.3, 4.4, .55)
>> var3 <-c(22.2, 66.7, 99.9, 1000008, 123123, .1, .2, .3, .4, .5)
>> var4<- c(.000001,.00001,.0001, .001, .1, .12345, .56789, .67890,
>> .78901, .89012)
>> dat <- cbind(var1,var2,var3,var4)
>> dat.d <- data.frame(dat)
>> treatment1 <- dat.d[1:5,]
>> treatment2 <-dat.d[6:10,]
>> t1.d.cor <- cor(treatment1)
>> t2.d.cor <- cor(treatment2)
>> I <-lower.tri(t1.d.cor)
>> t1.t2 <- cor(cbind(T1 = t1.d.cor[I], T2 = t2.d.cor[I]))
>> t1.t2
> T1 T2
> T1 1.0000000 0.2802750
> T2 0.2802750 1.0000000
>
> My code may be unpolished,
> Thanks,
> Michael
You cannot conclude that, because corresponding elements of two
correlation matrices are correlated, the two sets of variables
that they were derived from are "correlated" (between the two sets).
Here (in R) is an example of the contrary. One set of 4 variables
(X1, X2, X3, X4) is such that there are correlations (by construction)
between X1, X2, X3, X4. The other set of four variables Y1, Y2, Y3, Y4
is constructed in the same way. But the four variables (X1,X2,X3,X4)
are independent of the four variables (Y1,Y2,Y3,Y4) and hence the two
sets are not "correlated". Nevertheless, the correlation matrix
(analagous to your t1.t2) between the corresponding elements of the
two correlation matrices is in general quite high.
N <- 500 ; Cors <- numeric(N)
for(i in (1:500)){
X1<-rnorm(10);X2<-rnorm(10);X3<-rnorm(10);X4<-rnorm(10)
V1<-X1; V2<-X1+X2; V3<-X1+X2+X3; V4<-X1+X2+X3+X4
D<-cor(cbind(V1,V2,V3,V4))
Y1<-rnorm(10);Y2<-rnorm(10);Y3<-rnorm(10);Y4<-rnorm(10)
W1<-Y1; W2<-Y1+Y2; W3<-Y1+Y2+Y3; W4<-Y1+Y2+Y3+Y4
E<-cor(cbind(W1,W2,W3,W4))
I <- lower.tri(D)
D.E <- cor(cbind(D=D[I],E=E[I]))
Cors[i] <- D.E[2,1]
}
hist(Cors)
In any case, with the distribution of values exhibited by some of
your variables, even the primary correlation matrices are of
very questionable interpretability.
Indeed, I wonder, if these are real data, what on Earth (literally)
they are data on?
The ratio of the largest to the smallest of, for instance, your
var1 is (approx) 10^26.
A cup of small cup of Espresso coffee is about 60 grams (2 ounces).
60 gm * 10^26 = 6*(10^27) gm = 6*(10^24) kg,
which is the mass of the Earth.
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 10-Oct-08 Time: 11:40:50
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list