Skip to content

Repository files navigation

Bayesian binomial test using WebAssembly

Demo

A/B test significance judgement using bayesian beta-binomial distribution is simple. In Python, we can do that like:

importnumpyasnpalpha_prior=1.0beta_prior=1.0n_events_a=100n_success_a=30n_events_b=10n_success_b=5n_samples=10000rng=np.random.default_rng(0)
posterior_a=rng.beta(alpha_prior+n_success_a, beta_prior+n_events_a-n_success_a, size=n_samples)
posterior_b=rng.beta(alpha_prior+n_success_b, beta_prior+n_events_b-n_success_b, size=n_samples)
# 0.90576
(posterior_a<posterior_b).mean()

This simple demo visualizes the Bayesian binomial test, using Rust + WebAssembly to sample from the posterior distribution (obviously overkill, but fun).

All calculator inputs are stored in the URL query string, so a calculation can be bookmarked or shared as-is.

Development

The frontend uses Vue 3 and pnpm. With pnpm and wasm-pack installed:

pnpm install
pnpm dev

This should work off-line. Get a single HTML file from the latest release.

A similar application that influcend this project can be found here.

About

Simple Bayesian A/B testing utility made with Rust + WebAssembly and Vue.js

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages