{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "logpmf(x, alpha, n):",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Log of the probability mass function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "pmf(x, alpha, n):",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Probability mass function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "mean(alpha, n):",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Mean of the Dirichlet multinomial distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "var(alpha, n):",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Variance of the Dirichlet multinomial distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "cov(alpha, n):",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The covariance of the Dirichlet multinomial distribution."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A Dirichlet multinomial random variable."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "%(_dirichlet_mn_doc_default_callparams)s",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "%(_doc_random_state)s",
              "annotation": "",
              "desc": []
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Dirichlet multinomial distribution is a compound probability distribution: it is the multinomial distribution with number of trials "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "n",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and class probabilities "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "p"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " randomly sampled from a Dirichlet distribution with concentration parameters "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "alpha"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/stats/_multivariate.py",
  "item_line": 6769,
  "item_type": "class",
  "aliases": [
    "scipy.stats._multivariate.dirichlet_multinomial_gen"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.stats import dirichlet_multinomial\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nGet the PMF\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "n = 6  # number of trials\nalpha = [3, 4, 5]  # concentration parameters\nx = [1, 2, 3]  # counts\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.pmf(x, alpha, n)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nIf the sum of category counts does not equal the number of trials,\nthe probability mass is zero.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.pmf(x, alpha, n=7)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nGet the log of the PMF\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.logpmf(x, alpha, n)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nGet the mean\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.mean(alpha, n)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nGet the variance\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.var(alpha, n)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nGet the covariance\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.cov(alpha, n)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nAlternatively, the object may be called (as a function) to fix the\n`alpha` and `n` parameters, returning a \"frozen\" Dirichlet multinomial\nrandom variable.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dm = dirichlet_multinomial(alpha, n)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dm.pmf(x)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nAll methods are fully vectorized. Each element of `x` and `alpha` is\na vector (along the last axis), each element of `n` is an\ninteger (scalar), and the result is computed element-wise.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = [[1, 2, 3], [4, 5, 6]]\nalpha = [[1, 2, 3], [4, 5, 6]]\nn = [6, 15]\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.pmf(x, alpha, n)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "dirichlet_multinomial.cov(alpha, n).shape  # both covariance matrices\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nBroadcasting according to standard NumPy conventions is supported. Here,\nwe have four sets of concentration parameters (each a two element vector)\nfor each of three numbers of trials (each a scalar).\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "alpha = [[3, 4], [4, 5], [5, 6], [6, 7]]\nn = [[6], [7], [8]]\ndirichlet_multinomial.mean(alpha, n).shape\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.stats.dirichlet",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "scipy.stats.dirichlet"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The dirichlet distribution."
            }
          ]
        }
      ],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.stats.multinomial",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "scipy.stats.multinomial"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The multinomial distribution."
            }
          ]
        }
      ],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "seed",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "dirichlet_multinomial_gen"
  },
  "references": [
    ".. [1] Dirichlet-multinomial distribution, Wikipedia,",
    "       https://www.wikipedia.org/wiki/Dirichlet-multinomial_distribution"
  ],
  "qa": "scipy.stats._multivariate:dirichlet_multinomial_gen",
  "arbitrary": [],
  "local_refs": [
    "%(_dirichlet_mn_doc_default_callparams)s",
    "%(_doc_random_state)s",
    "alpha",
    "cov(alpha",
    "logpmf(x",
    "mean(alpha",
    "n):",
    "pmf(x",
    "var(alpha"
  ]
}