# [R] manova permutations and pair-wise contrasts

From: Tyler Smith <tyler.smith_at_mail.mcgill.ca>
Date: Wed, 30 May 2007 16:13:34 +0000 (UTC)

Hi,

I have a function for doing permutation tests for Manovas, written with the help of folks here on the list. It seems to work ok, and I've found that there is indeed a significant difference among groups in my analysis. I want to follow up on this by testing for which pairs of groups are significantly different. Reasoning that since Wilks Lambda is a generalization of the Hotelling T test, it should be appropriate for testing difference between two groups as well as between many groups, I used the same function.

This appears to work, with one exception. For one pair of groups the residuals have rank 14 < 15. Reading through the archives I see that this problem comes up with permutation tests on occassion. My question is, does this problem indicate a mistaken assumption or faulty code on my part, and is there anyway to address it, either with a different approach or a change to my function?

The actual function I use is:

wilks.perm <- function(data.mat, cat.vect, n=999){   res.vect <- numeric(n+1)

for (i in 1:n){
wilks <- summary(manova(data.mat ~ sample(cat.vect)),

```                     test="Wilks")\$stats[1,2]
```
res.vect[i] <- wilks
}

res.vect[n+1] <- obs <-
summary(manova(data.mat~cat.vect), test="Wilks")\$stats[1,2]

return(sum(res.vect <= res.vect[n+1])/(n+1))

}

Thanks!

Tyler

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 and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 May 2007 - 16:30:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 May 2007 - 16:31:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.