Displaying 1 result from an estimated 1 matches for "msg95278".
Did you mean:
msg05238
2010 May 27
1
median test
Hi all,
I have found the following function online
median.test<-function(y1,y2){
z<-c(y1,y2)
g <- rep(1:2, c(length(y1),length(y2)))
m<-median(z)
fisher.test(z<m,g)$p.value
}
in
http://www.mail-archive.com/r-help@r-project.org/msg95278.html
I have the following data
> group1 <- c(2, 2, 2, 1, 4, 3, 1, 1)
> group2 <- c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2)
> median.test(w1,group1)
[1] 1
> median.test(group1,group2)
Error in fisher.test(z < m, g) : 'x' and 'y' must have at least 2 levels...