Python中的置信区间

3

在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个回答

1
您可以通过百分点函数(累积分布函数的反函数)获得置信区间。您可以执行以下操作来获取分布的下限和上限置信界限:
lower = rv_continuous.ppf(alpha/2.)
upper = rv_continuous.ppf(1.-alpha/2.)

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

1

这里

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接