Ezpwr
Ezpwr is a Python package for statistical power analysis that allows users to estimate sample size, test power, and effect size.
简体中文 | English
🗺️ Feature List & Roadmap: To see currently supported statistical models and planned features, check out roadmap.
📦 Installation
Prerequisites: Python 3.10+
pip install ezpwr
🚀 Usage Examples
Sample Size Estimation
-
Single Proportion Confidence Interval
from ezpwr import proportion size = proportion.single.ci.solve_size( proportion=0.9, distance=0.10, conf_level=0.95, interval_type="two-sided", ) print(size) # output: 158
-
Single Proportion Inequality Test
from ezpwr import proportion size = proportion.single.inequality.solve_size( null_proportion=0.80, proportion=0.95, alternative="one-sided", alpha=0.025, power=0.8, ) print(size) # output: 42
-
Two Independent Proportions Non-Inferiority Test
from ezpwr import proportion size = proportion.independent.noninferiority.solve_size( treatment_proportion=0.95, reference_proportion=0.90, margin=-0.10, ratio=1, alpha=0.025, power=0.8, ) print(size) # output: (48, 48)
-
Two Independent Means Superiority Test
from ezpwr import mean size = mean.independent.superiority.solve_size( diff=0.5, margin=0.1, treatment_std=1.2, reference_std=1.2, ratio=2, alpha=0.025, power=0.8, ) print(size) # output: (214, 107)
Statistical Power Calculation
from ezpwr import proportion
power = proportion.independent.noninferiority.solve_power(
treatment_proportion=0.95,
reference_proportion=0.90,
margin=-0.10,
treatment_size=48,
reference_size=48,
alpha=0.025,
)
print(power)
# output: 0.800282915718918
Effect Size Solving
from ezpwr import proportion
treatment_proportion = proportion.independent.noninferiority.solve_treatment_proportion(
reference_proportion=0.90,
margin=-0.10,
treatment_size=48,
reference_size=48,
alpha=0.025,
power=0.8,
)
print(treatment_proportion)
# output: 0.9499637015276098
🧪 Compatibility Matrix
| 🐍 3.10 | 🐍 3.11 | 🐍 3.12 | 🐍 3.13 | 🐍 3.14 | |
|---|---|---|---|---|---|
| SciPy 1.7 | ✅ | - | - | - | - |
| SciPy 1.8 | ✅ | - | - | - | - |
| SciPy 1.9 | ✅ | - | - | - | - |
| SciPy 1.10 | ✅ | ✅ | - | - | - |
| SciPy 1.11 | ✅ | ✅ | ✅ | - | - |
| SciPy 1.12 | ✅ | ✅ | ✅ | - | - |
| SciPy 1.13 | ✅ | ✅ | ✅ | - | - |
| SciPy 1.14 | ✅ | ✅ | ✅ | - | - |
| SciPy 1.15 | ✅ | ✅ | ✅ | ✅ | - |
| SciPy 1.16 | - | ✅ | ✅ | ✅ | ✅ |
| SciPy 1.17 | - | ✅ | ✅ | ✅ | ✅ |
| SciPy 1.18 | - | - | ✅ | ✅ | ✅ |
[!NOTE]
-: This combination of Python and SciPy does not exist.
✨ Contributing
Issues and pull requests are welcome and highly appreciated. To get started, check out the contributing guidelines.
🤝 Acknowledgments
Metadata
Release files for ezpwr 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ezpwr-0.0.8.tar.gz | 54.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ezpwr-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 131.5 kB
Release files / ezpwr-0.0.8.tar.gz
| Download URL | ezpwr-0.0.8.tar.gz |
|---|---|
| Size | 54.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6178310564f70f187fff9317d92a2402730c45f2f4fd942c69500064757e578d
|
|
BLAKE2b-256 checksum How to use checksums |
1e93573f9aa00c41a87b2b8bdfb0d598f624506d41ac311b95cb3a446c0c16a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ezpwr-0.0.8-py3-none-any.whl
| Download URL | ezpwr-0.0.8-py3-none-any.whl |
|---|---|
| Size | 77.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3e30bada156ed28c48c6521d7dd3793180bcd6a539d751adac1896495024b9d
|
|
BLAKE2b-256 checksum How to use checksums |
2d77b4fd3de8ae38ff33f108e5f7b6d6bd20ea9de719cc717165b6e6a78df129
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|