# All About Bayesian: A Look At A New Statistical Model For A/B Testing

*B**y: Deborah O’Malley| 2019*

Bayesian Statistics isnâ€™t new. Itâ€™s been around for a while. Since the 1770â€™s, in fact.

But, its just now making inroads as computing capabilities improve and marketers become more savvy about proper A/B testing techniques. Case in point, A/B testing software company, Visual Website Optimizer (VWO), recently started using Bayesian Statistics in their new SmartStats A/B testing engine.*Â *

# What is Bayesian Statistics?

Bayesian statistics is a statistical model that can be applied to A/B testing to more accurately determine the precise range of your conversion rate, answering the question: â€śWhatâ€™s the probability of version B beating A?â€ť

Named after the British mathematician, Thomas Bayes, the model is based on â€śBayes Theorem,â€ť also called Bayesâ€™ Rule. The theorem is expressed with this formula:

Breaking down the formula:

- A and B are considered events
- P(A|B) is the
**conditional probability**of A occurring, given B is true - P(B|A) is the
**conditional probability**of B occurring, given A is true - P(A) is the
**prior probability**A will occur - P(B) is the
**prior probability**B will occur

Is your head spinning yet? Stick with it, itâ€™ll all makes sense in a minute. . .

First though, you need to accept the mindset that, in Bayesian reasoning, you can continually update your beliefs about data, as your gather evidence. In A/B testing, you gather evidence by running a test. After observing the evidence, your opinions may change. This is the idea behind probability.

# Probability Defined

**Probability** is an opinion, based on inference. As you gather new relevant information, you revise your opinion.

**Conditional probability **is the likelihood of an event or outcome, based on the occurrence of a previous event or outcome; the probability is contingent on previous results.

Itâ€™s easiest to understand the idea of conditional probability with a simple example.

Imagine a bag filled with three colored blocks (yellow, purple, and white). Initially, each block has an equal chance of being picked out of the bag. The *conditional probability* of drawing the yellow block is 33% (1/3). With two blocks left, thereâ€™s a 50% (1/2) chance of drawing the purple or white block. The conditional probability of drawing the purple block, after having drawn the yellow block, is 16.5% (33%*50%).

**Prior probability** is the original probability of an event, before new evidence or information is obtained. New information updates the probability, giving a more accurate measure of the outcome.

You can better understand this concept by, again, looking at our colored block example.

We know thereâ€™s three blocks; one of them is white. If all three blocks are in the bag, the conditional probability of drawing the white one is 33% (1/3). Now, imagine a block is pulled out. Itâ€™s not the white one, but we donâ€™t know what color it is. Since there are only two blocks left, the prior probability of 33% is now updated to 50% (1/2). With new evidence, we now know, weâ€™re equally likely to pull the white or other colored block. The new evidence updates the probability.

# Why Bayesian Is Better

Now, letâ€™s take these examples and bring them back to A/B testing.

In Bayesian Statistics, the probability of your hypothesis being correct is based on evolving data and informed by whatâ€™s happened up to that point. Like in the block examples, your opinion can evolve with your data. The more evidence you gather throughout your experiment, the better, and more accurately, you can confirm or deny expectations. Talk about a forgiving and flexible model.

Thereâ€™s not this kind of flexibility in traditional testing, rooted in Frequentist Statistics. Things are much more black and white. You can only reject the null hypothesis. So, you can only say, for example, variant A did not equal variant B, as calculated by a 0.02 p-value (significance level).

But, in Bayesian statistics, thereâ€™s no significance level because youâ€™re not confirming or rejecting the null hypothesis. Instead, youâ€™re using probability to calculate future outcomes.

# Bayesian Statistics Allows You To Calculate A Precise Range

With this approach, itâ€™s possible to determine the precise range of your conversion rate, answering an essential question: â€śWhatâ€™s the probability the new version will outperform the old?â€ť Bayesian statistics enables you to confidently say, for example, â€śthereâ€™s an 95% chance variant B has a 7% uplift over variant A.â€ť

In Frequentist Statistics, thereâ€™s no way to answer this question. You can only say the two variants do not perform equally. If your results are inconclusive, tough. You have no idea why, or by how much. You have to re-test and hope for the best.

# Sample Size Doesnâ€™t Matter

Whatâ€™s also great about Bayesian Statistics is you can accurately run A/B tests, irrespective of size sample because your observations are always evolving. So, you donâ€™t have to worry about calculating sample size in advance. And, you donâ€™t have spend weeks or months running a test to get valid results, if traffic is low on your site.

# Donâ€™t Peek, Donâ€™t Worry

Bayesian statistics also mitigates some methodology errors made during A/B testing, so, even if you peek at your test early, results remain still statistically sound. And, you donâ€™t have to worry about falsely declaring a winner before the test is done because youâ€™re not relying on statistical significance.

# So, What Can You Do With All This Information?

First off, know that using Frequentist statistics isnâ€™t wrong or bad. Itâ€™s just not entirely the right approach with A/B testing.

As Chris Stucchio, VWOâ€™s former Director of Data Sciences remarked:

*Frequentist statistics provides probabilities about hypothetical experiments, which is unintuitive when trying to get real-life results. But, the approach is popular because computing with the frequentist method is easy. Frequentist methods can be computed in microseconds, while Bayesian methods can take many minutes. And, ten years ago, it probably wouldnâ€™t have even been possible to compute with Bayesian statistics, at least at the scale thatâ€™s being done today.*

The Bayesian approach, however, delivers more concrete, easily understandable results, helping you call a winning variant with greater clarity and confidence, in less time.

Some other benefits of the Bayesian model are it:

- Letâ€™s you calculate the highest probability winner, clearly stating the exact performance of one variant over the other
- Enables you to easily evolve your site with your changing customer base, since probabilities are updated as data is obtained

But, some drawbacks are it:

- Is very complex and confusing, if youâ€™re not a skilled statistician
- Takes a lot of computing power

In the near future, it’s likely the Bayesian model will come into the mainstream and more tests will be run using Bayesian statistics.

What do you think?Â Do you use a Bayesian approach? What do you think of it? What are some of the benefits and challenges?

Let us know in the comments section below.

## COMMENTS: Tell Us Your Thoughts.