Bayesian A/B testing calculations for C++
Based on this post by Evan Miller
Add the header to your project (supports C++11 and greater).
There is also support for CMake and FetchContent:
include(FetchContent)
FetchContent_Declare(bayestest GIT_REPOSITORY https://github.com/ankane/bayestest-cpp.git GIT_TAG v0.2.0)
FetchContent_MakeAvailable(bayestest)
target_link_libraries(app PRIVATE bayestest::bayestest)Include the header
#include "bayestest.hpp"- Binary outcomes, like conversion rate
- Count data, like number of sales per salesperson
bayestest::BinaryTest test;
test.add(participants_a, conversions_a);
test.add(participants_b, conversions_b);
std::vector<double> probabilities = test.probabilities();Supports up to 4 variants
bayestest::CountTest test;
test.add(events_a, exposure_a);
test.add(events_b, exposure_b);
std::vector<double> probabilities = test.probabilities();Supports up to 3 variants
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/bayestest-cpp.git
cd bayestest-cpp
cmake -S . -B build
cmake --build build
build/test