{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "%(_mvn_doc_callparams_note)s"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The covariance matrix "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "cov",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " may be an instance of a subclass of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "Covariance",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._covariance:Covariance"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", e.g. "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "scipy.stats.CovViaPrecision",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". If so, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "allow_singular",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is ignored."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Otherwise, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "cov",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " must be a symmetric positive semidefinite matrix when "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "allow_singular",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is True; it must be (strictly) positive definite when "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "allow_singular",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is False. Symmetry is not checked; only the lower triangular portion is used. The determinant and inverse of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "cov",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are computed as the pseudo-determinant and pseudo-inverse, respectively, so that "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "cov",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " does not need to have full rank."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The probability density function for "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "multivariate_normal",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f(x) = \\frac{1}{\\sqrt{(2 \\pi)^k \\det \\Sigma}}\n       \\exp\\left( -\\frac{1}{2} (x - \\mu)^T \\Sigma^{-1} (x - \\mu) \\right),"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\mu"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the mean, "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\Sigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " the covariance matrix, "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "k"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " the rank of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\Sigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". In case of singular "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\Sigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", SciPy extends this definition according to "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.14.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": "pdf(x, mean=None, cov=1, allow_singular=False)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Probability density function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "logpdf(x, mean=None, cov=1, allow_singular=False)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Log of the probability density function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "cdf(x, mean=None, cov=1, allow_singular=False, maxpts=1000000*dim, abseps=1e-5, releps=1e-5, lower_limit=None)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Cumulative distribution function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "logcdf(x, mean=None, cov=1, allow_singular=False, maxpts=1000000*dim, abseps=1e-5, releps=1e-5)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Log of the cumulative distribution function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rvs(mean=None, cov=1, size=1, random_state=None)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Draw random samples from a multivariate normal distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "entropy(mean=None, cov=1)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Compute the differential entropy of the multivariate normal."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "marginal(dimensions, mean=None, cov=1, allow_singular=False)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return a marginal multivariate normal distribution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "fit(x, fix_mean=None, fix_cov=None)",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Fit a multivariate normal distribution to data."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "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 normal 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": "%(_mvn_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": "InlineRole",
              "__tag": 4003,
              "value": "mean",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " keyword specifies the mean. The "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "cov",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " keyword specifies the covariance matrix."
            }
          ]
        }
      ],
      "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": 346,
  "item_type": "class",
  "aliases": [
    "scipy.stats._multivariate.multivariate_normal_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 multivariate_normal\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = np.linspace(0, 5, 10, endpoint=False)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "y = multivariate_normal.pdf(x, mean=2.5, cov=0.5); y\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig1 = plt.figure()\nax = fig1.add_subplot(111)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot(x, y)\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-c53798e18801a8ce.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nAlternatively, the object may be called (as a function) to fix the mean\nand covariance parameters, returning a \"frozen\" multivariate normal\nrandom variable:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rv = multivariate_normal(mean=None, cov=1, allow_singular=False)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe input quantiles can be any shape of array, as long as the last\naxis labels the components.  This allows us for instance to\ndisplay the frozen pdf for a non-isotropic random variable in 2D as\nfollows:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x, y = np.mgrid[-1:1:.01, -1:1:.01]\npos = np.dstack((x, y))\nrv = multivariate_normal([0.5, -0.2], [[2.0, 0.3], [0.3, 0.5]])\nfig2 = plt.figure()\nax2 = fig2.add_subplot(111)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax2.contourf(x, y, rv.pdf(pos))\n",
        "execution_status": "failure"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "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_normal_gen"
  },
  "references": [
    ".. [1] Multivariate Normal Distribution - Degenerate Case, Wikipedia,",
    "       https://en.wikipedia.org/wiki/Multivariate_normal_distribution#Degenerate_case"
  ],
  "qa": "scipy.stats._multivariate:multivariate_normal_gen",
  "arbitrary": [],
  "local_refs": [
    "%(_doc_random_state)s",
    "%(_mvn_doc_default_callparams)s",
    "abseps=1e-5",
    "allow_singular=False",
    "allow_singular=False)",
    "cdf(x",
    "cov=1",
    "cov=1)",
    "entropy(mean=None",
    "fit(x",
    "fix_cov=None)",
    "fix_mean=None",
    "logcdf(x",
    "logpdf(x",
    "lower_limit=None)",
    "marginal(dimensions",
    "maxpts=1000000*dim",
    "mean=None",
    "pdf(x",
    "random_state=None)",
    "releps=1e-5",
    "releps=1e-5)",
    "rvs(mean=None",
    "size=1"
  ]
}