Case Study 18 · Live, 28 November 2026

Bayesian Experimentation and Causal ML for a Subscription Product

Beta-Binomial · Expected loss · ROPE · mSPRT · Empirical Bayes · Type S and M errors · Meta-learners · Causal forest (grf) · Qini · GATES · sBG · Surrogate index · DuckDB SQL · Python · R · JavaScript · 24 tests

The business question

A subscription product runs tests all the time: a new onboarding, a price, a paywall, a message. For each one the product manager asks four things. Is the variant better, and how sure are we? How long must the test run? Who does it help, so that it reaches only them? And will a gain in conversion this week still be there in revenue and retention in six months?

This case answers each question with the method a data science team would defend, and shows the traps that make teams ship changes that do not work.

The subscription data is simulated, so that the right answer is known. The real experiments come from public archives: 32,000 headline tests, an e-mail campaign and an advertising experiment.

The data

  • Upworthy Research Archive (Matias et al., 2021): 32,487 randomised tests of headlines and images run by a news site from 2013 to 2015. Its authors split it into exploratory, confirmatory and holdout parts; this case learns from the exploratory part (4,873 tests) and checks on the holdout (4,871).
  • Hillstrom e-mail experiment (2008): 64,000 customers randomly sent a men’s e-mail, a women’s e-mail or nothing; visits, conversions and spend in the next two weeks.
  • Criteo Uplift (Diemert et al., 2018): 13.9 million users randomly exposed to advertising or not. A random sample of 1 million is used, and only aggregates are shown, as its licence asks.
  • A subscription simulator: users with an age, a goal, a channel, a device and their first-week sessions; a 14-day trial, a monthly plan and cancellation that varies across users. Two experiments run on it: onboarding with a coach, which helps users who barely engage in the first week, and a first-month discount, which lifts conversion with users who cancel early.

Try it

Enter the users and conversions of a test and read the decision; see what looking at a test every day does to it; plan a test’s length with classical power and with Bayesian assurance; see how much the winners of 4,871 real tests shrink; compare methods that choose whom to treat on three experiments; and follow retention, lifetime value and the surrogate index.

Method, and why this one

A decision, not a p-value. Each arm’s conversion rate gets a Beta posterior. The reading gives the chance that the variant is better and the expected loss of each choice: how much conversion is given up, on average, if the choice turns out wrong. Both have exact formulas, with no sampling, so the page computes the same numbers as the Python. A region of practical equivalence (Kruschke, 2018) separates “better”, “worse”, “the same in practice” and “not yet”. A Bayes factor checks that users were split as planned (Fabijan et al., 2019). Revenue, with its long tail of zeros and big spenders, where averages mislead (Azevedo et al., 2020), is read with the Bayesian bootstrap (Rubin, 1981).

Peeking, simulated. Tests with and without a real effect are looked at 1 to 20 times. Four rules are compared: the fixed test read once at the end, the same test stopped at the first p < 0.05, the Bayesian rule stopped at the first chance above 97.5%, and mSPRT, the always-valid sequential test (Johari et al., 2022).

Priors from the archive. In each Upworthy test two arms are drawn at random and their difference in click rate is measured in log-odds, about the relative lift. Across tests the true differences follow a prior learned from the archive by empirical Bayes: a mixture of two normals centred at zero, one for the many small effects and one for the few large ones. With it every estimate is shrunk, the “winners” are corrected, and the chance of a wrong sign (type S) and the exaggeration (type M) of a significant result are measured by test size (Gelman and Carlin, 2014). The same prior sets the planner’s assurance: the chance that a test of a given length ends with a confident, correct decision, next to classical power, with or without variance reduction from a pre-test covariate (CUPED; Deng et al., 2013), following the practice in Kohavi, Tang and Xu (2020).

Who to treat, on randomised data. Five meta-learners (S, T, X, DR and R; Künzel et al., 2019; Kennedy, 2023; Nie and Wager, 2021) with gradient boosting, cross-fitted so that no user’s effect is predicted by a model that saw them, and the causal forest of grf in R (Athey, Tibshirani and Wager, 2019). Where the truth is unknown, the predictions are judged by what they do: the Qini curve, the best linear predictor and the average effect by quintile (Chernozhukov, Demirer, Duflo and Fernández-Val, 2018), and the gain of treating the top 10%, 25% or 50%.

From conversion to revenue. Survival of paying users by arm; the shifted beta-geometric model (Fader and Hardie, 2007) for the 36-month lifetime value, with a bootstrap interval; and the surrogate index (Athey, Chetty, Imbens and Kang, 2019), which predicts six-month retention from the first two weeks so that a test can be read early, checked against the six-month truth. Monthly growth accounting (new, retained and churned subscribers, and the quick ratio) runs in DuckDB SQL.

A summary a product manager can read. The reading is also written as a short text, by rules, and a check confirms that every number in it comes from the result.

The frequentist side. The credit card marketplace case reads an experiment the classical way: sample-ratio and balance checks before any effect, an A/A split, regression adjustment (CUPED), the delta method and mSPRT, on the full 13.98 million-user Criteo test. This case takes the Bayesian side of the same decisions.

Result

The coach works, and the reading says how sure. In the simulated test, 33.9% of 19,880 control users and 38.1% of 20,120 coached users converted to paid. The difference is between 3.3 and 5.2 points (95%); the true effect is 4.0. Revenue over twelve months rises by US$ 10.00 per user who signed up (US$ 7.78 to US$ 12.16).

Peeking makes false winners, Bayesian or not. With no real effect and 10,000 users per arm, reading once at the end declares a winner in 4.4% of tests. Looking 20 times and stopping at the first p < 0.05 declares one in 24%, and the Bayesian rule that stops at the first 97.5% does the same: 24%. mSPRT holds false winners under 1%, at a price: with a true lift of 1 point it detects 29% of the effects against 63% for the fixed test. A stopping rule agreed in advance protects the team; the choice of statistics does not.

Most effects are small, and winners exaggerate. The archive’s prior puts 60% of tests in a narrow band around zero (a standard deviation of about 15% in relative lift) and 40% in a wide one (about 45%). Re-fitted on the holdout it barely moves (55%, 15% and 44%), and it predicts that 22.7% of holdout tests are significant against 24.5% observed. Of the 4,871 holdout tests, 1,193 are significant at 5%; their mean observed lift is 1.6 times the shrunk one. Benjamini-Hochberg keeps 554 and the Bayesian rule with the archive prior 578. In the noisiest fifth of tests, a significant result has the wrong sign 7.7% of the time and exaggerates the effect 2.3 times; in the most precise fifth, 1.4% and 1.2 times.

Effects differ across users, and the right method finds who responds. In the simulator, where the true effect of each user is known, the X and R learners cut the error of the effect by a third against assuming the average for everyone (1.8 and 1.9 points against 2.8); the T-learner and the causal forest do worse than the average here. The effect by quintile of the R-learner’s prediction goes from 0.5 points to 7.5. On Criteo, almost all the gain sits in a fifth of users: the top quintile’s effect is 4.1 points and the other four are 0.2 points or less, so treating the top 10% yields 85% of the visits gained by treating everyone. On Hillstrom the e-mail helps everyone (6.1 points more visits on average, from 4.6 in the lowest quintile to 7.8 in the highest), so targeting saves sends, not results.

A conversion gain is not a revenue gain. The coach lifts conversion by 4.3 points and keeps subscribers longer: the 36-month value per subscriber goes from US$ 256 to US$ 275, and twelve-month revenue per user from US$ 56.03 to US$ 67.11. The discount lifts conversion more, by 6.3 points, but the extra subscribers leave early: value per subscriber falls from US$ 259 to US$ 219 and twelve-month revenue per user from US$ 56.75 to US$ 52.88. The surrogate index, read at two weeks, says the discount raises six-month retention by 2.0 points; the truth is -0.3. For the coach it says 1.3 against a true 2.8. It is a useful early signal when the treatment works through engagement, and a misleading one when the treatment changes who converts.

Limits

The subscription data is simulated: the parameters are in the code, and results that depend on it are marked as such. The archive is of headline tests on click rates, not of a health product; its prior is shown as the method for a team to learn its own prior from its own tests. Criteo is used on a 1 million-row sample and its effect is on visits, not conversions, which are too rare in a sample for a stable reading. The causal forest runs with default settings; its weaker result in the simulator is a statement about those settings on this data, not about the method. The expected-loss stopping rule and the type S and M figures depend on the prior; a team should refresh the prior every quarter as tests accumulate.

Applied to your business

For a subscription app, a marketplace or a retailer, the same tools run on your experiment logs: a reading every product manager can act on, test lengths set before the test, a prior learned from your own archive, the users worth treating under your budget, and the effect on revenue and retention, not only on this week’s conversion. It starts with the Data & AI Diagnostic and runs in your environment.

Code

github.com/rhozon/bayesian-experimentation-causal-ml

With Python 3.11 or later (and R with grf for the causal forest):

pip install -e ".[dev]"
pytest -v
node tests/check_js.js                                # the page's Bayesian functions = Python
python -I tools/fetch_ab_data.py ~/data/ab-bayes      # public data, no account
python -m abx.cli all

The suite has 24 tests, and CI runs them, and the 63 checks of the JavaScript against the Python, on every push.

References

Data: Upworthy Research Archive (Open Science Framework, CC BY 4.0); Kevin Hillstrom, MineThatData E-Mail Analytics and Data Mining Challenge (2008); Criteo Uplift Prediction Dataset v2.1 (Diemert, Betlei, Renaudin and Amini, 2018, CC BY-NC-SA 4.0).

  • Athey, S., Chetty, R., Imbens, G. and Kang, H. (2019). The Surrogate Index: Combining Short-Term Proxies to Estimate Long-Term Treatment Effects More Rapidly and Precisely. National Bureau of Economic Research. doi:10.3386/w26463
  • Athey, S., Tibshirani, J. and Wager, S. (2019). Generalized random forests. The Annals of Statistics, 47(2), 1148-1178. doi:10.1214/18-AOS1709
  • Azevedo, E. M., Deng, A., Montiel Olea, J. L., Rao, J. and Weyl, E. G. (2020). A/B Testing with Fat Tails. Journal of Political Economy, 128(12), 4614-4672. doi:10.1086/710607
  • Chernozhukov, V., Demirer, M., Duflo, E. and Fernández-Val, I. (2018). Generic Machine Learning Inference on Heterogeneous Treatment Effects in Randomized Experiments, with an Application to Immunization in India. National Bureau of Economic Research. doi:10.3386/w24678
  • Deng, A., Xu, Y., Kohavi, R. and Walker, T. (2013). Improving the sensitivity of online controlled experiments by utilizing pre-experiment data. Proceedings of the sixth ACM international conference on Web search and data mining, 123-132. doi:10.1145/2433396.2433413
  • Fabijan, A., Gupchup, J., Gupta, S., Omhover, J., Qin, W., Vermeer, L. et al. (2019). Diagnosing Sample Ratio Mismatch in Online Controlled Experiments. Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2156-2164. doi:10.1145/3292500.3330722
  • Fader, P. S. and Hardie, B. G. S. (2007). How to project customer retention. Journal of Interactive Marketing, 21(1), 76-90. doi:10.1002/dir.20074
  • Gelman, A. and Carlin, J. (2014). Beyond Power Calculations: Assessing Type S (Sign) and Type M (Magnitude) Errors. Perspectives on Psychological Science, 9(6), 641-651. doi:10.1177/1745691614551642
  • Johari, R., Koomen, P., Pekelis, L. and Walsh, D. (2022). Always Valid Inference: Continuous Monitoring of A/B Tests. Operations Research, 70(3), 1806-1821. doi:10.1287/opre.2021.2135
  • Kennedy, E. H. (2023). Towards optimal doubly robust estimation of heterogeneous causal effects. Electronic Journal of Statistics, 17(2), 3008-3049. doi:10.1214/23-EJS2157
  • Kohavi, R., Tang, D. and Xu, Y. (2020). Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing. Cambridge University Press. doi:10.1017/9781108653985
  • Kruschke, J. K. (2018). Rejecting or Accepting Parameter Values in Bayesian Estimation. Advances in Methods and Practices in Psychological Science, 1(2), 270-280. doi:10.1177/2515245918771304
  • Künzel, S. R., Sekhon, J. S., Bickel, P. J. and Yu, B. (2019). Metalearners for estimating heterogeneous treatment effects using machine learning. Proceedings of the National Academy of Sciences, 116(10), 4156-4165. doi:10.1073/pnas.1804597116
  • Matias, J. N., Munger, K., Le Quere, M. A. and Ebersole, C. (2021). The Upworthy Research Archive, a time series of 32,487 experiments in U.S. media. Scientific Data, 8(1). doi:10.1038/s41597-021-00934-7
  • Nie, X. and Wager, S. (2021). Quasi-oracle estimation of heterogeneous treatment effects. Biometrika, 108(2), 299-319. doi:10.1093/biomet/asaa076
  • Rubin, D. B. (1981). The Bayesian Bootstrap. The Annals of Statistics, 9(1), 130-134. doi:10.1214/aos/1176345338
WhatsApp ↑