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

后端 未结 7 1823
野趣味
野趣味 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:39

    Starting Python 3.8, the standard library provides the NormalDist object as part of the statistics module.

    It can be used to apply the inverse cumulative distribution function (inv_cdf, also known as the quantile function or the percent-point function) and the cumulative distribution function (cdf):

    NormalDist().inv_cdf(0.95)
    # 1.6448536269514715
    NormalDist().cdf(1.64)
    # 0.9494974165258963
    

提交回复
热议问题