{"id":21433563,"url":"https://github.com/limix/chiscore","last_synced_at":"2025-07-14T13:31:19.221Z","repository":{"id":60721969,"uuid":"149552029","full_name":"limix/chiscore","owner":"limix","description":"Test statistics derived from linear combination of chi-squared distributions.","archived":false,"fork":false,"pushed_at":"2021-03-01T16:28:18.000Z","size":100,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T21:45:10.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/limix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-20T04:39:05.000Z","updated_at":"2023-09-19T13:56:09.000Z","dependencies_parsed_at":"2022-10-03T20:31:30.288Z","dependency_job_id":null,"html_url":"https://github.com/limix/chiscore","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fchiscore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fchiscore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fchiscore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fchiscore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limix","download_url":"https://codeload.github.com/limix/chiscore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225980902,"owners_count":17554919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T23:28:47.889Z","updated_at":"2024-11-22T23:28:48.362Z","avatar_url":"https://github.com/limix.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chiscore\n\nEstimate the joint significance of test statistics derived from linear combination\nof chi-squared distributions.\n\n## Install\n\nWe recommend installing it via\n[conda](http://conda.pydata.org/docs/index.html):\n\n```bash\nconda install -c conda-forge chiscore\n```\n\nAlternatively, chiscore can also be installed using\n[pip](https://pypi.python.org/pypi/pip):\n\n```bash\npip install chiscore\n```\n\n## Running the tests\n\nAfter installation, you can test it\n\n```bash\npython -c \"import chiscore; chiscore.test()\"\n```\n\nas long as you have [pytest](https://docs.pytest.org/en/latest/).\n\n## Usage\n\n### Davies\n\n```python\n\u003e\u003e\u003e from chiscore import davies_pvalue\n\u003e\u003e\u003e q = 1.5\n\u003e\u003e\u003e w = [[0.3, 5.0], [5.0, 1.5]]\n\u003e\u003e\u003e davies_pvalue(q, w)\n{'p_value': 0.6151796819770086, 'param': {'liu_pval': 0.6151796819770086, 'Is_Converged': 1.0}, 'p_value_resampling': None, 'pval_zero_msg': None}\n```\n\n### Liu\n\nLet us approximate\n\n    𝑋 = 0.5⋅χ²(1, 1) + 0.4⋅χ²(2, 0.6) + 0.1⋅χ²(1, 0.8),\n\nand evaluate Pr(𝑋 \u003e 2).\n\n```python\n\u003e\u003e\u003e from chiscore import liu_sf\n\u003e\u003e\u003e\n\u003e\u003e\u003e w = [0.5, 0.4, 0.1]\n\u003e\u003e\u003e dofs = [1, 2, 1]\n\u003e\u003e\u003e deltas = [1, 0.6, 0.8]\n\u003e\u003e\u003e (q, dof, delta, _) = liu_sf(2, w, dofs, deltas)\n\u003e\u003e\u003e q\n0.4577529852208846\n\u003e\u003e\u003e dof\n3.5556138890755395\n\u003e\u003e\u003e delta\n0.7491921870025307\n```\n\nTherefore, we have\n\n    Pr(𝑋 \u003e 2) ≈ Pr(χ²(3.56, 0.75) \u003e 𝑡⁺𝜎ₓ + 𝜇ₓ) = 0.458.\n\n### P-value\n\n```python\n\u003e\u003e\u003e from chiscore import optimal_davies_pvalue\n\u003e\u003e\u003e q = [1.5, 3.0]\n\u003e\u003e\u003e mu = -0.5\n\u003e\u003e\u003e var = 1.0\n\u003e\u003e\u003e kur = 3.0\n\u003e\u003e\u003e w = [10.0, 0.2, 0.1, 0.3]\n\u003e\u003e\u003e remain_var = 0.5\n\u003e\u003e\u003e df = 3.4\n\u003e\u003e\u003e trho = [5.1, 0.2]\n\u003e\u003e\u003e grid = [0., 0.01]\n\u003e\u003e\u003e optimal_davies_pvalue(q, mu, var, kur, w, remain_var, df, trho, grid)\n0.966039962464624\n```\n\n## Authors\n\n* [Danilo Horta](https://github.com/horta)\n\n## References\n\n* Lee, Seunggeun, Michael C. Wu, and Xihong Lin. \"Optimal tests for rare variant\n  effects in sequencing association studies.\" Biostatistics 13.4 (2012): 762-775.\n* Liu, H., Tang, Y., \u0026 Zhang, H. H. (2009). A new chi-square approximation to the\n  distribution of non-negative definite quadratic forms in non-central normal\n  variables. Computational Statistics \u0026 Data Analysis, 53(4), 853-856.\n\n## License\n\nThis project is licensed under the [MIT License](https://raw.githubusercontent.com/limix/chiscore/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimix%2Fchiscore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimix%2Fchiscore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimix%2Fchiscore/lists"}