Statistics

Sample Size for Revenue and Continuous Metrics

Sample size for revenue per user comes from the coefficient of variation, not the conversion rate. The continuous formula and the common mistake.

Flat illustration of two shallow trays side by side, one holding many small identical pebbles in even rows and the other holding two very large stones among many tiny ones, in deep forest green and mint

Sample size for a continuous metric such as revenue per user does not come from the conversion rate: it comes from the coefficient of variation of the metric itself, which is the standard deviation divided by the mean. Feeding a conversion rate into a two-proportion calculator and using the answer to size a revenue test is the quietest mistake in experiment planning, because the number that comes out looks reasonable and is wrong by a factor you never see. This guide covers the continuous formula, a worked example where the same store needs 487,847 users per variant to read conversion and 761,217 to read revenue per user, the exact decomposition that explains the gap, and what capping and CUPED do to that number. It is part of our complete A/B testing guide and continues the reasoning of how many visitors an A/B test needs.

Two families of metric, two different calculations

Every experiment metric belongs to one of two families, and the family decides which sample size formula applies.

A binary metric gives each user one of two values: converted or did not, clicked or did not, came back or did not. Its mean is a proportion, and its variance is fully determined by that proportion: for a rate p, the per-user variance is p times 1 minus p. There is no free parameter here. If you know the rate, you know the variance.

A continuous metric gives each user a number that can take many values: revenue, sessions, minutes of use, items in cart, time to first action. Its mean is an ordinary average, and its variance is an independent parameter: two stores with identical average revenue per user can have completely different dispersion, and therefore need completely different sample sizes.

That is the root of the problem. The sample size calculator everyone uses, ours included, solves the binary case: you give it the baseline rate and the minimum effect you want to detect, and it returns N per variant. It cannot solve the continuous case, because the essential piece of information is missing, and that piece is dispersion. And because it returns a number without complaining, that number ends up justifying the duration of a test whose primary metric is revenue.

Binary and continuous metrics: where the variance comes fromTwo columns compared. On the left, the binary metric: each user is worth zero or one, and the variance is determined by the mean rate with no free parameter. On the right, the continuous metric: each user is worth an arbitrary number, most near zero and a few very large, and the variance is a parameter of its own that does not follow from the mean. Below each column, the information the sample size formula requires: only the rate in the binary case, rate and standard deviation in the continuous case.The sample calculation changes because variance is born in different placesbinary metricEvery user is worth 0 or 1. Per-user variance is p times 1 minus p.The rate fixes the variance. No free parameter is left.continuous metricEvery user is worth a number. Most near zero, a few far above.The mean does not fix the variance. The standard deviation is missing.the formula requiresbaseline rateminimum detectable effectthe formula requiresmean and standard deviation (or the ratio between them)minimum detectable effect
In the binary case the rate carries the variance with it. In the continuous case dispersion is new information, and it is exactly the piece nobody has at hand when planning the test.

The continuous formula, in three shapes

The sample size calculation for comparing two means on a continuous metric, under the normal approximation and with equal allocation between arms, is the familiar one with the variance in the right place:

Shape 1, with the standard deviation and the absolute effect. The number of observations per variant equals 2 times the square of the sum of the two critical values, multiplied by the variance and divided by the square of the absolute effect you want to detect. For 95 percent two-sided confidence and 80 percent power, the critical values are 1.959964 and 0.841621, whose sum squared is 7.848880. Times 2, the constant in the formula is 15.697759.

Shape 2, with the coefficient of variation and the relative effect. Dividing top and bottom by the mean makes the formula far more useful day to day, because almost everyone thinks in relative effects (“I want to detect 3 percent more revenue”), not absolute ones:

N per variant is 15.697759 times the squared coefficient of variation, divided by the squared relative effect. The coefficient of variation is the standard deviation divided by the mean. That is the only shape feature of the distribution that enters the calculation.

Shape 3, the binary case as a special case. For a binary metric with rate p, the per-user standard deviation is the square root of p times 1 minus p, and the mean is p, so the coefficient of variation is the square root of 1 minus p, divided by p. Plug that into shape 2 and you recover the proportion calculation exactly. These are not two formulas, they are one. What changes is where the coefficient of variation comes from.

Sample per variant as a function of the coefficient of variationA rising curve showing how many observations per variant are required to detect a 3 percent relative effect, as a function of the metric’s coefficient of variation. The curve is quadratic: about 17 thousand observations at a coefficient of variation of 1, 70 thousand at 2, 157 thousand at 3, 279 thousand at 4, 436 thousand at 5 and 855 thousand at 7. Two markers highlight the two cases from the worked example: conversion rate, with a coefficient of variation of 5.25 and 481 thousand observations, and revenue per user, with a coefficient of variation of 6.61 and 761 thousand observations.Doubling relative dispersion quadruples the sample, alwaysRelative effect fixed at 3 percent, 95 percent two-sided confidence, 80 percent power.conversion rate: CV 5.25 and 481k per variantrevenue per user: CV 6.61 and 761k per variantCV 1CV 2CV 3CV 4CV 5CV 6CV 717k70k157k279k628ksamplepervariantcoefficient of variation of the metric (standard deviation divided by the mean)
The curve is quadratic by construction: the coefficient of variation enters squared. That is why a long-tailed metric costs an order of magnitude more traffic than intuition suggests.

Worked example: the same store, two metrics

A store converts at 3.5 percent with an average order value of 1,200 dollars and a standard deviation of order value of 900 dollars. Average revenue per user is 0.035 times 1,200, that is 42.00 dollars. The team wants to detect a 3 percent relative gain and gets 120,000 visitors per week into the tested flow.

Step 1: the conversion metric, in the calculator

Start with the calculation the calculator does solve. Baseline rate 3.5 percent, minimum detectable effect 3 percent relative, 95 percent confidence, 80 percent power, two-sided.

Sample size calculator
-Visitors per variation
-Total (2 variations)
-Estimated duration

Two-proportion normal approximation, 2 variations (50/50). Tweak the inputs and watch it update live.

The answer is 487,847 users per variant. That is the right number for the question “does this test move the conversion rate”.

Step 2: the coefficient of variation of revenue per user

Now the revenue metric. A single user’s revenue is the product of two things: whether they bought (a binary variable with rate p) and how much they spent when they did (a variable with its own mean and standard deviation). That decomposition yields an exact identity for the coefficient of variation of revenue per user:

The squared coefficient of variation of revenue per user equals 1 plus the squared coefficient of variation of order value, all divided by the conversion rate, minus 1.

With the store’s numbers: the coefficient of variation of order value is 900 divided by 1,200, that is 0.75. So the squared coefficient of variation of revenue is 1 plus 0.5625, divided by 0.035, minus 1, which gives 43.6429. The square root is 6.6063.

It is worth checking by another route, because the identity is easy to get wrong. Computing the variance directly: mean revenue per user is 42.00 and the variance is 76,986.0, giving a standard deviation of 277.4635 and a coefficient of variation of 277.4635 divided by 42, that is 6.6063. It closes.

Step 3: the sample for the revenue metric

Applying shape 2 with a coefficient of variation of 6.6063 and a relative effect of 0.03:

15.697759 times 43.6429, divided by 0.0009, gives 761,217 observations per variant.

metric coefficient of variation N per variant days at 120k per week
conversion rate (calculator) 5.2509 487,847 57
revenue per user 6.6063 761,217 89
ratio between the two 1.2581 1.56 times +32 days
A/B test duration calculator
-Estimated duration
Total visitors-
Projected finish-

Two-proportion normal approximation, traffic split evenly across variations. The date uses your timezone and updates live.

Paste 761,217 into the sample per variant field, 2 variants and 120,000 weekly traffic to confirm the 89 days. Then switch to 487,847 and see the 57. In this store, the difference between planning the test on the wrong metric and the right one is a full month of calendar.

Step 4: why exactly 1.56 times

The ratio is not arbitrary, and it follows from the same identity. For the conversion metric, the squared coefficient of variation is 1 minus p, divided by p, which here is 27.5714 (coefficient of variation 5.2509). For revenue it is 43.6429. The ratio between the samples is the ratio between those two squares: 43.6429 divided by 27.5714, that is 1.5829.

Notice the limiting case, which is the best way to check whether the intuition holds: if everyone who buys spent exactly the same amount (order value coefficient of variation of zero), the squared coefficient of variation of revenue would drop to 1 divided by 0.035, minus 1, that is 27.5714, exactly the conversion value. Which makes sense: with no dispersion in order value, revenue per user is conversion multiplied by a constant, and multiplying by a constant changes no coefficient of variation. The entire sample surcharge comes from the dispersion of order value, and from nothing else.

standard deviation of order value CV of order value CV of revenue per user N per variant days
0 (everyone spends the same) 0.000 5.2509 480,900 57
300 0.250 5.4182 512,046 60
600 0.500 5.8919 605,486 71
900 (the store’s case) 0.750 6.6063 761,217 89
1,500 1.250 8.4979 1,259,559 147
2,400 2.000 11.9104 2,474,266 289

A note on the 1.4 percent gap

The zero row above gives 480,900, and the calculator gave 487,847 for the same scenario. The 1.44 percent difference is not an error: the continuous formula uses the variance under the alternative hypothesis in both arms, while the calculator uses the pooled form, which estimates the standard error under the null hypothesis from the average of the two rates. The pooled form is slightly more conservative and is what the two-proportion literature adopts. The gap grows with the effect: 0.96 percent at a 2 percent effect and 4.81 percent at a 10 percent effect. For planning purposes this changes no decision, but it is worth knowing where it comes from before accusing either of being wrong.

How many users the mean needs just to behave

There is a second lower bound, independent of the power calculation, and it gets skipped often: the formula above assumes the mean of the metric is approximately normal. For a heavily skewed metric, that takes far more users than the “n greater than 30” of introductory textbooks.

In the seventh rule of thumb of their KDD 2014 paper, Kohavi, Deng, Longbotham and Xu propose a minimum of 355 times the square of the skewness coefficient per variant, recommended when absolute skewness exceeds 1. They publish the table of real Bing metrics, and it reproduces the rule point by point:

Bing metric absolute skewness reported minimum sample 355 times the square sensitivity at 80% power
Revenue per user 17.9 114k 113,746 4.4%
Revenue per user (capped) 5.2 9.7k 9,599 10.5%
Sessions per user 3.6 4.70k 4,601 5.4%
Time to success 2.1 1.55k 1,566 12.3%

They further report that at a commerce site, skewness for purchases per customer exceeded 10 and for revenue per customer exceeded 30. And they add an honest caveat that is almost never quoted alongside the rule: if control and treatment have the same distribution and the split is equally sized, the distribution of the delta is approximately symmetric (perfectly symmetric under the null hypothesis), and the rule then stops providing a useful lower bound, because it was built for absolute skewness above 1. In that case the power calculation from the earlier sections is what governs. The 355 rule is the alarm for the case where you read each arm separately, or where the arms are not equally sized.

The two lower bounds on sample size and which one bites firstTwo stacked blocks. The top block represents the power bound, which grows with the squared coefficient of variation and with the inverse squared effect. The bottom block represents the normality bound on the mean, which grows with squared skewness under the 355 rule. An arrow indicates that the test size is the larger of the two numbers, never the average and never the smaller.Test size is the LARGER of the two bounds, not the more convenient onebound 1: statistical powergrows with the squared coefficient of variationgrows with the inverse squared effectanswers: can I detect the effect I care about?bound 2: normality of the meangrows with squared skewnessthe rule of 355 times squared skewnessanswers: is the p-value I read worth anything?test sample = the larger of the two
The two bounds answer different questions and do not substitute for each other. Clearing the power bound while failing the normality bound produces a p-value whose calibration nobody has checked.

Three ways to bring the number down (and what each costs)

If the number that came out is too large for your traffic, there are three legitimate levers. All of them move the coefficient of variation, because that is what governs.

1. Cap the tail

Cutting values above a ceiling drops the standard deviation far more than it drops the mean, and it is the ratio between the two that enters the calculation. Kohavi, Deng, Longbotham and Xu report that capping revenue per user at 10 dollars per user per week at Bing dropped skewness from 18 to 5.3, and that for the same sample size, capped revenue detects a 30 percent smaller change than raw revenue.

The cost is conceptual, not statistical: the capped metric answers a different question. You stop measuring revenue and start measuring revenue up to the ceiling. If the effect you are testing acts precisely in the tail (an expensive-item upsell, for instance), capping erases exactly what you wanted to see. The full treatment of that decision is in outliers and metric capping in A/B testing.

2. Reduce variance with pre-experiment data (CUPED)

Deng, Xu, Kohavi and Walker show that using a covariate measured before the experiment reduces variance by a factor of 1 minus the squared correlation between the metric and the covariate. They report roughly 50 percent variance reduction at Bing, which they describe as equivalent to doubling traffic or halving duration. They also report that the best single covariate is the same metric measured in the pre-experiment period (over 45 percent reduction in their case, against 9 to 10 percent using entry day alone, with only 2 to 3 percent extra gain from combining the two).

The most important caveat in this article comes from that same study, and it lands on exactly the metric we are dealing with. The authors report that CUPED worked well on clicks per user and visits per user, and that the notable exception was revenue per user, where variance reduction came in below 5 percent, because the correlation of revenue per user between the pre-experiment period and the experiment period is low. That makes sense: whoever spent a lot last month is not, in general, whoever will spend a lot this month. The table below shows what would happen to the store’s sample at each correlation level, and it is useful for sizing the potential gain. It is not a forecast: for revenue per user, the correlation observed in the Bing study would sit at the first row of the table or below it. Measure the correlation on your own data before counting on any of these rows.

Applied to the store example, starting from the 761,217:

correlation with the covariate variance factor N per variant days
0.5 0.750 570,913 67
0.6 0.640 487,179 57
0.7 0.510 388,221 46
0.8 0.360 274,039 32

The cost is engineering: it requires storing per-user data from the prior period and applying the adjustment in the analysis. And it requires the user to exist before the experiment, which does not hold for new visitors. Details in what is CUPED.

3. Change the primary metric

The cheapest lever and the least used. If revenue per user takes 89 days and conversion rate takes 57, and if the test hypothesis is about checkout friction (which acts on conversion, not on basket size), the honest primary metric is conversion, with revenue as a monitored secondary. This is not picking the metric that gives you the answer you want: it is picking the metric on which the mechanism you are testing actually acts. How to make that choice without fooling yourself is covered in primary metric and OEC.

Ratio metrics are a third case

There is a family that looks continuous and is neither: metrics whose denominator is not the randomized unit. Clicks per page, items per session, revenue per order. In those, each user contributes several correlated observations, and a standard error computed as if they were independent comes out smaller than the true one. The sample calculation in this article still applies, but the coefficient of variation has to be the one of the metric aggregated by randomized unit, not of the individual observation. The correct treatment is the delta method, covered in ratio metrics in A/B testing, and the unit choice that creates the problem is in randomization unit.

How to estimate the coefficient of variation before the test

All of this depends on a number you need before you start: the coefficient of variation of the metric in your own data. It is not a market benchmark, it is a property of your base. Three ways to get it, in order of preference:

  1. Compute it directly from history. Take the last 4 to 8 weeks, aggregate the metric per user over the same window the test will use, and divide the standard deviation by the mean. It is the right path and takes minutes in any data tool.
  2. Reconstruct it from the decomposition. If all you have is a conversion rate and order value statistics, use the identity from step 2: 1 plus the squared coefficient of variation of order value, divided by the rate, minus 1. You need the standard deviation of order value, not just the mean.
  3. Run an A/A test first. A two-week A/A test hands you the observed dispersion for free, along with confirmation that the randomization is sound.

What does not work is adopting a “typical” coefficient of variation. The revenue dispersion of a store selling 30-dollar items and that of a furniture store have no relationship, and the number enters the calculation squared.

Checklist before setting sample size

  1. Is the primary metric binary or continuous? If it is continuous, a proportion calculator does not answer it.
  2. Do you have its standard deviation in your own data? Without that, the number that comes out is a guess wearing the clothes of a calculation.
  3. Does the aggregation window of the estimate match the test? Revenue coefficient of variation over 7 days and over 28 days are different numbers.
  4. Does skewness exceed 1? If so, check the 355 times squared skewness rule, remembering the equal-split caveat.
  5. Is the metric’s denominator the randomized unit? If not, it is a ratio metric and needs the delta method.
  6. Did you compute both numbers, conversion and revenue? The test runs for the larger of the two, and it is better to know that beforehand.
  7. Were the reduction levers considered in the right order? Changing the primary metric is cheaper than capping, which is cheaper than implementing CUPED.

Common mistakes

Make this automatic with Donnu

The expensive error here is not getting the formula wrong, it is never noticing there were two. A revenue metric lands in the report next to a conversion metric, with the same shape, the same interval and the same color, and nothing on screen says one of them was sized and the other was not.

At Donnu, every metric declared in an experiment carries its family, and the power calculation is done per metric: a continuous metric requires an estimated dispersion from your own base, and the report shows the effective power that metric actually reached, not the power the conversion metric reached. If you want to redo any calculation by hand, the sample size calculator solves the binary case and the duration calculator turns any N into calendar days.

References

Read also: How many visitors an A/B test needs · Outliers and metric capping · What is CUPED · Ratio metrics in A/B testing · Minimum detectable effect · Sample size calculator · Leia em português

Frequently asked questions

Can I use a standard sample size calculator for revenue per user?
Not directly. A standard sample size calculator solves the two-proportion comparison, which means a binary metric such as "converted or not". Revenue per user is a continuous metric, and its variance does not come from the conversion rate: it comes from the coefficient of variation of revenue itself. Use the calculator to size the conversion metric and the continuous formula in this article to size the revenue metric. If the test carries both, the test size is the larger of the two numbers.
What is the coefficient of variation and why does it decide sample size?
The coefficient of variation is the standard deviation divided by the mean. It measures relative dispersion, and it is the only feature of the distribution that enters the sample size calculation once the effect is expressed in relative terms. The formula is n per variant equals 2 times the square of the sum of the two critical values, multiplied by the squared coefficient of variation and divided by the squared relative effect. Doubling the coefficient of variation quadruples the sample you need.
Why does revenue per user need more sample than conversion rate in the same test?
Because revenue per user stacks two sources of variation: whether the person bought (which is the conversion variation) and how much they spent when they did (which conversion does not have). The squared coefficient of variation of revenue per user equals 1 plus the squared coefficient of variation of order value, all divided by the conversion rate, minus 1. At a 3.5 percent conversion rate and an order value with a coefficient of variation of 0.75, that works out to 1.583 times the sample the conversion rate needs for the same relative effect.
How many users do I need before the mean behaves like a normal distribution?
Kohavi, Deng, Longbotham and Xu propose a minimum of 355 times the square of the skewness coefficient per variant, recommended when the absolute skewness exceeds 1. They report that revenue per user at Bing had skewness 17.9 and therefore required 114 thousand users just for the mean to behave normally. The authors themselves caveat that with an equally sized split the distribution of the delta is approximately symmetric, so the rule stops providing a useful lower bound; in that case the power calculation is what governs.
Does capping outliers reduce the sample size I need?
It does, because capping the tail cuts the standard deviation more than it cuts the mean, and it is the ratio between the two that enters the calculation. Kohavi, Deng, Longbotham and Xu report that capping revenue per user at 10 dollars per user per week at Bing dropped skewness from 18 to 5.3 and let the same sample size detect a 30 percent smaller change. The price is that the capped metric answers a different question: you stop measuring total revenue and start measuring revenue up to the ceiling you chose.
Does CUPED help when sizing a continuous metric?
It does, and this is where the gain is largest. Deng, Xu, Kohavi and Walker show that variance falls by a factor of 1 minus the squared correlation between the metric and the pre-experiment covariate, and report roughly 50 percent variance reduction at Bing, equivalent to doubling traffic or halving duration. Since sample size is proportional to variance, a correlation of 0.7 cuts the required sample by 51 percent. The important caveat comes from that same study: their notable exception was revenue per user itself, where the reduction came in below 5 percent because of the low correlation of revenue between the two periods. Measure the correlation on your own data before counting on the gain.