File: discrete_betabinom.rst

package info (click to toggle)
scipy 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 132,464 kB
  • sloc: python: 207,830; ansic: 92,105; fortran: 76,906; cpp: 68,145; javascript: 32,742; makefile: 422; pascal: 421; sh: 158
file content (27 lines) | stat: -rwxr-xr-x 940 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

.. _discrete-betabinom:

Beta-Binomial Distribution
==========================

The beta-binomial distribution is a binomial distribution with a probability of success `p` that follows a beta distribution. The probability mass function for `betabinom`, defined for :math:`0 \leq k \leq n`, is:

.. math::

    f(k; n, a, b) = \binom{n}{k} \frac{B(k + a, n - k + b)}{B(a, b)}

for ``k`` in ``{0, 1,..., n}``, where :math:`B(a, b)` is the Beta function.

In the limiting case of :math:`a = b = 1`, the beta-binomial distribution reduces to a discrete uniform distribution:

.. math::

    f(k; n, 1, 1) = \frac{1}{n + 1}

In the limiting case of :math:`n = 1`, the beta-binomial distribution reduces to a Bernoulli distribution with the shape parameter :math:`p = a / (a + b)`:

.. math::

    f(k; 1, a, b) = \begin{cases}a / (a + b) & \text{if}\; k = 0 \\b / (a + b) & \text{if}\; k = 1\end{cases}

Implementation: `scipy.stats.betabinom`