Overview
This guide explains the statistical methodology LaunchDarkly uses to calculate Bayesian experiment variation means, and how these analytics formulas are useful for validating your results. For a high-level overview of Bayesian and frequentist statistics, read Bayesian versus frequentist statistics.Core formulas
The core formulas include the posterior mean, the data mean, and the data weight. We describe these in detail below.Posterior mean
In the Bayesian approach, the main quantity we report is the mean of the posterior distribution calculated by updating the prior distribution with data observed in your experiment. At a high level, the posterior means for all experiment variations and for any metric type, including conversion metrics and numeric metrics, can be represented by a convenient formula:$$ \begin PosteriorMean = Weight \cdot DataMean + \left(1 - Weight \right) \cdot PriorMean \end - **Data mean**: The mean estimated from the data - **Prior mean**: The mean of the Bayesian prior distribution assumed for the experiment variation mean - **Weight**: A number between 0 and 1 which broadly reflects the amount of precision in our data mean. Broadly, the posterior mean is a weighted sum of the mean of the prior distribution and the mean calculated from the data. As more data arrives to the experiment, the weight increases and the posterior mean is influenced relatively more by the observed data and relatively less by the prior distribution. The specific behavior of this differs slightly between the control variation and the treatment variations, but this general principle holds for both. When you hover over the “Conversion rate” or “Posterior mean” heading in an experiment’s results table, you can view the conversion rate or posterior mean. When you hover over an actual conversion rate or posterior mean value, you can view actual numbers in the formulas instead of descriptions. ### Data mean The formula for the data mean differs between conversion metrics and numeric metrics: - **Conversion metrics**, including custom conversion binary, custom conversion count, page viewed, and clicked or tapped metrics, use the total number of conversions divided by the total number of exposures: $DataMean = SampleMean = Conversions / Exposures$ - **Numeric metrics** use the total value divided by the total number of exposures: $DataMean = SampleMean = TotalValue / Exposures$CUPED may affect the exact computation of these results. To learn more, read [Covariate adjustment and CUPED methodology](/guides/statistical-methodology/cuped). ### Data weight The precision weight is given by:$$ \begin{aligned} Weight = \frac{DataMeanPrecision} {DataMeanPrecision + PriorPrecision} \end{aligned} $$ This represents the proportion of the total precision due to the data mean. However, the precision is defined differently depending on the statistical model used. There are two statistical models for estimating the posterior mean of experiment metrics: - **Normal-normal model**: This model has a normal prior and a normal likelihood, and is used for numeric metrics. - **Beta-binomial model**: This model has a beta prior distribution and a binomial likelihood, and is used for binary metrics when [CUPED](/guides/statistical-methodology/cuped) is not applied. For the normal-normal model, precision is defined as the inverse of the variance, so that the precision weight is:$$ \begin{aligned} Weight = \frac{1 / DataMeanVariance} {1 / DataMeanVariance + 1 / PriorVariance} \end{aligned} $$For the beta-binomial model, precision is defined as the number of units for the data sample and the number of pseudo-units for the beta prior distribution. You can consider the $\alpha_{prior}$ and $\beta_{prior}$ parameters of the beta prior distribution as, respectively, the number of converted pseudo-units and the number of non-converted pseudo-units, so that the number of pseudo-units for the prior distribution is $\alpha_{prior} + \beta_{prior}$. If we denote by $n$ the number of units in the data sample, then the precision weight is given by:$$ \begin{aligned} Weight = \frac{n}{n + \alpha_{prior} + \beta_{prior}} \end{aligned}Details of our Bayesian approach
The Bayesian approach to analysis involves two steps:- Incorporating a subjective prior belief about parameters of interest, usually means, plus objective data collected during the experiment to create posterior distributions for each variation representing our current knowledge about what values those parameters are likely to take.
- Using that posterior distribution to compute helpful statistical measures that aid in making a decision about what action to take. For example, ship the treatment, don’t ship the treatment, and so on.
- Credible intervals that convey the spread of the posterior distribution, which represents the range of likely values for the true mean of the variation
- Posterior means that convey the center of the posterior distribution, which represents our current best estimate of the true meanAfter the posterior distribution is created, then it is a relatively simple procedure to compute the statistics we display on the results page to help you make a decision. To learn more about these results, read Results table data. Below we dive into detail on how we accomplish these two steps.
Calculating posterior distributions
At LaunchDarkly, we use different statistical models for binary data and numeric data. In both cases, we use conjugate distributions, meaning that the family of the prior distribution is the same as the family of the posterior distribution:- For binary metrics, we start with a Beta distribution for the prior and update that into another Beta distribution for the posterior
- For numeric metrics, we start with a Normal distribution for the prior and update that into another Normal distribution for the posteriorWe give some technical details on the exact specification of the priors below, as well as some closed-form expressions for the posterior distributions once data is incorporated.