Skip to content

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
julia
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.

julia
MvGaussian(Σ)        # zero-mean version
MvGaussian(μ, Σ)     # with explicit mean and covariance
params(d)            # returns (μ, Σ)
cdf(d, a, b)         # evaluates P(a ≤ X ≤ b)

External link:

source

Notes

  • Equivalent to Distributions.MvNormal, but implements its own cdf(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, and rand.

Example

julia
μ = [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
julia
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.

julia
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:

source

Notes

  • Equivalent to Distributions.MvTDist, but with a custom cdf(a, b) based on the same QMC integrator.

  • For ν → ∞, numerical results converge to those of MvGaussian.

  • Benchmarked against pmvt from mvtnorm (R, Genz & Bretz, 2002).

Example

julia
ν = 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:

julia
struct MvGaussian{D<:Distributions.MvNormal}
    dist::D
end

struct MvTStudent{D<:Distributions.MvTDist}
    dist::D
end

All 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
julia
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 = 0 success; 1 tol. not reached with maxpts;

invalid dimension 2; 3 non-PSD matrix.

source