Skip to main content

A Bayesian sample size calculator

Project description

BayesSizer

PyPI version Build Status

BayesSizer is a Bayesian sample size calculator. It helps data scientists and experimenters determine the required sample size for A/B tests using Bayesian inference.

Features

  • Computes Bayesian-based sample sizes for A/B testing
  • Supports configurable Type I (α) and Type II (β) error rates
  • Designed for data science and experimentation teams
  • Lightweight, simple, and efficient

Installation

Install BayesSizer from PyPI:

pip install bayessizer

Usage

from bayessizer import bayesian_sample_size

# Example: Calculate required sample size with default parameters
sample_size = bayesian_sample_size(alpha=0.05, beta=0.2, effect_size=0.1, std_dev=1)
print(f"Required sample size per group: {sample_size}")

Parameters

  • alpha (float): Type I error rate (default: 0.05)
  • beta (float): Type II error rate (default: 0.2)
  • effect_size (float): Minimum detectable effect size (default: 0.1)
  • std_dev (float): Standard deviation of the population (default: 1)

Example Output

Required sample size per group: 385

Running Tests

To ensure correctness, run:

pytest tests/

Contributing

We welcome contributions! Feel free to submit issues or pull requests.

License

This project is licensed under the MIT License.

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

bayes_sizer-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bayes_sizer-0.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file bayes_sizer-0.0.2.tar.gz.

File metadata

  • Download URL: bayes_sizer-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bayes_sizer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1cf1b7afbab3039acd5be2f4b51d003388c944cb8f42ff508b76545b26d01d6b
MD5 d426faf0cf3c96ed1ee6e1cdbb9e5817
BLAKE2b-256 51824df04362b2bd1a5aeffa1da5f8a82ca4e93d6967aceab2eb718a18d9ce30

See more details on using hashes here.

File details

Details for the file bayes_sizer-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: bayes_sizer-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bayes_sizer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 66e69fff3458a4a9dfd3dfb79ff3c227ee369e6d722fbe50c209216394a0f875
MD5 f2597af613d0d3b411fb92e0b317945e
BLAKE2b-256 15e2e487de8ec56653e9cb41075e6e3e75982f8c6d4a39118853fcae35e06ddb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page