I am using "apply" to run exact permutation t-tests by columns
using the coin package.  For example:

library(coin)
dat <- matrix(rnorm(7*35),7,35)
fun <- function(x) {
        pvalue( independence_test(x~f, 
                        data=data.frame(x, f=factor(c(rep("a",4),rep("b",3)))), 
                        distribution = "exact"))
                }
p.vals <- apply(dat, 2, fun)

Some small-scale comparisons with the perm package show 
that coin does the actual permutation tests much faster
than perm but when I apply them both over the same matrix
coin ends up taking longer.  My guess is that turning 
each column into a data frame is what slows coin down.
Any ideas on how to tune this up would be most appreciated.

Bryan
 
---------------
Bryan Keller, Doctoral Student/Project Assistant
Educational Psychology - Quantitative Methods
The University of Wisconsin - Madison

______________________________________________
R-help@r-project.org 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.

Reply via email to