Run a complete A/B test workflow: summarize groups, check assumptions, choose the right test, and analyze multiple metrics.
Kotlin Notebook
Try this guide as a Kotlin Notebook with Kandy visualizations — run the cells to see charts and explore the data interactively.
This guide walks through an A/B test comparing two checkout flow variants in a mobile app. The primary metric is session duration (seconds); the secondary metric is number of completed steps.
// Welch's t-test (default: equalVariances = false)val result = tTest(controlDurationSec, treatmentDurationSec)result.statisticresult.pValueresult.confidenceInterval // 95% CI for the difference in meansresult.isSignificant() // true if p < 0.05
If the Levene test confirmed equal variances:
Copy
val equalVar = tTest( controlDurationSec, treatmentDurationSec, equalVariances = true)equalVar.pValue
Copy
val result = mannWhitneyUTest(controlDurationSec, treatmentDurationSec)result.statisticresult.pValueresult.isSignificant()
Check whether the two metrics move together within each group.
Copy
// Within the treatment group: do faster sessions correlate with more completed steps?val correlation = spearmanCorrelation(treatmentDurationSec, treatmentSteps)correlation.coefficient // negative means shorter sessions correlate with more stepscorrelation.pValue
Spearman correlation is preferred here because one metric (steps) is ordinal.