mvem.stats.multivariate_norm
mvem.stats.multivariate_norm.cdf
- mvem.stats.multivariate_norm.cdf(x, mean, cov, allow_singular=False, maxpts=1000000, abseps=1e-05, releps=1e-05)[source]
Cumulative density function of the multivariate normal distribution.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
allow_singular (bool, optional) – Whether to allow a singular matrix. Defaults to False.
maxpts (int, optional) – The maximum number of points to use for integration.
abseps (float, optional) – The absolute error tolerance. Defaults to 1e-5.
releps (float, optional) – The relative error tolerance. Defaults 1e-5.
- Returns
The cumulative density given all observations and parameters.
- Return type
float
mvem.stats.multivariate_norm.fit
- mvem.stats.multivariate_norm.fit(X, return_loglike=False)[source]
Estimate the parameters of the multivariate normal distribution using maximum likelihood estimates.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
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> sigma). 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_norm.logcdf
- mvem.stats.multivariate_norm.logcdf(x, mean, cov, allow_singular=False, maxpts=1000000, abseps=1e-05, releps=1e-05)[source]
Log-cumulative density function of the multivariate normal distribution.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
allow_singular (bool, optional) – Whether to allow a singular matrix. Defaults to False.
maxpts (int, optional) – The maximum number of points to use for integration.
abseps (float, optional) – The absolute error tolerance. Defaults to 1e-5.
releps (float, optional) – The relative error tolerance. Defaults 1e-5.
- Returns
The log-cumulative density given all observations and parameters.
- Return type
float
mvem.stats.multivariate_norm.loglike
- mvem.stats.multivariate_norm.loglike(x, mean, cov, allow_singular=False)[source]
Log-likelihood function of the multivariate normal distribution.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
allow_singular (bool, optional) – Whether to allow a singular matrix. Defaults to False.
- Returns
The log-likelihood for given all observations and parameters.
- Return type
float
mvem.stats.multivariate_norm.logpdf
- mvem.stats.multivariate_norm.logpdf(x, mean, cov, allow_singular=False)[source]
Log-probability density function of the multivariate normal distribution.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
allow_singular (bool, optional) – Whether to allow a singular matrix. Defaults to False.
- Returns
The log-density at each observation.
- Return type
np.ndarray with shape (n,).
mvem.stats.multivariate_norm.mean
- mvem.stats.multivariate_norm.mean(mean, cov)[source]
Mean function of the multivariate normal distribution.
- Parameters
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
- Returns
The mean of the specified distribution.
- Return type
np.ndarray with shape (p,).
mvem.stats.multivariate_norm.pdf
- mvem.stats.multivariate_norm.pdf(x, mean, cov, allow_singular=False)[source]
Probability density function of the multivariate normal distribution.
- Parameters
x (np.ndarray) – An array of shape (n, p) containing n observations of some p-variate data with n > p.
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
allow_singular (bool, optional) – Whether to allow a singular matrix. Defaults to False.
- Returns
The density at each observation.
- Return type
np.ndarray with shape (n,).
mvem.stats.multivariate_norm.rvs
- mvem.stats.multivariate_norm.rvs(mean, cov, size=1, random_state=None)[source]
Random number generator of the multivariate normal distribution.
- Parameters
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
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_norm.var
- mvem.stats.multivariate_norm.var(mean, cov)[source]
Variance function of the multivariate normal distribution.
- Parameters
mean (np.ndarray) – The mean of the normal distribution. A parameter with shape (p,).
cov (np.ndarray) – The covariance of the normal distribution. A positive semi-definite array with shape (p, p).
- Returns
The variance of the specified distribution.
- Return type
np.ndarray with shape (p,).