A python module implementing power analysis to estimate sample size
Project description
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.7.1, <3.11
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-size
all 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sample_size-3.0.0.tar.gz
.
File metadata
- Download URL: sample_size-3.0.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.7.15 Linux/5.15.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1eb4c16a62cf691bca54046d9afde64bc6ae759af21b179e6354b04cf09401e2 |
|
MD5 | 38cd321a848d08a215adcd1c20ee5fdb |
|
BLAKE2b-256 | 43abc04e47c225d4341905f4e5fbc975ee9abf7c7766a0e2b820002c7717bedf |
File details
Details for the file sample_size-3.0.0-py3-none-any.whl
.
File metadata
- Download URL: sample_size-3.0.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.7.15 Linux/5.15.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2df8a5f5ff5f73598b35b2dcc74b3458fd65f1df0fec40a8783a88463d9fa6e |
|
MD5 | a951d6465656937ba47ff73c96f79789 |
|
BLAKE2b-256 | 59586f8e9063b2ef5db954618c04be8019ca9649b0b91d98f8c0682f1e3cc2a5 |