binbf01 | R Documentation |
This function computes the Bayes factor for testing a binomial
proportion p
based on x
observed successes out of n
trials. Two types of tests are available:
Test of a point null hypothesis: The Bayes factor quantifies the evidence
for H_0 \colon p = p_0
against H_1 \colon p \neq
p_0
. A beta prior is assigned to the proportion p
under
the alternative hypothesis H_1
.
Test of a directional null hypothesis: The Bayes factor quantifies the
evidence for H_0 \colon p \leq p_0
against H_1 \colon
p > p_0
. A beta prior that is truncated to the range [0,
p_0]
under the null H_0
and to (p_0, 1]
under the alternative H_1
is assigned to the proportion p
under the corresponding hypothesis.
binbf01(
x,
n,
p0 = 0.5,
type = c("point", "direction"),
a = 1,
b = 1,
log = FALSE
)
x |
Number of successes |
n |
Number of trials |
p0 |
Tested binomial proportion. Defaults to |
type |
Type of test. Can be |
a |
Number of successes parameter of the beta prior distribution.
Defaults to |
b |
Number of failures parameter of the beta prior distribution.
Defaults to |
log |
Logical indicating whether the natural logarithm of the Bayes
factor should be returned. Defaults to |
Bayes factor in favor of the null hypothesis over the alternative
(\text{BF}_{01}
> 1 indicates evidence for the null
hypothesis, whereas \text{BF}_{01}
< 1 indicates evidence for
the alternative)
Samuel Pawel
pbinbf01, nbinbf01
## example on Mendelian inheritance from ?stats::binom.test
binbf01(x = 682, n = 925, p0 = 3/4, a = 1, b = 1, type = "point")
## 18.6 => strong evidence for the hypothesized p = 3/4 compared to other p
## with directional hypothesis
binbf01(x = 682, n = 925, p0 = 3/4, a = 1, b = 1, type = "direction")
## 1.5 => only anecdotal evidence for p <= 3/4 over p > 3/4
## Particle-counting experiment from Stone (1997) with point null
binbf01(x = 106298, n = 527135, p0 = 0.2, a = 1, b = 1, type = "point")
## 8.1 => moderate evidence for the alternative over the null
## Coin flip experiment from Bartos et al. (2023) with point null
binbf01(x = 178079, n = 350757 , p0 = 0.5, a = 5100, b = 4900, type = "point")
## => 1/1.72e+17 extreme evidence in favor of the alternative over the null
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.