def zscore
if alternatives.size != 2
raise "Sorry, can't currently automatically calculate statistics for A/B tests with > 2 alternatives."
end
if (alternatives[0].participants == 0) || (alternatives[1].participants == 0)
raise "Can't calculate the z score if either of the alternatives lacks participants."
end
cr1 = alternatives[0].conversion_rate
cr2 = alternatives[1].conversion_rate
n1 = alternatives[0].participants
n2 = alternatives[1].participants
numerator = cr1 - cr2
frac1 = cr1 * (1 - cr1) / n1
frac2 = cr2 * (1 - cr2) / n2
numerator / ((frac1 + frac2) ** 0.5)
end