[R] decompose a correlation matrix
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Sep 23 20:39:10 CEST 2004
On Thu, 23 Sep 2004 13:08:53 -0500, "Mark Strivens"
<strivens at bcm.tmc.edu> wrote :
>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.
x[ row(x) < col(x) ]
will give the entries you want.
Duncan Murdoch
More information about the R-help
mailing list