A/B Testing in R
Lauryn Burleigh
Data Scientist
table(Pizza$Topping, Pizza$EatAgain)
Maybe No Yes
Cheese 207 90 703
Pepperoni 147 101 752
Cannot conclude cause
library(pwr)
pwr.chisq.test(w = 0.1, df = 2,
power = 0.80,
sig.level = 0.05)
Chi squared power calculation
w = 0.1
N = 963.4689
df = 2
sig.level = 0.05
power = 0.8
NOTE: N is the number of observations
Minimum of five values at each variable combination
freqtbl <- table(Pizza$Topping,
Pizza$EatAgain)
chisq.test(freqtbl)
Pearson's Chi-squared test
data: freqtbl
X-squared = 12.453, df = 2,
p-value = 0.001976
Large sample sizes: over 1000
probtbl <- freqtbl/sum(freqtbl)
library(pwr)
ES.w2(probtbl)
[1] 0.07890872
pwr.chisq.test(w = 0.079, df = 2,
N = 1000,
sig.level = 0.002)
Chi squared power calculation
w = 0.079
N = 1000
df = 2
sig.level = 0.002
power = 1
NOTE: N is the number of observations
A/B Testing in R