小编R-P*_*eys的帖子

来自 fisher.test() 的 p 值与 phyper() 不匹配

Fisher's Exact Test 与超几何分布有关,我希望这两个命令会返回相同的 pvalues。谁能解释我做错了什么,他们不匹配?

#data (variable names chosen to match dhyper() argument names)
x = 14
m = 20
n = 41047
k = 40

#Fisher test, alternative = 'greater'
(fisher.test(matrix(c(x, m-x, k-x, n-(k-x)),2,2), alternative='greater'))$p.value 
#returns 2.01804e-39

#geometric distribution, lower.tail = F, i.e. P[X > x]
phyper(x, m, n, k, lower.tail = F, log.p = F)
#returns 5.115862e-43
Run Code Online (Sandbox Code Playgroud)

statistics r contingency p-value hypothesis-test

5
推荐指数
1
解决办法
900
查看次数

标签 统计

contingency ×1

hypothesis-test ×1

p-value ×1

r ×1

statistics ×1