mvem.stats.multivariate_hyperbolic
mvem.stats.multivariate_hyperbolic.fit
- mvem.stats.multivariate_hyperbolic.fit(x, alpha_bar=1, symmetric=False, standardize=False, nit=2000, reltol=1e-08, abstol=1e-07, silent=False, fmu=None, fsigma=None, fgamma=None, return_loglike=False)[source]
Estimate the parameters of the hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
alpha_bar (float, optional) – The initial value of alpha_bar, a positive real number, where alpha_bar = chi = psi.
symmetric (bool, optional) – Whether to fit a symmetric distribution or not. Default to False.
standardize (bool, optional) – Whether to standardize the data before fitting or not. Default to False.
nit (int, optional) – The maximum number of iterations to use in the EM algorithm. Defaults to 2000.
reltol (float, optional) – The relative convergence criterion for the log-likelihood function. Defaults to 1e-8.
abstol (float, optional) – The relative convergence criterion for the log-likelihood function. Defaults to 1e-7.
silent (bool, optional) – Whether to print the log-likelihoods and parameter estimates during fitting or not. Defaults to False.
fmu (np.ndarray, optional) – If fmu!=None, force mu to fmu. Defaults to None.
fsigma (np.ndarray, optional) – If fsigma!=None, force sigma to fsigma. Defaults to None.
fgamma (np.ndarray, optional) – If fgamma!=None, force gamma to fgamma. Defaults to None.
return_loglike (np.ndarray, optional) – Return a list of log-likelihood values at each iteration. Defaults to False.
- Returns
The fitted parameters (<float> chi, <float> psi, <array> mu, <array> sigma, <array> gamma). 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_hyperbolic.loglike
- mvem.stats.multivariate_hyperbolic.loglike(x, chi, psi, mu, sigma, gamma)[source]
Log-likelihood function of the multivariate hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
chi (float) – Univariate parameter > 0.
psi (float) – Univariate parameter > 0.
mu (np.ndarray) – Location parameter with shape (p,).
sigma (np.ndarray) – A positive semi-definite array with shape (p, p).
gamma (np.ndarray) – Parameter with shape (p,).
- Returns
The log-likelihood for given all observations and parameters.
- Return type
float
mvem.stats.multivariate_hyperbolic.logpdf
- mvem.stats.multivariate_hyperbolic.logpdf(x, chi, psi, mu, sigma, gamma)[source]
Log-probability density function of the multivariate hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
chi (float) – Univariate parameter > 0.
psi (float) – Univariate parameter > 0.
mu (np.ndarray) – Location parameter with shape (p,).
sigma (np.ndarray) – A positive semi-definite array with shape (p, p).
gamma (np.ndarray) – Parameter with shape (p,).
- Returns
The log-density at each observation.
- Return type
np.ndarray with shape (n,).
mvem.stats.multivariate_hyperbolic.mean
- mvem.stats.multivariate_hyperbolic.mean(chi, psi, mu, sigma, gamma)[source]
Mean function of the multivariate hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
chi (float) – Univariate parameter > 0.
psi (float) – Univariate parameter > 0.
mu (np.ndarray) – Location parameter with shape (p,).
sigma (np.ndarray) – A positive semi-definite array with shape (p, p).
gamma (np.ndarray) – Parameter with shape (p,).
- Returns
The mean of the specified distribution.
- Return type
np.ndarray with shape (p,).
mvem.stats.multivariate_hyperbolic.pdf
- mvem.stats.multivariate_hyperbolic.pdf(x, chi, psi, mu, sigma, gamma)[source]
Probability density function of the multivariate hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
chi (float) – Univariate parameter > 0.
psi (float) – Univariate parameter > 0.
mu (np.ndarray) – Location parameter with shape (p,).
sigma (np.ndarray) – A positive semi-definite array with shape (p, p).
gamma (np.ndarray) – Parameter with shape (p,).
- Returns
The density at each observation.
- Return type
np.ndarray with shape (n,).
mvem.stats.multivariate_hyperbolic.rvs
- mvem.stats.multivariate_hyperbolic.rvs(chi, psi, mu, sigma, gamma, size)[source]
Random number generator of the multivariate hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
chi (float) – Univariate parameter > 0.
psi (float) – Univariate parameter > 0.
mu (np.ndarray) – Location parameter with shape (p,).
sigma (np.ndarray) – A positive semi-definite array with shape (p, p).
gamma (np.ndarray) – Parameter with shape (p,).
size (int) – The number of samples to draw.
- Returns
The random p-variate numbers generated.
- Return type
np.ndarray with shape (n, p).
mvem.stats.multivariate_hyperbolic.var
- mvem.stats.multivariate_hyperbolic.var(chi, psi, mu, sigma, gamma)[source]
Variance function of the multivariate hyperbolic distribution. We use the (lmbda, chi, psi, mu, sigma, gamma)-parameterisation.
- Parameters
chi (float) – Univariate parameter > 0.
psi (float) – Univariate parameter > 0.
mu (np.ndarray) – Location parameter with shape (p,).
sigma (np.ndarray) – A positive semi-definite array with shape (p, p).
gamma (np.ndarray) – Parameter with shape (p,).
- Returns
The variance of the specified distribution.
- Return type
np.ndarray with shape (n,).