{
  "__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 scale matrix "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "scale",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "scale"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " must be a symmetric positive definite matrix. Singular matrices, including the symmetric positive semi-definite case, are not supported. Symmetry is not checked; only the lower triangular portion is used."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Wishart distribution is often denoted"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "W_p(\\nu, \\Sigma)"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\nu"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the degrees of freedom and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\Sigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "p \\times p"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " scale matrix."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The probability density function for "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "wishart",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has support over positive definite matrices "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "S"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; if "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "S \\sim W_p(\\nu, \\Sigma)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", then its PDF is given by:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f(S) = \\frac{|S|^{\\frac{\\nu - p - 1}{2}}}{2^{ \\frac{\\nu p}{2} }\n       |\\Sigma|^\\frac{\\nu}{2} \\Gamma_p \\left ( \\frac{\\nu}{2} \\right )}\n       \\exp\\left( -tr(\\Sigma^{-1} S) / 2 \\right)"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "S \\sim W_p(\\nu, \\Sigma)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (Wishart) then "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "S^{-1} \\sim W_p^{-1}(\\nu, \\Sigma^{-1})"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (inverse Wishart)."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If the scale matrix is 1-dimensional and equal to one, then the Wishart distribution "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "W_1(\\nu, 1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " collapses to the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\chi^2(\\nu)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " distribution."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The algorithm "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " implemented by the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "rvs",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " method may produce numerically singular matrices with "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "p - 1 < \\nu < p"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; the user may wish to check for this condition and generate replacement samples as necessary."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.16.0"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "scipy.linalg.LinAlgError",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If the scale matrix "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "scale",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "scale"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not positive definite."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "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": "pdf(x, df, scale)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Probability density function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "logpdf(x, df, scale)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Log of the probability density function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rvs(df, scale, size=1, random_state=None)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Draw random samples from a Wishart distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "entropy()",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Compute the differential entropy of the Wishart 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 Wishart 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": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "df",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "df"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " keyword specifies the degrees of freedom. The "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "scale",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "scale"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " keyword specifies the scale matrix, which must be symmetric and positive definite. In this context, the scale matrix is often interpreted in terms of a multivariate normal precision matrix (the inverse of the covariance matrix). These arguments must satisfy the relationship "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "df > scale.ndim - 1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but see notes on using the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "rvs",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " method with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "df < scale.ndim"
            },
            {
              "__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": 2612,
  "item_type": "class",
  "aliases": [
    "scipy.stats._multivariate.wishart_gen"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.stats import wishart, chi2\nx = np.linspace(1e-5, 8, 100)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "w = wishart.pdf(x, df=3, scale=1); w[:5]\nc = chi2.pdf(x, 3); c[:5]\nplt.plot(x, w)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-7ffe10647d125a35.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe input quantiles can be any shape of array, as long as the last\naxis labels the components.\n\nAlternatively, the object may be called (as a function) to fix the degrees\nof freedom and scale parameters, returning a \"frozen\" Wishart random\nvariable:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rv = wishart(df=1, scale=1)\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "chi2",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "chi2"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "invwishart",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "invwishart"
        },
        "kind": "module"
      },
      "descriptions": [],
      "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": "wishart_gen"
  },
  "references": [
    ".. [1] M.L. Eaton, \"Multivariate Statistics: A Vector Space Approach\",",
    "       Wiley, 1983.",
    ".. [2] W.B. Smith and R.R. Hocking, \"Algorithm AS 53: Wishart Variate",
    "       Generator\", Applied Statistics, vol. 21, pp. 341-345, 1972."
  ],
  "qa": "scipy.stats._multivariate:wishart_gen",
  "arbitrary": [],
  "local_refs": [
    "%(_doc_default_callparams)s",
    "%(_doc_random_state)s",
    "df",
    "entropy()",
    "logpdf(x",
    "pdf(x",
    "random_state=None)",
    "rvs(df",
    "scale",
    "scale)",
    "size=1"
  ]
}