Skip to content
Prev 280501 / 398502 Next

calculating correlation coefficients on repeated measures

Hi Keith,

You do need to reorganize your data. cor() will work on any number of variables
as long as they are columns in a matrix or data frame.

There are a lot of ways to reorganize data, of various power and complexity.
Here's one simple way:
P1     P2     P3     P4     P5     P6    P7     P8     P9
WW_08I_01 -18.3 -18.53 -19.55 -20.18 -20.96 -21.08 -21.5 -17.42 -13.18
WW_08I_03 -22.3 -22.20 -22.18 -22.14 -21.55 -20.85 -23.1 -20.75 -20.90
P1 P2 P3 P4 P5 P6 P7 P8 P9
P1  1  1  1  1  1 -1  1  1  1
P2  1  1  1  1  1 -1  1  1  1
P3  1  1  1  1  1 -1  1  1  1
P4  1  1  1  1  1 -1  1  1  1
P5  1  1  1  1  1 -1  1  1  1
P6 -1 -1 -1 -1 -1  1 -1 -1 -1
P7  1  1  1  1  1 -1  1  1  1
P8  1  1  1  1  1 -1  1  1  1
P9  1  1  1  1  1 -1  1  1  1

(With only two values, the correlation table is rather useless, but enough to
give the idea.)

However, cor.test() is what you'd need for significance testing, and it only
works on one pair of variables at a time. It's still easier to put them into
separate columns.
Sarah
On Mon, Dec 19, 2011 at 1:23 AM, Keith Larson <keith.larson at biol.lu.se> wrote: