mvem.stats.multivariate_t
mvem.stats.multivariate_t.fit
- mvem.stats.multivariate_t.fit(X, maxiter=100, ptol=1e-06, ftol=1e-08, return_loglike=False)[source]
Fit the parameters of the multivariate Student’s t-distribution to data using an EM algorithm. We use the location-scale parameterisation.
- Parameters
X (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
maxiter – The maximum number of iterations to use in the EM algorithm. Defaults to 100.
ptol (float, optional) – The relative convergence criterion for the estimated parameters. Defaults to 1e-6.
ftol (float, optional) – The relative convergence criterion for the log-likelihood function. Defaults to np.inf.
return_loglike (np.ndarray, optional) – Return a list of log-likelihood values at each iteration. Defaults to False.
- Returns
The fitted parameters (<array> mu, <array> scale, <float> df). Also returns a list of log-likelihood values at each iteration of the EM algorithm if
return_loglike=True.- Return type
tuple
mvem.stats.multivariate_t.loglike
- mvem.stats.multivariate_t.loglike(x, loc, shape, df, allow_singular=False)[source]
Log-likelihood function of the multivariate Student’s t-distribution. We use the location-scale parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
loc (np.ndarray) – The location parameter with shape (p,).
shape (np.ndarray) – The shape parameter. A positive semi-definite array with shape (p, p).
df (float) – The degrees of freedom of the distribution, > 0.
allow_singular (bool, optional.) – Whether to allow a singular matrix.
- Returns
The log-likelihood for given all observations and parameters.
- Return type
float
mvem.stats.multivariate_t.logpdf
- mvem.stats.multivariate_t.logpdf(x, loc, shape, df, allow_singular=False)[source]
Log-probability density function of the multivariate Student’s t-distribution. We use the location-scale parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
loc (np.ndarray) – The location parameter with shape (p,).
shape (np.ndarray) – The shape parameter. A positive semi-definite array with shape (p, p).
df (float) – The degrees of freedom of the distribution, > 0.
allow_singular (bool, optional.) – Whether to allow a singular matrix.
- Returns
The log-density at each observation.
- Return type
np.ndarray with shape (p,).
mvem.stats.multivariate_t.mean
- mvem.stats.multivariate_t.mean(loc, shape, df)[source]
Mean of the multivariate Student’s t-distribution. We use the location-scale parameterisation.
- Parameters
loc (np.ndarray) – The location parameter with shape (p,).
shape (np.ndarray) – The shape parameter. A positive semi-definite array with shape (p, p).
df (float) – The degrees of freedom of the distribution, > 0.
- Returns
The mean of the specified distribution.
- Return type
np.ndarray with shape (p,).
mvem.stats.multivariate_t.pdf
- mvem.stats.multivariate_t.pdf(x, loc, shape, df, allow_singular=False)[source]
Probability density function of the multivariate Student’s t-distribution. We use the location-scale parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
loc (np.ndarray) – The location parameter with shape (p,).
shape (np.ndarray) – The shape parameter. A positive semi-definite array with shape (p, p).
df (float) – The degrees of freedom of the distribution, > 0.
allow_singular (bool, optional.) – Whether to allow a singular matrix.
- Returns
The density at each observation.
- Return type
np.ndarray with shape (p,).
mvem.stats.multivariate_t.rvs
- mvem.stats.multivariate_t.rvs(loc, shape, df, size=1, random_state=None)[source]
Random number generator of the multivariate Student’s t-distribution. We use the location-scale parameterisation.
- Parameters
loc (np.ndarray) – The location parameter with shape (p,).
shape (np.ndarray) – The shape parameter. A positive semi-definite array with shape (p, p).
df (float) – The degrees of freedom of the distribution, > 0.
size (int, optional) – The number of samples to draw. Defaults to 1.
random_state (None, int, np.random.RandomState, np.random.Generator, optional) – Used for drawing random variates. Defaults to None.
- Returns
The random p-variate numbers generated.
- Return type
np.ndarray with shape (n, p).
mvem.stats.multivariate_t.var
- mvem.stats.multivariate_t.var(loc, shape, df)[source]
Variance of the multivariate Student’s t-distribution. We use the location-scale parameterisation.
- Parameters
loc (np.ndarray) – The location parameter with shape (p,).
shape (np.ndarray) – The shape parameter. A positive semi-definite array with shape (p, p).
df (float) – The degrees of freedom of the distribution, > 0.
- Returns
The variance of the specified distribution.
- Return type
np.ndarray with shape (p,).