【问题标题】:Confidence interval in pythonpython中的置信区间
【发布时间】:2018-07-13 08:09:59
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    这里

    import statsmodels.api as sm
    sm.stats.proportion_confint(906, 906+2066) 
    

    【讨论】:

      【解决方案2】:

      您可以从百分比函数(累积分布函数的倒数)获得置信区间。您可以执行以下操作来获取分布的置信下限和上限:

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

      [rv_continuous 可以是scipy.stats 中的任何分布。]

      【讨论】:

        猜你喜欢
        • 2015-09-15
        • 1970-01-01
        • 2020-10-06
        • 2017-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-30
        • 2013-06-16
        相关资源
        最近更新 更多