使用binom.test和qbinom,pbinom进行精确的二项式测试?

时间:2016-11-30 15:43:05

标签: r normal-distribution approximation binomial-theorem

以下方法用于单侧测试。我试图使用这两种方法来获得p值,在二项式假设检验的情况下它应该是相同的。但我的价值观略有不同。

pi.H0 <- 0.65
n <- 121
alpha <- 0.05
pbar <- 87/121
( x.hi <- qbinom(1-alpha,size=n,prob=pi.H0) ) # upper critical value **##87**
( pi.hi <- pbinom(x.hi,size=n,prob=pi.H0,lower.tail=FALSE) ) # exact upper alpha **##0.043**

通过使用binom.test,我收到了一个不同的pvalue。

binom.test(87,121,0.65,alternative =“greater”,conf.level = 0.95)

Exact binomial test

data:  87 and 121
number of successes = 87, number of trials = 121, p-value = 0.06552
alternative hypothesis: true probability of success is greater than 0.65
95 percent confidence interval:
 0.644058 1.000000
sample estimates:
probability of success 
         0.7190083

0 个答案:

没有答案