How does one convert a Z-score from the Z-distribution (standard normal distribution, Gaussian distribution) to a p-value? I have yet to find the magical function in Scipy\'
Aha! I found it: scipy.special.ndtr! This also appears to be under scipy.stats.stats.zprob
as well (which is just a pointer to ndtr
).
Specifically, given a one-dimensional numpy.array
instance z_scores
, one can obtain the p-values as
p_values = 1 - scipy.special.ndtr(z_scores)
or alternatively
p_values = scipy.special.ndtr(-z_scores)