Skip to main content

Module multivariate

Module multivariate 

Source
Expand description

Multivariate distributions (SciPy’s multivariate_normal, multivariate_t, dirichlet, wishart, invwishart and multinomial): densities, moments, entropies and sampling. Matrices are Vec<Vec<f64>> of rows.

See the book entry Multivariate distributions and further tests.

Structs§

Dirichlet
The Dirichlet distribution on the simplex (SciPy’s dirichlet(α)): f(x) = Π x_i^{α_i − 1} / B(α), B(α) = Π Γ(α_i) / Γ(α₀), α₀ = Σ α_i.
InvWishart
The inverse Wishart distribution of X⁻¹ for X ~ Wishart(ν, Ψ⁻¹) (SciPy’s invwishart(df, scale = Ψ)): log f(X) = (ν/2) log|Ψ| − (νp/2) log 2 − log Γ_p(ν/2) − ((ν + p + 1)/2) log|X| − tr(Ψ X⁻¹)/2.
Multinomial
The multinomial distribution of the counts of n independent draws from p.len() categories with probabilities p (SciPy’s multinomial(n, p)).
MultivariateNormal
The multivariate normal distribution N(μ, Σ) (SciPy’s multivariate_normal), for a positive definite Σ: log f(x) = −½ (d log 2π + log|Σ| + (x − μ)ᵀ Σ⁻¹ (x − μ)), with the quadratic form computed as ‖L⁻¹(x − μ)‖² from the Cholesky factor Σ = L Lᵀ.
MultivariateT
The multivariate Student t distribution with location μ, shape Σ and ν degrees of freedom (SciPy’s multivariate_t): X = μ + Z/√(W/ν), Z ~ N(0, Σ), W ~ χ²_ν.
Wishart
The Wishart distribution of X = Σ_k z_k z_kᵀ, z_k ~ N(0, S), with ν > p − 1 degrees of freedom (SciPy’s wishart(df, scale)): log f(X) = ((ν − p − 1)/2) log|X| − tr(S⁻¹X)/2 − (νp/2) log 2 − (ν/2) log|S| − log Γ_p(ν/2). Sampling uses Bartlett’s decomposition X = L A Aᵀ Lᵀ, A lower triangular with A_ii = √χ²_{ν−i} and standard normal entries below the diagonal.