[R] decompose a correlation matrix
Baskin, Robert
RBaskin at ahrq.gov
Thu Sep 23 20:44:38 CEST 2004
This may not have things in the order you want but you can see if it gets
close to what you want:
> x <- matrix(1:16,ncol=4)
> x
[,1] [,2] [,3] [,4]
[1,] 1 5 9 13
[2,] 2 6 10 14
[3,] 3 7 11 15
[4,] 4 8 12 16
> y <- x[row(x) < col(x)]
> y
[1] 5 9 10 13 14 15
>
bob
-----Original Message-----
From: Mark Strivens [mailto:strivens at bcm.tmc.edu]
Sent: Thursday, September 23, 2004 2:09 PM
To: r-help at stat.math.ethz.ch
Subject: [R] decompose a correlation matrix
Is there a simple way to decompose the upper triangle
of a correlation matrix to a linear list;
For example:
X Y Z
X 1 2 3
Y 2 1 4
Z 3 4 1
so you get a list like:
xy 2
XZ 3
YZ 4
I suspect you can do it with a matrix transformation, but
that beyond me at present.
Many thanks
Mark
_________________________
Department of Molecular and Human Genetics,
Baylor College of Medicine,
______________________________________________
R-help at 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
More information about the R-help
mailing list