当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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 

相关用法


注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Performing Binomial Test in R programming – binom.test() Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。