Catalog/stat-bayesian-ab-test

Statistics

Bayesian A/B test (Beta) API

Updates Beta posteriors for two variants from conversion counts and computes P(B beats A) by exact numerical integration plus expected lift and posterior means/variances. Answers 'What is the probability that variant B is better than A?', 'What is the expected lift in a Bayesian A/B test?'.

Price$0.1per request
MethodPOST
Route/v1/stats/bayesian-ab-test
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
statisticsbayesianab-testbetaposteriorconversionexperimentprobability
API URLhttps://x402.hexl.dev/v1/stats/bayesian-ab-test
Integration docs
Example request
{
  "successesA": 100,
  "trialsA": 1000,
  "successesB": 120,
  "trialsB": 1000
}
Example response
{
  "posteriorA": {
    "alpha": 101,
    "beta": 901,
    "mean": 0.100798,
    "var": 0.00009037
  },
  "posteriorB": {
    "alpha": 121,
    "beta": 881,
    "mean": 0.120758,
    "var": 0.00010586
  },
  "probBbeatsA": 0.923183,
  "probAbeatsB": 0.076817,
  "expectedLiftBoverA": 0.19802,
  "prior": {
    "alpha": 1,
    "beta": 1
  },
  "rating": "B likely better",
  "interpretation": "P(B > A) = 92.32%; posterior means A=0.1008, B=0.1208; expected lift 19.8%."
}
Input schema
{
  "type": "object",
  "required": [
    "successesA",
    "trialsA",
    "successesB",
    "trialsB"
  ],
  "properties": {
    "successesA": {
      "type": "integer",
      "examples": [
        100
      ]
    },
    "trialsA": {
      "type": "integer",
      "examples": [
        1000
      ]
    },
    "successesB": {
      "type": "integer",
      "examples": [
        120
      ]
    },
    "trialsB": {
      "type": "integer",
      "examples": [
        1000
      ]
    },
    "priorAlpha": {
      "type": "number",
      "examples": [
        1
      ]
    },
    "priorBeta": {
      "type": "number",
      "examples": [
        1
      ]
    },
    "samples": {
      "type": "integer",
      "examples": [
        4000
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}