{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "tutorial:stats:discrete_betabinom",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The beta-binomial distribution is a binomial distribution with a probability of success "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "p",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that follows a beta distribution. The probability mass function for "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "betabinom",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", defined for "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "0 \\leq k \\leq n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", is:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f(k; n, a, b) = \\binom{n}{k} \\frac{B(k + a, n - k + b)}{B(a, b)}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "k"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "{0, 1,..., n}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "B(a, b)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the Beta function."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the limiting case of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "a = b = 1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the beta-binomial distribution reduces to a discrete uniform distribution:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f(k; n, 1, 1) = \\frac{1}{n + 1}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the limiting case of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "n = 1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the beta-binomial distribution reduces to a Bernoulli distribution with the shape parameter "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "p = a / (a + b)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f(k; 1, a, b) = \\begin{cases}a / (a + b) & \\text{if}\\; k = 0 \\\\b / (a + b) & \\text{if}\\; k = 1\\end{cases}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Implementation: "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "scipy.stats.betabinom",
              "domain": null,
              "role": null,
              "inventory": null
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Beta-Binomial Distribution"
        }
      ],
      "level": 0,
      "target": "discrete-betabinom"
    }
  ],
  "local_refs": []
}