def ztest_dominance(variations, control=None):
    """Calculate z-test for dominance."""
    values = OrderedDict()
    a, others = _split(variations, control)
    for label, b in others.items():
        total_a = a.alpha-a.prior_alpha+a.beta-a.prior_beta
        total_b = b.alpha-b.prior_alpha+b.beta-b.prior_beta
        p_a = float(a.alpha-a.prior_alpha) / total_a
        p_b = float(b.alpha-b.prior_alpha) / total_b
        sse_a = p_a * (1-p_a) / total_a
        sse_b = p_b * (1-p_b) / total_b
        zscore = (p_b-p_a) / np.sqrt(sse_a+sse_b)
        values[label] = stats.norm().cdf(zscore)

    return values
dataset/ETHPy150Open bogdan-kulynych/trials/trials/stats.py/ztest_dominance/original