Issue
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
Solution
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.
Answered By - merv Answer Checked By - Pedro (Python.Easybugfix Volunteer)
Post a Comment
Post a Comment