{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _multivariate / matrix_t_gen

class

scipy.stats._multivariate:matrix_t_gen

source: /scipy/stats/_multivariate.py :1579

Signature

class   matrix_t_gen ( seed = None )

Members

Summary

A matrix t-random variable.

Extended Summary

The mean keyword specifies the mean. The row_spread keyword specifies the row-wise spread matrix. The col_spread keyword specifies the column-wise spread matrix.

Parameters

%(_matt_doc_default_callparams)s
%(_doc_random_state)s

Methods

pdf(x, mean=None, row_spread=None, col_spread=None)

Probability density function.

logpdf(x, mean=None, row_spread=None, col_spread=None)

Log of the probability density function.

rvs(mean=None, row_spread=1, col_spread=1, df=1, size=1, random_state=None)

Draw random samples.

Notes

%(_matt_doc_callparams_note)s

The spread matrices specified by row_spread and col_spread must be (symmetric) positive definite. If the samples in X have shape (m,n) then row_spread must have shape (m,m) and col_spread must have shape (n,n). Spread matrices must be full rank.

The probability density function for matrix_t is

or, alternatively,

where is the mean, is the row-wise spread matrix, is the column-wise matrix, is the degrees of freedom, and is the multivariate gamma function.

These equivalent formulations come from the identity

for arrays and and the fact that is equal to , where

denotes a normalized multivariate gamma function.

When this distribution is known as the matrix variate Cauchy.

Examples

import numpy as np
from scipy.stats import matrix_t
M = np.arange(6).reshape(3,2)
M
Sigma = np.diag([1,2,3])
Sigma
Omega = 0.3*np.identity(2)
Omega
X = M + 0.1
X
df = 3
matrix_t.pdf(X, mean=M, row_spread=Sigma, col_spread=Omega, df=df)
Alternatively, the object may be called (as a function) to fix the mean and spread parameters, returning a "frozen" matrix t random variable:
rv = matrix_t(mean=None, row_spread=1, col_spread=1, df=1)

Aliases

  • scipy.stats._multivariate.matrix_t_gen