{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "%(_doc_callparams_note)s"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The probability mass function for "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "multivariate_hypergeom",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "P(X_1 = x_1, X_2 = x_2, \\ldots, X_k = x_k) = \\frac{\\binom{m_1}{x_1}\n\\binom{m_2}{x_2} \\cdots \\binom{m_k}{x_k}}{\\binom{M}{n}}, \\\\ \\quad\n(x_1, x_2, \\ldots, x_k) \\in \\mathbb{N}^k \\text{ with }\n\\sum_{i=1}^k x_i = n"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "m_i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are the number of objects of type "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "M"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the total number of objects in the population (sum of all the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "m_i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the size of the sample to be taken from the population."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.6.0"
                }
              ]
            }
          ]
        }
      ],
      "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": "pmf(x, m, n)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Probability mass function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "logpmf(x, m, n)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Log of the probability mass function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rvs(m, n, size=1, random_state=None)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Draw random samples from a multivariate hypergeometric distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "mean(m, n)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Mean of the multivariate hypergeometric distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "var(m, n)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Variance of the multivariate hypergeometric distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "cov(m, n)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Compute the covariance matrix of the multivariate hypergeometric 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 multivariate hypergeometric 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": "%(_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": [],
      "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": 5647,
  "item_type": "class",
  "aliases": [
    "scipy.stats._multivariate.multivariate_hypergeom_gen"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "To evaluate the probability mass function of the multivariate\nhypergeometric distribution, with a dichotomous population of size\n:math:`10` and :math:`20`, at a sample of size :math:`12` with\n:math:`8` objects of the first type and :math:`4` objects of the\nsecond type, use:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.stats import multivariate_hypergeom\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "multivariate_hypergeom.pmf(x=[8, 4], m=[10, 20], n=12)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe `multivariate_hypergeom` distribution is identical to the\ncorresponding `hypergeom` distribution (tiny numerical differences\nnotwithstanding) when only two types (good and bad) of objects\nare present in the population as in the example above. Consider\nanother example for a comparison with the hypergeometric distribution:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.stats import hypergeom\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "multivariate_hypergeom.pmf(x=[3, 1], m=[10, 5], n=4)\nhypergeom.pmf(k=3, M=15, n=4, N=10)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe functions ``pmf``, ``logpmf``, ``mean``, ``var``, ``cov``, and ``rvs``\nsupport broadcasting, under the convention that the vector parameters\n(``x``, ``m``, and ``n``) are interpreted as if each row along the last\naxis is a single object. For instance, we can combine the previous two\ncalls to `multivariate_hypergeom` as\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "multivariate_hypergeom.pmf(x=[[8, 4], [3, 1]], m=[[10, 20], [10, 5]],\n                           n=[12, 4])\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThis broadcasting also works for ``cov``, where the output objects are\nsquare matrices of size ``m.shape[-1]``. For example:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "multivariate_hypergeom.cov(m=[[7, 9], [10, 15]], n=[8, 12])\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThat is, ``result[0]`` is equal to\n``multivariate_hypergeom.cov(m=[7, 9], n=8)`` and ``result[1]`` is equal\nto ``multivariate_hypergeom.cov(m=[10, 15], n=12)``.\n\nAlternatively, the object may be called (as a function) to fix the `m`\nand `n` parameters, returning a \"frozen\" multivariate hypergeometric\nrandom variable.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rv = multivariate_hypergeom(m=[10, 20], n=12)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rv.pmf(x=[8, 4])\n",
        "execution_status": "failure"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.stats.hypergeom",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "scipy.stats.hypergeom"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The hypergeometric 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": "multivariate_hypergeom_gen"
  },
  "references": [
    ".. [1] The Multivariate Hypergeometric Distribution,",
    "       http://www.randomservices.org/random/urn/MultiHypergeometric.html",
    ".. [2] Thomas J. Sargent and John Stachurski, 2020,",
    "       Multivariate Hypergeometric Distribution",
    "       https://python.quantecon.org/multi_hyper.html"
  ],
  "qa": "scipy.stats._multivariate:multivariate_hypergeom_gen",
  "arbitrary": [],
  "local_refs": [
    "%(_doc_default_callparams)s",
    "%(_doc_random_state)s",
    "cov(m",
    "logpmf(x",
    "m",
    "mean(m",
    "n",
    "n)",
    "pmf(x",
    "random_state=None)",
    "rvs(m",
    "size=1",
    "var(m"
  ]
}