A Python package for the statistical analysis of A/B tests.
Project description
tea-tasting: statistical analysis of A/B tests
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 using CUPED/CUPAC (which can also be combined with the delta method for ratio metrics).
- Confidence intervals for both absolute and percentage changes.
- 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, DuckDB, PostgreSQL, Snowflake, Spark, and many other backends supported by Ibis. This approach eliminates the need to import granular data into a Python environment. tea-tasting also accepts dataframes supported by Narwhals: cuDF, Dask, Modin, pandas, Polars, PyArrow.
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
- 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
Release history Release notifications | RSS feed
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 tea_tasting-0.4.0.tar.gz
.
File metadata
- Download URL: tea_tasting-0.4.0.tar.gz
- Upload date:
- Size: 48.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.1 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17032a1b153d4250c0bcb6aec04db78f2e165431acbf66a685e121b9a64afb3a |
|
MD5 | e8f4727d547cae3d40e035d70de2477f |
|
BLAKE2b-256 | 5e1c745c404fb9be666b26fdc743b78d562643865e5f5c44579170564ba5bf94 |
File details
Details for the file tea_tasting-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: tea_tasting-0.4.0-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.1 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2852f303b750ca955a3143f8bc5f4eb56868e22d25881407ddef985bda2461f3 |
|
MD5 | e7ef890b0d0c4d8947672138a6ebefe7 |
|
BLAKE2b-256 | 1f7c17baaed354ab624b2a0285142d198c35398910af1d166e95a85bf7c7d1bf |