sichaoj

← Back to Blog

How should we handle heavily skewed data in A/B tests?

Estimated Reading Time: 4 min | Author: Sichao (Fiona) Jiang

Context

Context: Right-skewed metrics are common in online experimentation because a small fraction of highly active users contribute disproportionately to business outcomes. Most users generate little to no activity or revenue, while a few generate exceptionally high values. Examples include revenue per user (RPU), customer lifetime value (LTV), purchase amounts, session counts, ad clicks and etc. This skewness increases variances, making it harder to detect statistically significant treatment effects without large sample sizes.

Question: How does right skewed data impact A/B test results interpretations?

In this reproducible example, I conduct the followings:

  1. Simulate two heavily right-skewed groups with various sizes.
  2. Run two-sample t-test on the original values and the logged values.
  3. Plot the p value vs mean differences for the original values vs the logged values.
  4. Compare the interpretations and implications for an A/B-test launch decision.

Simulation Results

For the code and full simulation, see LogTransform.ipynb on GitHub.

Raw and log t-test p-values by sample size. From 2,020 observations per group onward, the log-test p-values stay below 0.05 while the raw-test p-values cross that threshold several times.
Raw and log mean differences by sample size, drawn on separate vertical axes. The raw difference varies substantially, while the log difference settles near 0.30.

Simulation table

Scroll to see all 31 sample sizes. Lift is the difference in arithmetic means divided by the control mean. P-values rounded to zero in the notebook are displayed as <0.001.

Sample SizeMean DiffLog Mean DiffLiftP ValueLog P Value
20128.2380.1408.2080.1250.841
2,02043.5130.3070.3710.278<0.001
4,02030.9360.3010.2900.315<0.001
6,02032.2960.3020.3260.027<0.001
8,02014.0800.2860.1110.616<0.001
10,0203.4270.2860.0280.829<0.001
12,02038.9710.2660.3680.022<0.001
14,02055.5340.2950.5480.001<0.001
16,02045.9910.2580.501<0.001<0.001
18,02061.9520.3350.682<0.001<0.001
20,02040.1400.3100.411<0.001<0.001
22,02053.7780.3120.570<0.001<0.001
24,02038.7710.3280.374<0.001<0.001
26,02057.1030.3050.5060.181<0.001
28,02030.5390.2920.2950.004<0.001
30,02027.0600.2680.2500.030<0.001
32,02044.9570.3130.4550.001<0.001
34,02029.5410.2840.279<0.001<0.001
36,02029.5040.2880.284<0.001<0.001
38,02046.9950.3000.4680.004<0.001
40,02046.9170.2940.4560.011<0.001
42,02027.9720.2650.2540.002<0.001
44,02028.2520.3060.272<0.001<0.001
46,02048.8950.3170.499<0.001<0.001
48,02045.0870.3140.442<0.001<0.001
50,02040.7210.3010.403<0.001<0.001
52,0205.6760.2760.0460.708<0.001
54,02044.8360.3140.432<0.001<0.001
56,02027.6940.2890.263<0.001<0.001
58,02034.6310.3120.327<0.001<0.001
60,02040.2720.3060.380<0.001<0.001

Conclusions

  1. Raw data is heavily right-skewed, making it difficult to detect statistically significant differences and increasing the risk of Type II errors (false negatives). Large sample sizes are required to achieve sufficient statistical power.

    In Seven Rules of Thumb for Web Site Experimenters, researchers proposed a practical heuristic for the sample size needed for the sampling distribution of the mean to approach normality:

    n ≥ 355 × (skewness)²

    Note: This heuristic concerns normal approximation, not statistical power directly.

  2. Log transformations help detect changes in typical user behavior with significantly smaller sample sizes. By reducing the influence of extreme values, log transformations can make it easier to identify systematic shifts in user behavior.

  3. Log transformations provide insights into relative changes rather than absolute changes. The difference in mean log outcomes can be converted into a percentage change in geometric means:

    x2−x1x1 ≈log(x2) −log(x1) asx2→x1

    However, translating these findings back to primary business metrics (e.g., average revenue per user) requires additional calculations and reconciliation with practical threshold.