https://github.com/pharmcat/mvnormalcdf.jl

Quasi-Monte-Carlo numerical computation of multivariate normal probabilities

https://github.com/pharmcat/mvnormalcdf.jl

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.3%) to scientific vocabulary

Keywords

julia multivariate-probabilities mvnormal probability-distribution quasi-monte-carlo statistics
Last synced: 6 months ago · JSON representation

Repository

Quasi-Monte-Carlo numerical computation of multivariate normal probabilities

Basic Info
  • Host: GitHub
  • Owner: PharmCat
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Homepage:
  • Size: 94.7 KB
Statistics
  • Stars: 25
  • Watchers: 5
  • Forks: 1
  • Open Issues: 4
  • Releases: 11
Topics
julia multivariate-probabilities mvnormal probability-distribution quasi-monte-carlo statistics
Created over 4 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

MvNormalCDF

Quasi-Monte-Carlo numerical computation of multivariate normal probabilities.

Tier 1

codecov

This function uses an algorithm given in the paper "Numerical Computation of Multivariate Normal Probabilities", in J. of Computational and Graphical Stat., 1(1992), pp. 141-149, by Alan Genz, WSU Math, PO Box 643113, Pullman, WA 99164-3113 Email : alangenz@wsu.edu

The primary references for the numerical integration are "On a Number-Theoretical Integration Method" H. Niederreiter, Aequationes Mathematicae, 8(1972), pp. 304-11, and "Randomization of Number Theoretic Methods for Multiple Integration" R. Cranley and T.N.L. Patterson, SIAM J Numer Anal, 13(1976), pp. 904-14.

Re-coded in Julia from the MATLAB function qsimvnv(m,r,a,b) Alan Genz is the author the MATLAB qsimvnv() function.

Alan Genz software website: http://archive.is/jdeRh Source code to MATLAB qsimvnv() function: http://archive.is/h5L37

Quasi-random sequence made with Richtmyer generator.

MVNCDFFORMULA

Installation

import Pkg; Pkg.add("MvNormalCDF")

Methods

mvnormcdf(dist::MvNormal, a, b; m::Integer = 1000*size(dist.Σ,1), rng = RandomDevice())

Computes the Multivariate Normal probability integral using a quasi-Monte-Carlo algorithm with m points for multivariate normal distributions (MvNormal)

Results will vary slightly from run-to-run due to the quasi-Monte-Carlo algorithm.

There is no covariance matrix Σ positive definite check.

Probability p is output with error estimate e.

:warning: Check estimate e after integration.: Be very careful here! If e == 0 - results could be unstable or could be wrong (one of the reasons can be an ill-conditioned Σ matrix).

Arguments

  • dist::MvNormal: multivariate normal distributions from Distributions.jl
  • a::AbstractVector: lower integration limit column vector
  • b::AbstractVector: upper integration limit column vector
  • m::Integer: number of integration points (default 1000*dimension)
  • rng: random number generator (for quasi-random Richtmyer sequence)

mvnormcdf(μ::AbstractVector{<:Real}, Σ::AbstractMatrix{<:Real}, a::AbstractVector{<:Real}, b::AbstractVector{<:Real}; m::Integer = 1000*size(Σ,1), rng = RandomDevice())

Computes the Non-central Multivariate Normal probability integral with covariance matrix Σ and mean vector μ [x,...].

Arguments

  • μ::AbstractVector: vector of means
  • Σ::AbstractMatrix: positive-definite covariance matrix of MVN distribution
  • a::AbstractVector: lower integration limit column vector
  • b::AbstractVector: upper integration limit column vector
  • m::Integer: number of integration points (default 1000*dimension)
  • rng: random number generator

Example

```julia Σ = [4 3 2 1; 3 5 -1 1; 2 -1 4 2; 1 1 2 5] μ = zeros(4) a = [-Inf; -Inf; -Inf; -Inf] b = [1; 2; 3; 4] m = 5000 (p,e) = mvnormcdf(μ, Σ, a, b; m=m)

(0.605219554009911, 0.0015718064928452481)

```

mvnormcdf(Σ::AbstractMatrix, a::AbstractVector, b::AbstractVector; m::Integer = 1000*size(Σ,1), rng = RandomDevice())

Computes the Multivariate Normal probability integral with covariance matrix Σ, mean [0,...].

Example

```julia Σ = [4 2; 2 3] μ = [1; 2] a = [-Inf; -Inf] b = 2; 2 = mvnormcdf(Σ, a-μ, b-μ)

(0.4306346895870772, 0.00015776288569406053)

```

Not exported

MvNormalCDF.qsimvnv!(Σ::AbstractMatrix{T}, a::AbstractVector{T}, b::AbstractVector{T}, m::Integer, rng) where T

Re-coded in Julia from the MATLAB function qsimvnv(m,r,a,b); mutate Σ, a, b. Computes the Multivariate Normal probability integral with covariance matrix Σ, mean [0,...].

Reference

  • Genz, A. (1992). Numerical computation of multivariate normal probabilities. Journal of Computational and Graphical Statistics, 1, 141--150
  • Genz, A. (1993). Comparison of methods for the computation of multivariate normal probabilities. Computing Science and Statistics, 25, 400--405

P.S.

Idea was taken from this PR to StatsFuns.jl.

See discourse discussion here.

Thanks to @blackeneth.

P.P.S

QSIMVNV(m,r,a,b) and _chlrdr(r,a,b)

Copyright (C) 2013, Alan Genz, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The contributor name(s) may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Owner

  • Name: PharmCat
  • Login: PharmCat
  • Kind: user
  • Location: Msk
  • Company: PharmCat.net

Clinical trial design and data analysis.

GitHub Events

Total
  • Issues event: 5
  • Watch event: 3
  • Issue comment event: 5
  • Push event: 1
  • Pull request event: 1
  • Fork event: 1
Last Year
  • Issues event: 5
  • Watch event: 3
  • Issue comment event: 5
  • Push event: 1
  • Pull request event: 1
  • Fork event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 23
  • Total Committers: 2
  • Avg Commits per committer: 11.5
  • Development Distribution Score (DDS): 0.304
Top Committers
Name Email Commits
PharmCat v****v@y****u 16
PharmCat 1****t@u****m 7
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 11
  • Total pull requests: 6
  • Average time to close issues: 5 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 9
  • Total pull request authors: 2
  • Average comments per issue: 3.18
  • Average comments per pull request: 1.17
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 4
  • Average time to close issues: 4 months
  • Average time to close pull requests: 17 days
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 2.0
  • Average comments per pull request: 1.25
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • PaulSoderlind (2)
  • PharmCat (2)
  • BA1437 (1)
  • CarloLucibello (1)
  • hanjo-kim (1)
  • vittorioerba (1)
  • JuliaTagBot (1)
  • ngiann (1)
  • droodman (1)
Pull Request Authors
  • PharmCat (8)
  • lrnv (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • julia 118 total
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 11
juliahub.com: MvNormalCDF

Quasi-Monte-Carlo numerical computation of multivariate normal probabilities

  • Versions: 11
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 118 Total
Rankings
Dependent repos count: 9.9%
Dependent packages count: 23.0%
Stargazers count: 24.1%
Average: 27.6%
Forks count: 53.5%
Last synced: 6 months ago

Dependencies

.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/Tier1.yml actions
  • actions/checkout v3 composite
  • codecov/codecov-action v3 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite