Used for drawing random variates.
If seed is None, the RandomState singleton is used.
If seed is an int, a new RandomState instance is used, seeded
with seed.
If seed is already a RandomState or Generator instance,
then that object is used.
Default is None.
Return a marginal multivariate normal distribution.
fit(x, fix_mean=None, fix_cov=None)
Fit a multivariate normal distribution to data.
Notes
Setting the parameter mean to None is equivalent to having mean
be the zero-vector. The parameter cov can be a scalar, in which case
the covariance matrix is the identity times that value, a vector of
diagonal entries for the covariance matrix, a two-dimensional array_like,
or a Covariance object.
The covariance matrix cov may be an instance of a subclass of
Covariance, e.g. scipy.stats.CovViaPrecision. If so, allow_singular
is ignored.
Otherwise, cov must be a symmetric positive semidefinite
matrix when allow_singular is True; it must be (strictly) positive
definite when allow_singular is False.
Symmetry is not checked; only the lower triangular portion is used.
The determinant and inverse of cov are computed
as the pseudo-determinant and pseudo-inverse, respectively, so
that cov does not need to have full rank.
where \(\mu\) is the mean, \(\Sigma\) the covariance matrix,
\(k\) the rank of \(\Sigma\). In case of singular \(\Sigma\),
SciPy extends this definition according to [1].
Alternatively, the object may be called (as a function) to fix the mean
and covariance parameters, returning a "frozen" multivariate normal
random variable:
>>> rv=multivariate_normal(mean=None,cov=1,allow_singular=False)>>> # Frozen object with the same methods but holding the given>>> # mean and covariance fixed.
The input quantiles can be any shape of array, as long as the last
axis labels the components. This allows us for instance to
display the frozen pdf for a non-isotropic random variable in 2D as
follows: