Extra Multivariate Distributions
The following multivariate distributions extend the behavior of Distributions.jl to include numerically stable cumulative probability computations using custom Quasi–Monte Carlo (QMC) integration routines.
AdditionalDistributions.MvGaussian Type
MvGaussian(μ::AbstractVector, Σ::AbstractMatrix)A Multivariate Gaussian (Normal) distribution equivalent in behavior to Distributions.MvNormal, but using a custom Quasi-Monte Carlo (QMC) integrator for the cumulative distribution function (cdf).
This type preserves all the standard functionality of MvNormal — including pdf, logpdf, rand, mean, and cov — while providing its own implementation of cdf(a, b) for rectangular probabilities under a multivariate normal law.
MvGaussian(Σ) # zero-mean version
MvGaussian(μ, Σ) # with explicit mean and covariance
params(d) # returns (μ, Σ)
cdf(d, a, b) # evaluates P(a ≤ X ≤ b)External link:
sourceNotes
Equivalent to
Distributions.MvNormal, but implements its owncdf(a, b)method based on a high–precision QMC integrator.Compatible with reference datasets from MvNormalCDF.jl, adjusted for local reproducibility.
Fully compatible with
mean,cov,pdf,logpdf, andrand.
Example
μ = [0.0, 0.0]
Σ = [1.0 0.5; 0.5 1.0]
d = MvGaussian(μ, Σ)
cdf(d, [-1.0, -1.0], [1.0, 1.0])AdditionalDistributions.MvTStudent Type
MvTStudent(ν::Real, μ::AbstractVector, Σ::AbstractMatrix)A Multivariate Student's t distribution equivalent in behavior to Distributions.MvTDist, but using a custom Quasi-Monte Carlo (QMC) integrator for the rectangular cumulative distribution function (cdf).
This type preserves all the standard functionality of MvTDist — including pdf, logpdf, rand, mean, and cov — while providing its own implementation of cdf(a, b) for rectangular probabilities under a multivariate t law.
MvTStudent(ν, Σ) # zero-mean version with df=ν
MvTStudent(ν, μ, Σ) # with degrees of freedom ν, mean μ, and covariance Σ
params(d) # returns (ν, μ, Σ)
cdf(d, a, b) # evaluates P(a ≤ X ≤ b)External link:
sourceNotes
Equivalent to
Distributions.MvTDist, but with a customcdf(a, b)based on the same QMC integrator.For ν → ∞, numerical results converge to those of
MvGaussian.Benchmarked against
pmvtfrom mvtnorm (R, Genz & Bretz, 2002).
Example
ν = 10
Σ = [1.0 0.4; 0.4 1.0]
d = MvTStudent(ν, Σ)
cdf(d, [-1.0, -1.0], [1.0, 1.0])Implementation Notes
Both types serve as lightweight wrappers around their Distributions.jl counterparts:
struct MvGaussian{D<:Distributions.MvNormal}
dist::D
end
struct MvTStudent{D<:Distributions.MvTDist}
dist::D
endAll statistical methods (mean, cov, pdf, etc.) are delegated to their internal distribution objects, ensuring full compatibility while adding numerical integration support for the cumulative distribution function.
AdditionalDistributions.mvtcdf Function
mvtcdf(Σ, a, b; ν=0, δ=zeros, maxpts=1000n, abseps=1e-6, releps=1e-6,
assume_correlation=false, pivot=true, rng=Random.default_rng())MVN/MVT probability (non-core) on [a,b] using MVSORT + QMC (Richtmyer + shifts).
Returns (value, error, report):
inform = 0success;1tol. not reached withmaxpts;
invalid dimension 2; 3 non-PSD matrix.