【发布时间】:2011-06-07 06:30:45
【问题描述】:
以下是代码:问题是计算很慢。
矩阵gene1、gene2 的长度都不相同 (8000)
pos <- c()
neg <- c()
either <- c()
for(i in 1:ncol(both)){
x <- cbind(both[,i], gene1[,i], gene2[,i], neither[,i])
test <- apply(x, 1, function(s){fisher.test(matrix(s, nrow = 2),
alternative = "greater")$p.value})
pos <- c(test,pos)
test1 <- apply(x, 1, function(s){fisher.test(matrix(s, nrow = 2),
alternative = "less")$p.value})
neg <- c(test1, neg)
test2 <- apply(x, 1, function(s){fisher.test(matrix(s, nrow = 2))$p.value})
either <- c(test2, either)
}
【问题讨论】:
-
不是调用fisher 3次,有没有简单的方法来做测试。
-
stats.stackexchange.com 的人可能知道更好的方法