找回密码
 注册
查看: 19181|回复: 1

R实现Fisher's exact test精确检验

[复制链接]
发表于 2010-5-9 09:14:09 | 显示全部楼层 |阅读模式
下面用R语言实现上面的检验:
> x=c(1,9,11,3)
> alle<-matrix(x, nrow=2)
> fisher.test(alle,alternative ="two.sided")

        Fisher's Exact Test for Count Data

data:  alle
p-value = 0.002759
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
0.0006438284 0.4258840381
sample estimates:
odds ratio
0.03723312
通过> help(fisher.test) 来查看使用说明,alternative = "two.sided"是双侧检验,可以根据说明进行调整为单侧'"greater"' or '"less"'.


fisher.test              package:stats              R Documentation

Fisher's Exact Test for Count Data

Description:

     Performs Fisher's exact test for testing the null of independence
     of rows and columns in a contingency table with fixed marginals.

Usage:

     fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
                 control = list(), or = 1, alternative = "two.sided",
                 conf.int = TRUE, conf.level = 0.95,
                 simulate.p.value = FALSE, B = 2000)

Arguments:

       x: either a two-dimensional contingency table in matrix form, or
          a factor object.

       y: a factor object; ignored if 'x' is a matrix.

回复

使用道具 举报

发表于 2012-12-20 23:51:00 | 显示全部楼层
谢谢!貌似挺简单的呢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-22 19:14 , Processed in 0.047216 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表