Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Module « scipy.stats »

Fonction multivariate_t - module scipy.stats

Signature de la fonction multivariate_t

def multivariate_t(loc=None, shape=1, df=1, allow_singular=False, seed=None) 

Description

help(scipy.stats.multivariate_t)

A multivariate t-distributed random variable.

The `loc` parameter specifies the location. The `shape` parameter specifies
the positive semidefinite shape matrix. The `df` parameter specifies the
degrees of freedom.

In addition to calling the methods below, the object itself may be called
as a function to fix the location, shape matrix, and degrees of freedom
parameters, returning a "frozen" multivariate t-distribution random.

Methods
-------
pdf(x, loc=None, shape=1, df=1, allow_singular=False)
    Probability density function.
logpdf(x, loc=None, shape=1, df=1, allow_singular=False)
    Log of the probability density function.
cdf(x, loc=None, shape=1, df=1, allow_singular=False, *,
    maxpts=None, lower_limit=None, random_state=None)
    Cumulative distribution function.
rvs(loc=None, shape=1, df=1, size=1, random_state=None)
    Draw random samples from a multivariate t-distribution.
entropy(loc=None, shape=1, df=1)
    Differential entropy of a multivariate t-distribution.

Parameters
----------
loc : array_like, optional
    Location of the distribution. (default ``0``)
shape : array_like, optional
    Positive semidefinite matrix of the distribution. (default ``1``)
df : float, optional
    Degrees of freedom of the distribution; must be greater than zero.
    If ``np.inf`` then results are multivariate normal. The default is ``1``.
allow_singular : bool, optional
    Whether to allow a singular matrix. (default ``False``)
seed : {None, int, np.random.RandomState, np.random.Generator}, optional
    Used for drawing random variates.
    If `seed` is `None`, the `~np.random.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`.

Notes
-----
Setting the parameter `loc` to ``None`` is equivalent to having `loc`
be the zero-vector. The parameter `shape` can be a scalar, in which case
the shape matrix is the identity times that value, a vector of
diagonal entries for the shape matrix, or a two-dimensional array_like.
The matrix `shape` must be a (symmetric) positive semidefinite matrix. The
determinant and inverse of `shape` are computed as the pseudo-determinant
and pseudo-inverse, respectively, so that `shape` does not need to have
full rank.

The probability density function for `multivariate_t` is

.. math::

    f(x) = \frac{\Gamma((\nu + p)/2)}{\Gamma(\nu/2)\nu^{p/2}\pi^{p/2}|\Sigma|^{1/2}}
           \left[1 + \frac{1}{\nu} (\mathbf{x} - \boldsymbol{\mu})^{\top}
           \boldsymbol{\Sigma}^{-1}
           (\mathbf{x} - \boldsymbol{\mu}) \right]^{-(\nu + p)/2},

where :math:`p` is the dimension of :math:`\mathbf{x}`,
:math:`\boldsymbol{\mu}` is the :math:`p`-dimensional location,
:math:`\boldsymbol{\Sigma}` the :math:`p \times p`-dimensional shape
matrix, and :math:`\nu` is the degrees of freedom.

.. versionadded:: 1.6.0

References
----------
.. [1] Arellano-Valle et al. "Shannon Entropy and Mutual Information for
       Multivariate Skew-Elliptical Distributions". Scandinavian Journal
       of Statistics. Vol. 40, issue 1.

Examples
--------
The object may be called (as a function) to fix the `loc`, `shape`,
`df`, and `allow_singular` parameters, returning a "frozen"
multivariate_t random variable:

>>> import numpy as np
>>> from scipy.stats import multivariate_t
>>> rv = multivariate_t([1.0, -0.5], [[2.1, 0.3], [0.3, 1.5]], df=2)
>>> # Frozen object with the same methods but holding the given location,
>>> # scale, and degrees of freedom fixed.

Create a contour plot of the PDF.

>>> import matplotlib.pyplot as plt
>>> x, y = np.mgrid[-1:3:.01, -2:1.5:.01]
>>> pos = np.dstack((x, y))
>>> fig, ax = plt.subplots(1, 1)
>>> ax.set_aspect('equal')
>>> plt.contourf(x, y, rv.pdf(pos))



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé