當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。