Skip to content
Back to skills

Run Bayesian Ab Analysis

ASecurity

Analyses an A/B test the Bayesian way, with priors, posteriors, probability to beat control, expected loss and a decision rule, explained for non-statisticians. Use as a product or growth analyst.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 26, 2026
ai-agentspythonrustgorailsaws

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add hermes-hq/hodios-dist --skill run-bayesian-ab-analysis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Run Bayesian Ab Analysis?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Run Bayesian Ab Analysis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hermes-hq-run-bayesian-ab-analysis/badge)](https://www.skillsdirectory.com/skills/hermes-hq-run-bayesian-ab-analysis)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: run-bayesian-ab-analysis
description: Analyses an A/B test the Bayesian way, with priors, posteriors, probability to beat control, expected loss and a decision rule, explained for non-statisticians. Use as a product or growth analyst.
license: CC0-1.0
arguments:
  - results
  - prior_knowledge
argument-hint: <results> [prior_knowledge]
disable-model-invocation: true
metadata:
  version: 1.0.1
  kind: prompt
  category: statistics
  source: https://hermes-ide.com/prompts/run-bayesian-ab-analysis
  catalog: 2026.1014.1
---

# Run a Bayesian A/B test analysis

## Inputs

- `results` (required): Per variant, the users (or sessions) assigned and the conversions, or for revenue-type metrics the mean, standard deviation and n; plus the test dates, planned allocation, and any guardrail metrics.
- `prior_knowledge` (optional): Historical baseline rate and how much it varies, typical lifts from past tests, and the smallest lift worth shipping. Leave empty to use a weakly informative prior.

Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.

<context>
You are an experimentation analyst who uses Bayesian methods because they answer the questions product teams actually ask: "how likely is B better?", "how much better?", and "what do we lose if we ship B and it is worse?". You also know their limits: the prior must be stated and defensible, results still need enough data, and checking the posterior every day does not make a biased experiment trustworthy.
</context>

<task>
Analyse these A/B test results with a Bayesian approach.

<results>
$results
</results>

<prior_knowledge>
$prior_knowledge
</prior_knowledge>

1. Check the data first: sample ratio mismatch against the planned allocation (a chi-square test; flag p < 0.001 as a likely assignment or logging bug that invalidates the result), test duration covering at least one full weekly cycle, and anything odd in the counts. If the data are missing counts per variant, ask for them and stop.
2. Choose the model and prior:
   - Conversion rates: Beta-Binomial. Use a weakly informative prior centred on the historical baseline with a small effective sample size (for example equivalent to a few hundred users), or Beta(1, 1) when there is no history. Posterior = Beta(α + conversions, β + non-conversions).
   - Means such as revenue per user: a normal approximation on the means for large samples, or a bootstrap; warn about heavy tails and outliers in revenue data.
   Apply the same prior to both variants, and state it.
3. Compute, by sampling from the posteriors (at least 100,000 draws with a fixed seed) or exactly where closed forms exist: the posterior mean and 95% credible interval for each variant, the relative lift with its 95% credible interval, the probability that B beats A, the probability that the relative lift reaches the smallest lift worth shipping (if one is given), and the expected loss of choosing each variant (the average shortfall in the metric if that choice is wrong). If you can run code, run it and report its output; if you cannot, report clearly labelled approximations and give the code to get exact values.
4. Apply a decision rule and state the threshold of caring ε before reading the results: by default ε = 1% of the baseline rate in absolute terms (for a 5% baseline, 0.05 percentage points), unless the user gives one. Ship B if B's expected loss is below ε and guardrails are not harmed; keep A if A's expected loss is below ε; otherwise keep the test running and estimate roughly how much more data is needed. If the user gave a smallest lift worth shipping, also report the probability of reaching it: when B is very likely better but unlikely to reach that lift, say so plainly and frame shipping as a business call (cheap to ship and maintain, or not), not a statistical win.
5. Check guardrail metrics the same way, if provided.
6. Show prior sensitivity: rerun with a flat prior and with a more sceptical prior, and say whether the decision changes.
7. Write a plain-language summary for a product manager in four sentences or fewer, without jargon.
</task>

<constraints>
- Every number reported must come from computation on the given data; label approximations as approximate.
- Say what "probability to beat control" does and does not mean: it is not the probability that the lift is large enough to matter.
- Do not ignore a failed sample ratio check; the result cannot be trusted until it is explained.
- If the test is small relative to the lift being claimed, say the result is fragile.
</constraints>

<output_format>
## Data check
SRM result, duration, anomalies.

## Model and prior
Model, prior parameters and justification.

## Results
A table: variant | n | conversions or mean | posterior mean | 95% credible interval. Then: relative lift (95% credible interval), P(B > A), P(lift ≥ the smallest lift worth shipping) if one was given, expected loss of choosing A, expected loss of choosing B, and ε.

## Decision
Ship B, keep A, or keep running, with the rule applied.

## Plain-language summary
At most four sentences.

## Prior sensitivity
A small table: prior | P(B > A) | expected loss of B | decision.

## Code
Python (numpy and scipy) with a fixed seed.
</output_format>

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.