# Paired permutation test for repeated measures

I have a data set consisting of interactions between male-female dyads within a group in two conditions. The values range from -1 to 1 and indicate how responsible the female was for maintaining the relationship (Hinde's index). What I want to see is if the female responsibility changes in the two conditions. My understanding is that the Wilcoxon test is inappropriate because I have both paired and repeated measurements: each individual is part of several dyads.

Female1-Male1
F1-M2
F1-M3
F2-M1....etc

My other option was to run a permutation test, and I've been searching for one in R (I'm not conversant enough with R to create one myself), but so far the only ones I've found want my data to be integers, which is most definitely not the case.

So I suppose my two questions are
1) Am I even on the right track here or should I be looking for a different test?
2) Can anybody suggest a permutation test that can deal with decimal places?

Thanks

• Are you saying that, say, F1-M2 was observed in condition "A" but not in condition "B" and that perhaps F1-M3 was observed in condition "B"? That is, each female should have been observed in both conditions but perhaps was paired with different sets of males in those two conditions? – whuber May 18 '11 at 21:03
• No, each female-male pair was observed in both conditions. – Rafe May 18 '11 at 21:44

There is the possibility of using the coin package for this type of stuff. See its webpage and the accepted answer to this question.

An implementation for this type of stuff would be the following.

#load the package
require(coin)

# Some toy data:
s.data <- data.frame(dyad = c("F1-M1", "F1-M2","F2-M1","F2-M2"), condition = c(rep("A", 4), rep("B", 4)), dv = runif(8,0,1))

# Make sure the factors are really factors!
str(s.data)

# here goes the permutation test.
oneway_test(dv ~ condition | dyad, distribution = approximate(B=10000), data = s.data)


(Note that you need to use an high number for B in your real example)

Furthermore, you could also use a paired t.test. I don't see any reasons against it:

t.test(subset(s.data, condition == "A", "dv", drop = TRUE), subset(s.data, condition == "B", "dv", drop = TRUE), paired = TRUE)


I think there are is one import thing you haven't discussed so far: With this implementation you would have controlled for the dyads, but not for the individuals (e.g., F1, independent of her male interaction partner). This is a serious threat to your analysis.
I know that there is a bunch of stuff an dyad analyses in psychology and related fields. Unfortunately I cannot give you a real pointer. But you should definitely check this stuff out before finishing your analyses. A quick search on rseek.org returns at least a package called dyad and this webpage.

• Unfortunately, most of the dyad stuff assumes independent dyads where each partner is part of only one dyad. But thanks for the link to that site and its info. – Rafe May 21 '11 at 23:21

Check out the ezPerm function from the ez package for R. For example, assuming your data is in "long format" (see the reshape2 package):

ezPerm(
data = my_data
, dv = .(the_dv)