For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.
Standard Error & Mean Variance
How Statsig computes variance for experiment metrics, including handling of ratio metrics, clustered data, and user-level aggregation across exposures.
The standard error of a group's mean measures how much that mean would vary across repeated samples. Statsig uses it to build the confidence interval and p-value for every metric delta. It equals the sample standard deviation of divided by the square root of the number of users in the group, and Pulse shows it as Std Err next to each group's units and mean. This page gives the variance formula for each metric type.
Standard deviation is the square root of the variance. Because variances are easier to manipulate algebraically, Statsig derives the variance for each metric type and then takes the square root to obtain the confidence intervals.
Computing variance
The variance of the absolute metric delta is the sum of the variances of the test and control means:
The task is therefore to compute the variance of the mean for each group.
Count and sum metrics
For count and sum metrics, Statsig derives the variance of the sample mean for a group directly from the sample variance:
where:
- is the number of users in the group.
- is the metric value for user .
- is the user-level average of for users in that group.
Ratio and mean metrics
Ratio and mean metrics combine two variables, a numerator and a denominator , which are typically correlated because both come from the same users. For example, in a clicks per session metric, clicks and sessions are two sets of observations from the same group of users, so they aren't independent. The metric has a group mean and a group variance of the mean .
To account for this correlation, Statsig obtains the variance of the mean of a ratio metric with the delta method:
where Statsig computes the variance of the numerator and denominator means with the same formula as for count and sum metrics, and the covariance is:
Was this helpful?