# PyStatPower
[![PyPI - Version](https://img.shields.io/pypi/v/pystatpower)](https://badge.fury.io/py/pystatpower)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pystatpower)
![GitHub License](https://img.shields.io/github/license/Snoopy1866/pystatpower)
![PyPI - Status](https://img.shields.io/pypi/status/pystatpower)
![PyPI - Downloads](https://img.shields.io/pypi/dm/pystatpower)
[![Build Status](https://img.shields.io/github/actions/workflow/status/Snoopy1866/pystatpower/release.yml?branch=main&label=build)](https://github.com/Snoopy1866/pystatpower/actions/workflows/release.yml?query=branch:main)
[![Test Status](https://img.shields.io/github/actions/workflow/status/Snoopy1866/pystatpower/check.yml?branch=main&label=test)](https://github.com/Snoopy1866/pystatpower/actions/workflows/check.yml?query=branch:main)
[![Documentation Status](https://readthedocs.org/projects/pystatpower/badge/?version=latest)](https://pystatpower.readthedocs.io/zh-cn/latest/?badge=latest)
[![codecov](https://codecov.io/gh/Snoopy1866/pystatpower/graph/badge.svg?token=P9UWC8Q4P6)](https://codecov.io/gh/Snoopy1866/pystatpower)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Snoopy1866/pystatpower/main.svg)](https://results.pre-commit.ci/latest/github/Snoopy1866/pystatpower/main)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pytest](https://img.shields.io/badge/logo-pytest-blue?logo=pytest&labelColor=5c5c5c&label=%20)](https://github.com/pytest-dev/pytest)
[![sphinx](https://img.shields.io/badge/logo-sphinx-blue?logo=sphinx&labelColor=5c5c5c&label=%20)](https://github.com/sphinx-doc/sphinx)
[简体中文](README.md) | [English](README-en.md)
PyStatPower 是一个专注于统计领域功效分析的开源的 Python 库。
主要功能:样本量和检验效能的计算,以及给定参数下估算所需效应量大小。
## 安装
```bash
pip install pystatpower
```
## 示例
```python
from pystatpower.models import one_proportion
result = one_proportion.solve_for_sample_size(
alpha=0.05, power=0.80, nullproportion=0.80, proportion=0.95, alternative="two_sided", test_type="exact_test"
)
print(result)
```
输出:
```python
Size(41.59499160228066)
```
## 构建
1. 克隆本仓库
```bash
git clone https://github.com/Snoopy1866/pystatpower.git
```
2. 安装依赖
```bash
pip install .[docs]
```
3. 安装 pre-commit
```bash
pre-commit install
pre-commit install --hook-type commit-msg
```
4. 切换到文档目录
```bash
cd docs
```
5. 构建文档
```bash
make clean
make html
```
你可以在 `docs/build/html` 目录下看到生成的文档,双击 `index.html` 即可在浏览器中查看。
## 鸣谢
- [scipy](https://github.com/scipy/scipy)
- [pingouin](https://github.com/raphaelvallat/pingouin)
Raw data
{
"_id": null,
"home_page": null,
"name": "pystatpower",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "mathematics, statistics, power analysis, sample size, power, hypothesis",
"author": null,
"author_email": "Snoopy1866 <pystatpower@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/29/c0/f3d8ab6462d3b21562aa45e4d7b39715dda9a29459c180f37f83b4fb867b/pystatpower-0.0.3.tar.gz",
"platform": null,
"description": "# PyStatPower\n\n[![PyPI - Version](https://img.shields.io/pypi/v/pystatpower)](https://badge.fury.io/py/pystatpower)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pystatpower)\n![GitHub License](https://img.shields.io/github/license/Snoopy1866/pystatpower)\n![PyPI - Status](https://img.shields.io/pypi/status/pystatpower)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/pystatpower)\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/Snoopy1866/pystatpower/release.yml?branch=main&label=build)](https://github.com/Snoopy1866/pystatpower/actions/workflows/release.yml?query=branch:main)\n[![Test Status](https://img.shields.io/github/actions/workflow/status/Snoopy1866/pystatpower/check.yml?branch=main&label=test)](https://github.com/Snoopy1866/pystatpower/actions/workflows/check.yml?query=branch:main)\n[![Documentation Status](https://readthedocs.org/projects/pystatpower/badge/?version=latest)](https://pystatpower.readthedocs.io/zh-cn/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/Snoopy1866/pystatpower/graph/badge.svg?token=P9UWC8Q4P6)](https://codecov.io/gh/Snoopy1866/pystatpower)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Snoopy1866/pystatpower/main.svg)](https://results.pre-commit.ci/latest/github/Snoopy1866/pystatpower/main)\n\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![pytest](https://img.shields.io/badge/logo-pytest-blue?logo=pytest&labelColor=5c5c5c&label=%20)](https://github.com/pytest-dev/pytest)\n[![sphinx](https://img.shields.io/badge/logo-sphinx-blue?logo=sphinx&labelColor=5c5c5c&label=%20)](https://github.com/sphinx-doc/sphinx)\n\n[\u7b80\u4f53\u4e2d\u6587](README.md) | [English](README-en.md)\n\nPyStatPower \u662f\u4e00\u4e2a\u4e13\u6ce8\u4e8e\u7edf\u8ba1\u9886\u57df\u529f\u6548\u5206\u6790\u7684\u5f00\u6e90\u7684 Python \u5e93\u3002\n\n\u4e3b\u8981\u529f\u80fd\uff1a\u6837\u672c\u91cf\u548c\u68c0\u9a8c\u6548\u80fd\u7684\u8ba1\u7b97\uff0c\u4ee5\u53ca\u7ed9\u5b9a\u53c2\u6570\u4e0b\u4f30\u7b97\u6240\u9700\u6548\u5e94\u91cf\u5927\u5c0f\u3002\n\n## \u5b89\u88c5\n\n```bash\npip install pystatpower\n```\n\n## \u793a\u4f8b\n\n```python\nfrom pystatpower.models import one_proportion\n\nresult = one_proportion.solve_for_sample_size(\n alpha=0.05, power=0.80, nullproportion=0.80, proportion=0.95, alternative=\"two_sided\", test_type=\"exact_test\"\n)\nprint(result)\n```\n\n\u8f93\u51fa:\n\n```python\nSize(41.59499160228066)\n```\n\n## \u6784\u5efa\n\n1. \u514b\u9686\u672c\u4ed3\u5e93\n\n ```bash\n git clone https://github.com/Snoopy1866/pystatpower.git\n ```\n\n2. \u5b89\u88c5\u4f9d\u8d56\n\n ```bash\n pip install .[docs]\n ```\n\n3. \u5b89\u88c5 pre-commit\n\n ```bash\n pre-commit install\n pre-commit install --hook-type commit-msg\n ```\n\n4. \u5207\u6362\u5230\u6587\u6863\u76ee\u5f55\n\n ```bash\n cd docs\n ```\n\n5. \u6784\u5efa\u6587\u6863\n\n ```bash\n make clean\n make html\n ```\n\n\u4f60\u53ef\u4ee5\u5728 `docs/build/html` \u76ee\u5f55\u4e0b\u770b\u5230\u751f\u6210\u7684\u6587\u6863\uff0c\u53cc\u51fb `index.html` \u5373\u53ef\u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u3002\n\n## \u9e23\u8c22\n\n- [scipy](https://github.com/scipy/scipy)\n- [pingouin](https://github.com/raphaelvallat/pingouin)\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "A Power Analysis Toolkit for Python",
"version": "0.0.3",
"project_urls": {
"Changelog": "https://github.com/Snoopy1866/pystatpower/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/Snoopy1866/pystatpower/blob/main/README.md",
"Homepage": "https://github.com/Snoopy1866/pystatpower",
"Issues": "https://github.com/Snoopy1866/pystatpower/issues",
"Repository": "https://github.com/Snoopy1866/pystatpower.git"
},
"split_keywords": [
"mathematics",
" statistics",
" power analysis",
" sample size",
" power",
" hypothesis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1294cd5d8b3c2ed282d4282673e508266fdc33bfdd3cd8ca9e710c0395d07bf4",
"md5": "9194b7c584a8d65297ba8aedd760f9d7",
"sha256": "20675fec653f73c801fea57d4eaf5a573ef02ba03a8b4a74591635467f568e15"
},
"downloads": -1,
"filename": "pystatpower-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9194b7c584a8d65297ba8aedd760f9d7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 26032,
"upload_time": "2024-11-27T06:27:41",
"upload_time_iso_8601": "2024-11-27T06:27:41.444358Z",
"url": "https://files.pythonhosted.org/packages/12/94/cd5d8b3c2ed282d4282673e508266fdc33bfdd3cd8ca9e710c0395d07bf4/pystatpower-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "29c0f3d8ab6462d3b21562aa45e4d7b39715dda9a29459c180f37f83b4fb867b",
"md5": "4ee8629f28e97ffdf552b7e3617572df",
"sha256": "a9258d8e03a6fd6853d0d5354e20daf75e09e10f7f08a307a40f79cb7b4e0684"
},
"downloads": -1,
"filename": "pystatpower-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "4ee8629f28e97ffdf552b7e3617572df",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 28045,
"upload_time": "2024-11-27T06:27:43",
"upload_time_iso_8601": "2024-11-27T06:27:43.396257Z",
"url": "https://files.pythonhosted.org/packages/29/c0/f3d8ab6462d3b21562aa45e4d7b39715dda9a29459c180f37f83b4fb867b/pystatpower-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 06:27:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Snoopy1866",
"github_project": "pystatpower",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pystatpower"
}