A/B Testing in R
Lauryn Burleigh
Data Scientist
Test usefulness
Power
library(pwr) pwr.t.test(d = .8, power = 0.8,
sig.level = 0.05,
type = "one.sample",
alternative = "two.sided")
One-sample t test power calculation
n = 14.30276
d = 0.8
sig.level = 0.05
power = 0.8
alternative = two.sided
Prior to analysis
Find effect size with:
After analysis
Find effect size with:
Higher power = higher probability to correctly reject null hypothesis
Three aspects needed:
library(pwr)
pwr.t.test(n = 20, sig.level = 0.045,
d = .81, type = "one.sample")
One-sample t test power calculation
n = 20
d = 0.81
sig.level = 0.045
power = 0.9223189
alternative = two.sided
Similar distributions
No significant difference
Different distributions
Likely significant difference
library(ggplot2)
ggplot(HypDists,
aes(x = Time, fill = Hypothesis)) +
geom_histogram() +
xlab("Difference Between Groups") +
geom_vline(xintercept = 1.64)
library(ggplot2)
ggplot(HypDists,
aes(x = Time, fill = Hypothesis)) +
geom_histogram() +
xlab("Difference Between Groups") +
geom_vline(xintercept = 1.64)
A/B Testing in R