Contributors: Sri Santhosh Hari, Sooraj Subrahmannian, Devesh Maheshwari

URL of the APP: https://sscalc.herokuapp.com/

Power analysis and sample size calculations are key to drawing valid conclusion from any A/B test. These address the concerns around identifying number of units required in each condition (control and treatment) of the experiment. Theoretically it is easy to consider large number of samples in experiments but in practice it is expensive (time spent, lost revenue, lost customers, etc.). This makes sample size calculations key to the the entire experimentation process.

In this repository, we have developed functions to compute sample sizes for tests involving comparison of means and comparison of proportions. The functions are flexible enough to handle multiple testing conditions like one/two-sided tests, can take in range of power/significance level/effect size. An interactive version of these functions can be viewed as a dash app version. Local version of the app can be launched by executing the following steps

pip install -r requirements.txt

python sample_size_calculator.py

Open http://0.0.0.0:8055/ in a browser.

Formula for computing sample size

Variable Description:

  • : Number of samples in control group
  • : Number of samples in treatment group
  • : Effect Size in terms of standard deviation ()
  • : Z-Score corresponding to the probability of incorrectly rejecting null hypothesis
  • : Z-Score corresponding to the propability of correctly rejecting null hypothesis
  • : Proportion of success (ex - click through rate) in control group (already known)
  • : Proportion of success in treatment group (estimated)

Sample size for comparison of means:

Sample size for comparison of proportions: