# chi2sim
Chi-square test with Monte Carlo simulation for contingency tables.
The package and its documentation are still under construction.
## Description
The `chi2sim` package is a Python implementation that contains the translation of R's H tests for contingency tables when `simulate.p.value = TRUE`, originally written in C and based on Patefield's (1981) FORTRAN algorithm. The package provides a fast and reliable method to compute p-values for chi-square tests using Monte Carlo simulation.
## Installation
```bash
pip install chi2sim
```
## Usage
```python
import numpy as np
from chi2sim import chi2_cont_sim
# Example contingency table
table = np.array([
[10, 5],
[20, 15]
], dtype=int)
# Perform chi-square test with Monte Carlo simulation
result = chi2_cont_sim(table)
print(result)
```
## Features
- Similar to SciPy's `scipy.stats.chi2_contingency`, but returns
- Monte Carlo simulation for p-value approximation
- Easy-to-use Python interface
## Requirements
- Python >= 3.9
- NumPy >= 1.15.0
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Citation
If you use the `chi2sim` package in your study, please don't forget to cite the following literatures:
- Hope, A. C. A. (1968). A simplified Monte Carlo significance test procedure. Journal of the Royal Statistical Society Series B, 30, 582–598. doi:10.1111/j.2517-6161.1968.tb00759.x.
- Patefield, W. M. (1981). Algorithm AS 159: An efficient method of generating r x c tables with given row and column totals. Applied Statistics, 30, 91–97. doi:10.2307/2346669.
Raw data
{
"_id": null,
"home_page": null,
"name": "chi2sim",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "statistics, chi-square, monte-carlo, simulation",
"author": null,
"author_email": "Joshua Marie Ongcoy <joshstat126@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a9/bd/97445e76803142507bfe17e993d79af1dc181d9ca46d216657c2a2575c94/chi2sim-1.0.2.3.tar.gz",
"platform": null,
"description": "# chi2sim\r\n\r\nChi-square test with Monte Carlo simulation for contingency tables.\r\nThe package and its documentation are still under construction.\r\n\r\n## Description\r\n\r\nThe `chi2sim` package is a Python implementation that contains the translation of R's H tests for contingency tables when `simulate.p.value = TRUE`, originally written in C and based on Patefield's (1981) FORTRAN algorithm. The package provides a fast and reliable method to compute p-values for chi-square tests using Monte Carlo simulation.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install chi2sim\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nimport numpy as np\r\nfrom chi2sim import chi2_cont_sim\r\n\r\n# Example contingency table\r\ntable = np.array([\r\n [10, 5],\r\n [20, 15]\r\n], dtype=int)\r\n\r\n# Perform chi-square test with Monte Carlo simulation\r\nresult = chi2_cont_sim(table)\r\nprint(result)\r\n```\r\n\r\n## Features\r\n\r\n- Similar to SciPy's `scipy.stats.chi2_contingency`, but returns \r\n- Monte Carlo simulation for p-value approximation\r\n- Easy-to-use Python interface\r\n\r\n## Requirements\r\n\r\n- Python >= 3.9\r\n- NumPy >= 1.15.0\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n\r\n## Citation\r\n\r\nIf you use the `chi2sim` package in your study, please don't forget to cite the following literatures:\r\n\r\n- Hope, A. C. A. (1968). A simplified Monte Carlo significance test procedure. Journal of the Royal Statistical Society Series B, 30, 582\u2013598. doi:10.1111/j.2517-6161.1968.tb00759.x.\r\n\r\n- Patefield, W. M. (1981). Algorithm AS 159: An efficient method of generating r x c tables with given row and column totals. Applied Statistics, 30, 91\u201397. doi:10.2307/2346669.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Chi-square test with Monte Carlo simulation",
"version": "1.0.2.3",
"project_urls": {
"Bug Tracker": "https://github.com/kisha126/chi2sim/issues",
"Documentation": "https://github.com/kisha126/chi2sim#readme",
"Homepage": "https://github.com/kisha126/chi2sim"
},
"split_keywords": [
"statistics",
" chi-square",
" monte-carlo",
" simulation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0746f372f9bd77016d8a5440f84fa859a8497bf520c5f694f39f34d34a676278",
"md5": "7dd91da640b75f5ce21c8f6fa2495667",
"sha256": "84d185cda051e5d3b90b7593e77d9803ca453b4d77cf8817e37efbea488a74ab"
},
"downloads": -1,
"filename": "chi2sim-1.0.2.3-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "7dd91da640b75f5ce21c8f6fa2495667",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.7",
"size": 100493,
"upload_time": "2024-10-30T04:43:00",
"upload_time_iso_8601": "2024-10-30T04:43:00.117857Z",
"url": "https://files.pythonhosted.org/packages/07/46/f372f9bd77016d8a5440f84fa859a8497bf520c5f694f39f34d34a676278/chi2sim-1.0.2.3-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a9bd97445e76803142507bfe17e993d79af1dc181d9ca46d216657c2a2575c94",
"md5": "36bbd2916a4a56a406a590b2c2a48377",
"sha256": "ac7f22837c56d8e0572b9338be4cdc566ecc8f10a16cd1c6926d4677d0d7a491"
},
"downloads": -1,
"filename": "chi2sim-1.0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "36bbd2916a4a56a406a590b2c2a48377",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 72755,
"upload_time": "2024-10-30T04:43:03",
"upload_time_iso_8601": "2024-10-30T04:43:03.080876Z",
"url": "https://files.pythonhosted.org/packages/a9/bd/97445e76803142507bfe17e993d79af1dc181d9ca46d216657c2a2575c94/chi2sim-1.0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-30 04:43:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kisha126",
"github_project": "chi2sim",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "chi2sim"
}