Bayesian AB testing with explicitly modeling the expected effect size
nbviewer.ipython.org1 pointsby sharnett0 comments
from scipy.stats import norm as norm
def beta_mean(a, b):
return a/(a+b)
def beta_var(a, b):
return a*b/((a+b)**2*(a+b+1))
def probability_B_beats_A(α_A, β_A, α_B, β_B):
mu = beta_mean(α_A, β_A) - beta_mean(α_B, β_B)
sigma = (beta_var(α_A, β_A) + beta_var(α_B, β_B))**.5
return norm.cdf(0, mu, sigma)