-
-
Save mysticaltech/7e91f35f27dc58e4b64cd64cb4027f31 to your computer and use it in GitHub Desktop.
Evan Miller's Tool - R code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The code given in #2 gist is not in R. There is a change in formula compared to the one in this blog post and the one used by Evan Miller's tool (#3). http://www.alfredo.motta.name/ab-testing-from-scratch/#easy-footnote-bottom-24-982 | |
#1. https://stats.stackexchange.com/questions/357336/create-an-a-b-sample-size-calculator-using-evan-millers-post | |
#2. https://gist.github.com/mottalrd/7ddfd45d14bc7433dec2#file-gistfile1-txt | |
#3. https://www.evanmiller.org/ab-testing/sample-size.html | |
p = 0.03 | |
pct_mde = 0.1 | |
alpha = 0.05 | |
power = 1- 0.2 | |
delta = p*pct_mde | |
t_alpha2 = qnorm(1 - alpha/2) | |
t_beta = qnorm(power) | |
sd1 =sqrt(2 * p * (1.0 - p)) | |
sd2 =sqrt(p * (1.0 - p) + (p + delta) * (1.0 - p - delta)) | |
n = (t_alpha2 * sd1 + t_beta * sd2) * (t_alpha2 * sd1 + t_beta * sd2) / (delta * delta) | |
print(n) | |
#If you set Baseline conversion rate = 3% and minimum detectable effort to be 10% as shown in the example, you get the values on Evan Miller's tool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment