Skip to main content

Linear combination of independent noncentral chi-squared random variables

Project description

chi2comb

Travis AppVeyor

This package estimates cumulative density functions of linear combinations of independent noncentral χ² random variables and a standard Normal distribution. Formally, it estimates P[Q<q], where:

Q = λ₁X₁ + ... + λₙXₙ + σX₀.

Xᵢ (𝚒≠𝟶) is an independent random variable following a noncentral χ² distribution with nᵢ degrees of freedom and noncentrality parameter λᵢ. X₀ is an independent random variable having a standard Normal distribution.

Install

It can be installed using the pip command

pip install chi2comb

Usage

Consider the following linear combination of four random variables:

Q = 6⋅X₁ + 3⋅X₂ + 1⋅X₃ + 2⋅X₀,

where X₁, X₂, and X₃ are noncentral χ² random variables having degrees of freedom n₁=n₂=1 and n₃=2 and noncentrality parameters λ₁=0.5 and λ₂=λ₃=0. Let us estimate P[Q<1]:

>>> from chi2comb import chi2comb_cdf, ChiSquared
>>>
>>> gcoef = 2
>>> ncents = [0.5, 0, 0]
>>> q = 1
>>> dofs = [1, 1, 2]
>>> coefs = [6, 3, 1]
>>> chi2s = [ChiSquared(coefs[i], ncents[i], dofs[i]) for i in range(3)]
>>> result, errno, info = chi2comb_cdf(q, chi2s, gcoef)
>>> result
0.050870657088644244
>>> errno
0
>>> info
Info(emag=0.6430413191446991, niterms=43, nints=1, intv=0.03462571527167856, truc=1.4608856930426104, sd=0.0, ncycles=21)

The estimated value is P[Q<1] ≈ 0.0587.

Problems

If you encounter any issue, please, submit it.

Authors

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chi2comb-0.1.0.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distributions

chi2comb-0.1.0-cp39-cp39-win_amd64.whl (23.2 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

chi2comb-0.1.0-cp39-cp39-manylinux2010_x86_64.whl (27.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

chi2comb-0.1.0-cp39-cp39-manylinux2010_i686.whl (26.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

chi2comb-0.1.0-cp39-cp39-manylinux1_x86_64.whl (27.4 kB view hashes)

Uploaded CPython 3.9

chi2comb-0.1.0-cp39-cp39-manylinux1_i686.whl (26.6 kB view hashes)

Uploaded CPython 3.9

chi2comb-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl (15.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

chi2comb-0.1.0-cp38-cp38-win_amd64.whl (23.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

chi2comb-0.1.0-cp38-cp38-manylinux2010_x86_64.whl (27.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

chi2comb-0.1.0-cp38-cp38-manylinux2010_i686.whl (27.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

chi2comb-0.1.0-cp38-cp38-manylinux1_x86_64.whl (27.8 kB view hashes)

Uploaded CPython 3.8

chi2comb-0.1.0-cp38-cp38-manylinux1_i686.whl (27.1 kB view hashes)

Uploaded CPython 3.8

chi2comb-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl (15.5 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

chi2comb-0.1.0-cp37-cp37m-win_amd64.whl (23.1 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

chi2comb-0.1.0-cp37-cp37m-manylinux2010_x86_64.whl (27.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

chi2comb-0.1.0-cp37-cp37m-manylinux2010_i686.whl (26.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

chi2comb-0.1.0-cp37-cp37m-manylinux1_x86_64.whl (27.4 kB view hashes)

Uploaded CPython 3.7m

chi2comb-0.1.0-cp37-cp37m-manylinux1_i686.whl (26.6 kB view hashes)

Uploaded CPython 3.7m

chi2comb-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl (15.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

chi2comb-0.1.0-cp36-cp36m-win_amd64.whl (23.1 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

chi2comb-0.1.0-cp36-cp36m-manylinux2010_x86_64.whl (27.4 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

chi2comb-0.1.0-cp36-cp36m-manylinux2010_i686.whl (26.6 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

chi2comb-0.1.0-cp36-cp36m-manylinux1_x86_64.whl (27.4 kB view hashes)

Uploaded CPython 3.6m

chi2comb-0.1.0-cp36-cp36m-manylinux1_i686.whl (26.6 kB view hashes)

Uploaded CPython 3.6m

chi2comb-0.1.0-cp36-cp36m-macosx_10_9_x86_64.whl (15.5 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page