python中的置信区间

时间:2018-02-02 18:57:29

标签: python-3.x scipy statistics normal-distribution probability-density

python中是否有函数或包可以获得scipy.stats中存在的分布的95%或99%置信区间。

如果不是最简单的选择

以下是发行版(但我的优先级是halfgennorm和loglaplace)

    st.alpha,st.anglit,st.arcsine,st.beta,st.betaprime,st.bradford,st.burr,st.cauchy,st.chi,st.chi2,st.cosine,
    st.dgamma, st.dweibull,st.erlang,st.expon,st.exponnorm,st.exponweib,st.exponpow,st.f,st.fatiguelife,st.fisk,
    st.foldcauchy,st.foldnorm,st.frechet_r,st.frechet_l,st.genlogistic,st.genpareto,st.gennorm,st.genexpon,
    st.genextreme,st.gausshyper,st.gamma,st.gengamma,st.genhalflogistic,st.gilbrat,st.gompertz,st.gumbel_r,
    st.gumbel_l,st.halfcauchy,st.halflogistic,st.halfnorm,st.halfgennorm,st.hypsecant,st.invgamma,st.invgauss,
    st.invweibull,st.johnsonsb,st.johnsonsu,st.ksone,st.kstwobign,st.laplace,st.levy,st.levy_l,st.levy_stable,
    st.logistic,st.loggamma,st.loglaplace,st.lognorm,st.lomax,st.maxwell,st.mielke,st.nakagami,st.ncx2,st.ncf,
    st.nct,st.norm,st.pareto,st.pearson3,st.powerlaw,st.powerlognorm,st.powernorm,st.rdist,st.reciprocal,
    st.rayleigh,st.rice,st.recipinvgauss,st.semicircular,st.t,st.triang,st.truncexpon,st.truncnorm,st.tukeylambda,
    st.uniform,st.vonmises,st.vonmises_line,st.wald,st.weibull_min,st.weibull_max,st.wrapcauchy

2 个答案:

答案 0 :(得分:0)

您可以从百分点函数获得置信区间(累积分布函数的倒数)。您可以执行以下操作来获得分布的较低和较高置信区间:

lower = rv_continuous.ppf(alpha/2.)
upper = rv_continuous.ppf(1.-alpha/2.)

[rv_continuous可以是scipy.stats中的任何发行版。]

答案 1 :(得分:0)

这里

import statsmodels.api as sm
sm.stats.proportion_confint(906, 906+2066) 
相关问题