R语言 进行二项式测试 – binom.test()方法
在 binom.test() 方法的帮助下,我们可以在R编程中对二项分布的一些假设进行二项检验。
语法: binom.test(x, n, p-value)
返回: 返回二项式检验的值。
例1 :
# Using binom.test() method
gfg <- binom.test(58, 100)
print(gfg)
输出
Exact binomial test
data: 58 and 100
number of successes = 58, number of trials = 100, p-value = 0.1332
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.4771192 0.6780145
sample estimates:
probability of success
0.58
例2 :
# Using binom.test() method
gfg <- binom.test(1, 36, 0.6)
print(gfg)
输出
Exact binomial test
data: 1 and 36
number of successes = 1, number of trials = 36, p-value = 2.597e-13
alternative hypothesis: true probability of success is not equal to 0.6
95 percent confidence interval:
0.0007030252 0.1452892647
sample estimates:
probability of success
0.02777778