Skip to main content

chiscore

Estimate the joint significance of test statistics derived from linear combination of chi-squared distributions.

Install

We recommend installing it via conda:

conda install -c conda-forge chiscore

Alternatively, chiscore can also be installed using pip:

pip install chiscore

Running the tests

After installation, you can test it

python -c "import chiscore; chiscore.test()"

as long as you have pytest.

Usage

Davies

>>> from chiscore import davies_pvalue
>>> q = 1.5
>>> w = [[0.3, 5.0], [5.0, 1.5]]
>>> davies_pvalue(q, w)
{'p_value': 0.6151796819770086, 'param': {'liu_pval': 0.6151796819770086, 'Is_Converged': 1.0}, 'p_value_resampling': None, 'pval_zero_msg': None}

Liu

Let us approximate

𝑋 = 0.5⋅χ²(1, 1) + 0.4⋅χ²(2, 0.6) + 0.1⋅χ²(1, 0.8),

and evaluate Pr(𝑋 > 2).

>>> from chiscore import liu_sf
>>>
>>> w = [0.5, 0.4, 0.1]
>>> dofs = [1, 2, 1]
>>> deltas = [1, 0.6, 0.8]
>>> (q, dof, delta, _) = liu_sf(2, w, dofs, deltas)
>>> q
0.4577529852208846
>>> dof
3.5556138890755395
>>> delta
0.7491921870025307

Therefore, we have

Pr(𝑋 > 2) ≈ Pr(χ²(3.56, 0.75) > 𝑡⁺𝜎ₓ + 𝜇ₓ) = 0.458.

P-value

>>> from chiscore import optimal_davies_pvalue
>>> q = [1.5, 3.0]
>>> mu = -0.5
>>> var = 1.0
>>> kur = 3.0
>>> w = [10.0, 0.2, 0.1, 0.3]
>>> remain_var = 0.5
>>> df = 3.4
>>> trho = [5.1, 0.2]
>>> grid = [0., 0.01]
>>> optimal_davies_pvalue(q, mu, var, kur, w, remain_var, df, trho, grid)
0.966039962464624

Authors

References

  • Lee, Seunggeun, Michael C. Wu, and Xihong Lin. "Optimal tests for rare variant effects in sequencing association studies." Biostatistics 13.4 (2012): 762-775.
  • Liu, H., Tang, Y., & Zhang, H. H. (2009). A new chi-square approximation to the distribution of non-negative definite quadratic forms in non-central normal variables. Computational Statistics & Data Analysis, 53(4), 853-856.

License

This project is licensed under the MIT License.

Release files for chiscore 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chiscore 0.2.3
File Size Uploaded
chiscore-0.2.3.tar.gz 51.0 kB Details

Release files / chiscore-0.2.3.tar.gz

Download URL chiscore-0.2.3.tar.gz
Size 51.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3b001cd751f5db1c0bbd0b0d775072f1a66a4a9015c34ca2f8b1edc2cc3b0312
BLAKE2b-256 checksum
How to use checksums
58ac8efb6da4574e1b92ef74772513592b0c6fa9a3cd236fce7858cc7a676588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page