python中qq图(或probplot)的逐点置信包络

python中qq图(或probplot)的逐点置信包络,python,scipy,statsmodels,Python,Scipy,Statsmodels,我有一个到达时间列表,我正在使用scipy.stats.probplot绘制概率图(类似于qq图)。我的数据在列表l中,我调用 scipy.stats.probplot(l, dist=stats.expon) 如何向绘图中添加逐点置信区间。上一篇文章展示了如何在R中实现这一点,但我需要在python中实现这一点 我也尝试过statsmodels,但它的功能似乎比scipy的同类产品稍少(例如,它不计算R^2错误)。我发布了一个稍微不同的示例,但它可能会 帮你 #!/usr/bin/env p

我有一个到达时间列表,我正在使用scipy.stats.probplot绘制概率图(类似于qq图)。我的数据在列表
l
中,我调用

scipy.stats.probplot(l, dist=stats.expon)
如何向绘图中添加逐点置信区间。上一篇文章展示了如何在R中实现这一点,但我需要在python中实现这一点


我也尝试过statsmodels,但它的功能似乎比scipy的同类产品稍少(例如,它不计算R^2错误)。

我发布了一个稍微不同的示例,但它可能会 帮你

#!/usr/bin/env python

from scipy.stats import t
from numpy import average, std
from math import sqrt

if __name__ == '__main__':
    # data we want to evaluate: average height of 30 one year old male and
    # female toddlers. Interestingly, at this age height is not bimodal yet
    data = [63.5, 81.3, 88.9, 63.5, 76.2, 67.3, 66.0, 64.8, 74.9, 81.3, 76.2,
            72.4, 76.2, 81.3, 71.1, 80.0, 73.7, 74.9, 76.2, 86.4, 73.7, 81.3,
            68.6, 71.1, 83.8, 71.1, 68.6, 81.3, 73.7, 74.9]
    mean = average(data)
    # evaluate sample variance by setting delta degrees of freedom (ddof) to
    # 1. The degree used in calculations is N - ddof
    stddev = std(data, ddof=1)
    # Get the endpoints of the range that contains 95% of the distribution
    t_bounds = t.interval(0.95, len(data) - 1)
    # sum mean to the confidence interval
    ci = [mean + critval * stddev / sqrt(len(data)) for critval in t_bounds]
    print "Mean: %f" % mean
    print "Confidence Interval 95%%: %f, %f" % (ci[0], ci[1])

你找到问题的答案了吗?你的例子当然适用于分布的平均值,但问题是关于qq图中的分位数。显然,最低分位数和最高分位数的置信区间更宽。