Create a ddf object for the beta-binomial distribution with the given
parameters.
Details
The beta-binomial distribution is a modification of the binomial distribution
(see also bin()) in which the success probability of every experiment is
not a fixed number \(p\), but instead randomly drawn from a beta
distribution in every experiment.
Said rigorously, it has support \(\{0, \dots, n\}\) where \(n\) is the
number of trials.
On its support, its probability mass function is given by
$$p(k) = \binom{n}{k} \frac{B(k + \alpha, n - k + \beta)}{B(\alpha, \beta)}.$$
Here, \(B(a, b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a + b)}\) denotes the
beta function (see also base::beta()).
Note that if \(\alpha\) and \(\beta\) are both integers, it coincides
with a negative hypergeometric distribution with parameters
\(N = n + \alpha + \beta - 1\), \(K = n\) and \(r = \alpha\),
i.e. it generalizes the negative hypergeometric distribution
(described in negative_hypergeometric()).
This is also explored a bit in the ‘Examples’ below.
See also
Other distributions:
benford(),
bernoulli(),
bin(),
geometric(),
hypergeometric(),
negative_bin(),
negative_hypergeometric(),
pois(),
rademacher(),
unif(),
zipf()
Examples
beta_binomial(4, 0.6, 2)
#> Beta-binomial distribution with parameters n = 4, alpha = 0.6 and beta = 2
#>
#> Support:
#> [1] 0 1 2 3 4
#>
#> Probabilities:
#> [1] 0.49769072 0.23889154 0.14333493 0.08281573 0.03726708
# If all arguments are integers, it coincides with
# a negative hypergeometric distribution
beta_binomial(8, 5, 2)
#> Beta-binomial distribution with parameters n = 8, alpha = 5 and beta = 2
#>
#> Support:
#> [1] 0 1 2 3 4 5 6 7 8
#>
#> Probabilities:
#> [1] 0.002997003 0.013320013 0.034965035 0.069930070 0.116550117 0.167832168
#> [7] 0.209790210 0.219780220 0.164835165
negative_hypergeometric(14, 8, 5)
#> Negative hypergeometric distribution with parameters N = 14, K = 8 and r = 5
#>
#> Support:
#> [1] 0 1 2 3 4 5 6 7 8
#>
#> Probabilities:
#> [1] 0.002997003 0.013320013 0.034965035 0.069930070 0.116550117 0.167832168
#> [7] 0.209790210 0.219780220 0.164835165
