Bayesian Statistics calculator

Bayesian A/B testing calculator

Calculate Bayesian posterior probabilities, probability of B beating A, expected loss, and Beta-Binomial credible intervals for A/B conversion experiments.

Run this test live in StatLab npm i @statlab/core

When to use it

Use when you need intuitive probability statements (e.g. "99% chance B is better than A") and expected loss risk bounds.

Required Inputs

  • Control sample N & conversions
  • Variant sample N & conversions
  • Prior Alpha & Beta (e.g. Beta(1,1))
  • Monte Carlo simulation draws (e.g. 50,000)

Mathematical Formula

Posterior ~ Beta(α + successes, β + failures), P(B > A) = ∫ P(θ_B > θ_A | data) dθ

Reporting Cautions

  • Posterior results depend on prior distributions when sample sizes are small.
  • Report expected loss alongside win probability to avoid deciding on trivial uplifts.

Code Snippets (Python, R, TypeScript)

Python (SciPy / Statsmodels)
import scipy.stats as stats
import numpy as np
a_draws = stats.beta.rvs(1 + 850, 1 + 9150, size=50000)
b_draws = stats.beta.rvs(1 + 960, 1 + 9040, size=50000)
prob_b_wins = np.mean(b_draws > a_draws)
print(f"P(B > A) = {prob_b_wins:.4f}")
R Language
a_draws <- rbeta(50000, 851, 9151)
b_draws <- rbeta(50000, 961, 9041)
mean(b_draws > a_draws)
TypeScript (@statlab/core)
import { bayesianAbTest } from '@statlab/core';
const res = bayesianAbTest({ a: { n: 10000, conv: 850 }, b: { n: 10000, conv: 960 } });

Developer Use Cases & Production Integrations

  • Automating continuous Bayesian decision boundaries in VoxelPulse experiment engines without p-value peeking penalties.
  • Evaluating real-time feature flag rollout confidence in live production.

VoxelPulse Telemetry Control Plane

Continuous A/B testing, statistical telemetry analysis, and automated feedback loops for live backend services.

Explore VoxelPulse →

VoxelAssurance Release Readiness

Fixed-price AI release-readiness sprints, automated regression testing, and reliability statistical benchmarks.

Explore VoxelAssurance →

Related Statistical Test Calculators

Explore static calculators across the StatLab inference engine suite.