Problem
Analysts without formal statistics training often do not know which test fits their data, which formulas it needs, or whether its assumptions (such as normality) hold. Library tests copied from a user guide leave doubt about correctness. The same gap appears when sizing an experiment, where sample size, effect size, significance level and power are linked.
Example from the article: a hypothetical drug trial compares a new drug with the traditional treatment on a binary outcome (cured or not). The cure rate rises from 80.34% to 81.79% (about 1.5 points), with groups of 2487 and 1785 animals, and the team asks whether this is chance and how many animals a conclusive test needs.
Solution in brief
Simulate the null hypothesis: pool all units, reshuffle them into groups of the original sizes many times, and record the statistic each time. The share of reshuffles at least as extreme as the observed result is the p-value. Repeating the test on synthetic bootstrap samples gives power as a function of sample size.
Questions this case answers
- How to test the significance of a difference between two groups without distributional assumptions and size the sample needed to detect a target effect
- How to check whether an observed A/B difference in a conversion rate is more than chance without relying on a formula-based test?
- How to find the sample size needed to detect a given effect when a standard calculator is not at hand or its assumptions are doubtful?
- How to cross-check a library test result with a simulation?
Tools and methods
- Permutation test — p-value from reshuffled group labels, no distribution assumption
- Bootstrap — draws synthetic samples of a chosen size to simulate repeated experiments
- Power analysis — share of simulated experiments that reject the null, per sample size and effect size
- statsmodels — analytic sample-size check with
proportion_effectsize - SciPy — chi-square and one-sided Fisher exact tests as a cross-check
Google or a one-time email code. No password.