在python中计算给定阈值的置信度

时间:2019-04-29 02:37:51

标签: python pandas

假设我预测A为55%,标准偏差为3%

如何计算A高于50%的可能性?

很抱歉,这是基本问题,但是在查询时遇到了麻烦。

1 个答案:

答案 0 :(得分:0)

具有统计背景的人可能会更好地回答您,但是,

如果假设您有normal distribution,则A低于50%的概率由该分布的CDF给出。要计算A高于50%的概率,请从中减去1。

使用scipy(relevant docs)进行计算:

from scipy.stats import norm

prob_lower50 = norm.cdf(0.50, loc=0.55, scale=0.03)
prob_higher50 = 1 - prob_lower50

print(prob_higher50)
# 0.9522