【问题标题】:How to get rejection region given significance level using python如何使用python获得给定显着性水平的拒绝区域
【发布时间】:2021-02-26 15:21:10
【问题描述】:

我想创建一个进行假设检验的函数。其中一个参数是 alpha,给定 alpha 我想获得拒绝区域(通过查找 z-score 表)如何使用 python 做到这一点?

例如: 如果我输入 alpha=0.05 它应该返回 [-1.96, 1.96]

【问题讨论】:

    标签: python statistics statistical-test


    【解决方案1】:

    你可以这样做:

    from scipy.stats import norm
    
    def get_rejection_region(alpha):
        percentile = norm.ppf(1-alpha/2)
        rejection_region = [-percentile, percentile]
        return rejection_region
    
    print(get_rejection_region(0.05))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-26
      • 2015-10-03
      • 2015-10-01
      • 1970-01-01
      • 2022-07-25
      • 2015-05-27
      • 2023-03-30
      相关资源
      最近更新 更多