Reputation: 37
I'm using this function to calculate the p-value of an experiment I'm running. I'm not sure if it's one-tailed or two-tailed. How can I infer this from the code? Thanks
from scipy import stats
def get_pvalue(con_conv, test_conv, con_size, test_size):
lift = - abs(test_conv - con_conv)
scale_one = con_conv * (1 - con_conv) * (1 / con_size)
scale_two = test_conv * (1 - test_conv) * (1 / test_size)
scale_val = (scale_one + scale_two)**0.5
p_value = 2 * stats.norm.cdf(lift, loc = 0, scale = scale_val )
return p_value
Upvotes: 0
Views: 793
Reputation: 76700
Two-tailed. This can be inferred because the difference uses an absolute value, and the p_value
multiplies the (one-sided) tail of the normal CDF by 2.
Upvotes: 1