z-score 的概率,反之亦然 [英] Probability to z-score and vice versa
本文介绍了z-score 的概率,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何计算 p 值
的 z score
,反之亦然?
How do I calculate the z score
of a p-value
and vice versa?
例如,如果我的 p 值为 0.95
,我应该得到 1.96
作为回报.
For example if I have a p-value of 0.95
I should get 1.96
in return.
我在 scipy 中看到了一些函数,但它们只对数组运行 z-test.
I saw some functions in scipy but they only run a z-test on an array.
我可以访问 numpy、statsmodel、pandas 和 scipy(我认为).
I have access to numpy, statsmodel, pandas, and scipy (I think).
推荐答案
>>> import scipy.stats as st
>>> st.norm.ppf(.95)
1.6448536269514722
>>> st.norm.cdf(1.64)
0.94949741652589625
正如其他用户所指出的,Python 默认计算左/下尾概率.如果要确定包含 95% 分布的密度点,则必须采用另一种方法:
As other users noted, Python calculates left/lower-tail probabilities by default. If you want to determine the density points where 95% of the distribution is included, you have to take another approach:
>>>st.norm.ppf(.975)
1.959963984540054
>>>st.norm.ppf(.025)
-1.960063984540054
这篇关于z-score 的概率,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文