Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Created October 22, 2019 03:14
Show Gist options
  • Save DustinAlandzes/2832d75c36b0963781035239f98f1c3e to your computer and use it in GitHub Desktop.
Save DustinAlandzes/2832d75c36b0963781035239f98f1c3e to your computer and use it in GitHub Desktop.
Calculating sample size with statsmodels in python (3% base conversion, 5% relative MDE = 3.15%)
from statmodels.stats.power import tt_ind_solve_power
from statsmodels.stats.proportion import proportion_effectsize
es = proportion_effectsize(0.03, 0.0315)
n = tt_ind_solve_power(effect_size=es, ratio=1, power=0.8, alpha=0.05)
# from https://speakerdeck.com/nneu/b-testing-a-bayesian-approach?slide=36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment