注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Bioinformatics home

 
 
 

日志

 
 

Fisher's exact test精确检验  

2013-01-18 05:36:27|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Fisher's exact test [1][2][3] is a statistical significance test used in the analysis ofcontingency tables where sample sizes are small. It is named after its inventor, R. A. Fisher, and is one of a class of exact tests, so called


For example, a sample of teenagers might be divided into male and female on the one hand, and those that are and are not currently dieting on the other. We hypothesize, for example, that the proportion of dieting individuals is higher among the women than among the men, and we want to test whether any difference of proportions that we observe is significant. The data might look like this:


menwomentotal
dieting1910
not dieting11314
totals121224

These data would not be suitable for analysis by a chi-squared test, because the expected values in the table are all below 10, and in a 2 × 2 contingency table, the number of degrees of freedom is always 1.

The question we ask about these data is: knowing that 10 of these 24 teenagers are dieters, and that 12 of the 24 are female, what is the probability that these 10 dieters would be so unevenly distributed between the women and the men? If we were to choose 10 of the teenagers at random, what is the probability that 9 of them would be among the 12 women, and only 1 from among the 12 men?

Before we proceed with the Fisher test, we first introduce some notation. We represent the cells by the letters a, b, c and d, call the totals across rows and columns marginal totals, and represent the grand total by n. So the table now looks like this:


menwomentotal
dietingaba + b
not dietingcdc + d
totalsa + cb + dn

Fisher showed that the probability of obtaining any such set of values was given by thehypergeometric distribution:


p = {{{a+b}\choose{a}}{{c+d}\choose{c}}}\left/{{{n}\choose{a+c}}}\right. =\frac{(a+b)!(c+d)!(a+c)!(b+d)!}{n!a!b!c!d!}


where  \tbinom nk  is the binomial coefficient and the symbol ! indicates the factorial operator.


下面用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.


说明:Fisher's exact test可以用于基因富集分析

来源:http://en.wikipedia.org/wiki/Fisher%27s_exact_test

  评论这张
 
阅读(2749)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017