bundles / scipy 1.17.1 / scipy / stats / _multivariate / wishart_gen
class
scipy.stats._multivariate:wishart_gen
Signature
class wishart_gen ( seed = None ) Members
-
__call__ -
__init__ -
_cholesky_logdet -
_entropy -
_logpdf -
_mean -
_mode -
_process_parameters -
_process_quantiles -
_process_size -
_rvs -
_standard_rvs -
_var -
entropy -
logpdf -
mean -
mode -
pdf -
rvs -
var
Summary
A Wishart random variable.
Extended Summary
The df keyword specifies the degrees of freedom. The scale 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 df > scale.ndim - 1, but see notes on using the rvs method with df < scale.ndim.
Parameters
%(_doc_default_callparams)s%(_doc_random_state)s
Methods
pdf(x, df, scale)Probability density function.
logpdf(x, df, scale)Log of the probability density function.
rvs(df, scale, size=1, random_state=None)Draw random samples from a Wishart distribution.
entropy()Compute the differential entropy of the Wishart distribution.
Raises
: scipy.linalg.LinAlgErrorIf the scale matrix scale is not positive definite.
Notes
%(_doc_callparams_note)s
The scale matrix scale 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.
The Wishart distribution is often denoted
where is the degrees of freedom and is the scale matrix.
The probability density function for wishart has support over positive definite matrices ; if , then its PDF is given by:
If (Wishart) then (inverse Wishart).
If the scale matrix is 1-dimensional and equal to one, then the Wishart distribution collapses to the distribution.
The algorithm [2] implemented by the rvs method may produce numerically singular matrices with ; the user may wish to check for this condition and generate replacement samples as necessary.
Examples
import numpy as np import matplotlib.pyplot as plt from scipy.stats import wishart, chi2 x = np.linspace(1e-5, 8, 100)✓
w = wishart.pdf(x, df=3, scale=1); w[:5] c = chi2.pdf(x, 3); c[:5] plt.plot(x, w)✗
plt.show()
✓
rv = wishart(df=1, scale=1)
✓See also
- chi2
- invwishart
Aliases
-
scipy.stats._multivariate.wishart_gen