Skip to main content

A Python package for the statistical analysis of A/B tests.

Project description

tea-tasting: statistical analysis of A/B tests

CI Coverage License Version Package Status PyPI Python Versions

tea-tasting is a Python package for the statistical analysis of A/B tests featuring:

  • Student's t-test, Z-test, Bootstrap, and quantile metrics out of the box.
  • Extensible API: define and use statistical tests of your choice.
  • Delta method for ratio metrics.
  • Variance reduction with CUPED/CUPAC (also in combination with the delta method for ratio metrics).
  • Confidence intervals for both absolute and percentage change.
  • Sample ratio mismatch check.
  • Power analysis.
  • Multiple hypothesis testing (family-wise error rate and false discovery rate).

tea-tasting calculates statistics directly within data backends such as BigQuery, ClickHouse, PostgreSQL, Snowflake, Spark, and 20+ other backends supported by Ibis. This approach eliminates the need to import granular data into a Python environment, though Pandas DataFrames are also supported.

Check out the blog post explaining the advantages of using tea-tasting for the analysis of A/B tests.

Installation

pip install tea-tasting

Basic example

import tea_tasting as tt


data = tt.make_users_data(seed=42)

experiment = tt.Experiment(
    sessions_per_user=tt.Mean("sessions"),
    orders_per_session=tt.RatioOfMeans("orders", "sessions"),
    orders_per_user=tt.Mean("orders"),
    revenue_per_user=tt.Mean("revenue"),
)

result = experiment.analyze(data)
print(result)
#>             metric control treatment rel_effect_size rel_effect_size_ci pvalue
#>  sessions_per_user    2.00      1.98          -0.66%      [-3.7%, 2.5%]  0.674
#> orders_per_session   0.266     0.289            8.8%      [-0.89%, 19%] 0.0762
#>    orders_per_user   0.530     0.573            8.0%       [-2.0%, 19%]  0.118
#>   revenue_per_user    5.24      5.73            9.3%       [-2.4%, 22%]  0.123

Learn more in the detailed user guide. Additionally, see the guides on data backends, power analysis, multiple hypothesis testing, and custom metrics.

Roadmap

  • Support more dataframes with Narwhals.
  • A/A tests and simulations.
  • More statistical tests:
    • Asymptotic and exact tests for frequency data.
    • Mann–Whitney U test.
  • Sequential testing.

Package name

The package name "tea-tasting" is a play on words that refers to two subjects:

  • Lady tasting tea is a famous experiment which was devised by Ronald Fisher. In this experiment, Fisher developed the null hypothesis significance testing framework to analyze a lady's claim that she could discern whether the tea or the milk was added first to the cup.
  • "tea-tasting" phonetically resembles "t-testing" or Student's t-test, a statistical test developed by William Gosset.

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

tea_tasting-0.2.0.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

tea_tasting-0.2.0-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file tea_tasting-0.2.0.tar.gz.

File metadata

  • Download URL: tea_tasting-0.2.0.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.21.0 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for tea_tasting-0.2.0.tar.gz
Algorithm Hash digest
SHA256 39337c33201eb46c950672fb93fffb3532e8ef77d54bfb10219dc13cf8abaac8
MD5 6297ca125b3619dd7fd2f5470693b275
BLAKE2b-256 6f94a9b043114bb3bc408162eb9af7da563e4e28170304cf89e33c5a073e3a2e

See more details on using hashes here.

File details

Details for the file tea_tasting-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tea_tasting-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.21.0 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for tea_tasting-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cae4239d8f27fb0745c85c99127fdcee7dd0a338eaf5b04ed55874d4d9d7d3ef
MD5 9eda55ae6ac702b6248cde962875a8bf
BLAKE2b-256 36628470760406bd6741a7d0a7e02df0dd1410d99e21ffce442ed287e4b84b62

See more details on using hashes here.

Supported by

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