Convert Z-score (Z-value, standard score) to p-value for normal distribution in Python

后端 未结 7 1827
野趣味
野趣味 2020-12-12 18:19

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\'

7条回答
  •  再見小時候
    2020-12-12 18:34

    From formula:

    import numpy as np
    import scipy.special as scsp
    def z2p(z):
        """From z-score return p-value."""
        return 0.5 * (1 + scsp.erf(z / np.sqrt(2)))
    

提交回复
热议问题