sample-size
This python project is a helper package that uses power analysis to calculate required sample size for any experiment.
Script Usage Guide
Sample size script lets you get the sample size estimation easily by providing metric inputs.
Requirements
Please make sure you have Python 3 installed before using the script.
Verify Python was installed
python -V # python version should >=3.10, <3.13
Verify pip was installed
pip -V
Install the package
pip install sample-size
pip show sample-size # verify package was installed
Start using the script
run-sample-size will prompt required questions for you to enter the input it needs
run-sample-size
graph TD
A(Alpha) --> B(Variants)
B --> C(Metric Type)
C --> D(Metadata)
D --> E(MDE)
E --> G(Alternative)
G --> F{{Register another metric?}}
F --> C & H(Sample Size)
Script Constraints
-
This package supports
- Single and multiple metrics per calculation
- Multiple cohorts, i.e. more than one treatment variant, per calculation
- Metric types: Boolean, Numeric, and Ratio
-
Default statistical power (80%) is used in
run-sample-sizeall the time -
Input constraints
- alpha: (0, 0.4]
- probability (Boolean Metric): (0, 1)
- variance (Numeric and Ratio Metrics): [0,
)
- registered metrics: [1,
]
- variants: [2,
]
Please be aware that we are running simulations many times when calculating sample size for multiple metrics or variants. Therefore, too many cohorts or metrics will have extremely long runtime.
Contributing
All contributors and contributions are welcome! Please see the contributing docs for more information.
Metadata
Release files for sample-size 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sample_size-3.0.2.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sample_size-3.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.2 kB
Release files / sample_size-3.0.2.tar.gz
| Download URL | sample_size-3.0.2.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80478185bcff03c089e6826913568ac2c43a9c7196f67376ba0ad4aeedc295eb
|
|
BLAKE2b-256 checksum How to use checksums |
f329ff9b8aa7c6d423eda1a54bcad00ed94bb31aeb8c605a1e5646da20c9243c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.16 Linux/6.17.0-1022-azure
|
Release files / sample_size-3.0.2-py3-none-any.whl
| Download URL | sample_size-3.0.2-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b85ad97bc6f3a4aabbdb06caceac85cbe577207ece3cb3b732218bfbe726076f
|
|
BLAKE2b-256 checksum How to use checksums |
5ed7c866f480c3bf82d8c4f7b804a36ca29f7dd5bc71bc8f944746de19526ea2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.16 Linux/6.17.0-1022-azure
|