stats.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Projects 作者: it2school 项目源码 文件源码
def confidence_interval_dichotomous(
        point_estimate, sample_size, confidence=.95, bias=False,
        percentage=True, **kwargs):
    """Dichotomous confidence interval from sample size and maybe a bias"""
    alpha = ppf((confidence + 1) / 2, sample_size - 1)
    p = point_estimate
    if percentage:
        p /= 100

    margin = sqrt(p * (1 - p) / sample_size)
    if bias:
        margin += .5 / sample_size
    if percentage:
        margin *= 100

    return (point_estimate - alpha * margin, point_estimate + alpha * margin)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号