Hi Soheila,
There you go:

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
}

group1 <- c(2, 2, 5, 5, 4, 3, 1, 5,5,5,5,5)
group2 <- c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2)
boxplot(group1, group2)
median.test(group2 ,group1)



----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Sat, May 12, 2012 at 12:23 PM, Soheila Khodakarim
<lkhodaka...@gmail.com>wrote:

> Dear All
>
> Is there any function for "median test" in R?
>
> Best Regards,
> Soheila
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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