在 R 编程中执行二项式测试 - binom.test() 方法
在binom.test()
方法的帮助下,我们可以得到 R 编程中二项式分布假设的二项式检验。
Syntax: binom.test(x, n, p-value)
Return: Returns the value of binomial test.
示例 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