statsmodels.stats.proportion.tost_proportions_2indep

statsmodels.stats.proportion.tost_proportions_2indep(count1, nobs1, count2, nobs2, low, upp, method=None, compare='diff', correction=True)[source]

基于两个单侧的等效性检验 test_proportions_2indep

这假设我们有两个独立的二项分布样本。

等效性检验的零假设和备择假设是

对于 compare = ‘diff’

  • H0: prop1 - prop2 <= low 或 upp <= prop1 - prop2

  • H1: 低 < prop1 - prop2 < 高

对于 compare = ‘ratio’

  • H0: prop1 / prop2 <= low 或 upp <= prop1 / prop2

  • H1: 低 < prop1 / prop2 < 高

对于 compare = ‘odds-ratio’

  • H0: 或者 <= 低 或者 上界 <= 或者

  • H1: 低 < 或 < 高

其中 优势比 or = prop1 / (1 - prop1) / (prop2 / (1 - prop2))

Parameters:
count1, nobs1

第一个样本的计数和样本大小

count2, nobs2

第二个样本的计数和样本大小

low, upp

差异、风险比或比值比的等效边际

methodstr

计算假设检验的方法。如果 method 为 None,则使用默认方法。随着更多方法的添加,默认方法可能会发生变化。

diff:
  • ‘wald’,

  • ‘阿格斯蒂-卡福’

  • ‘score’ 如果 correction 为 True,则使用自由度校正 nobs / (nobs - 1),如 Miettinen Nurminen 1985 年所述。

ratio:
  • ‘log’: 使用对数变换的wald检验

  • ‘log-adjusted’: wald test using log transformation,

    将计数加0.5

  • ‘score’ 如果 correction 为 True,则使用自由度校正 nobs / (nobs - 1),如 Miettinen Nurminen 1985 年所述。

odds-ratio:
  • ‘logit’: 使用logit变换的wald检验

  • ‘logit-adjusted’:wald test using logit transformation,

    将计数加0.5

  • ‘logit-smoothed’:wald test using logit transformation, biases

    单元格通过总共添加两个观察值来计算独立性。

  • ‘score’ if correction is True, then this uses the degrees of freedom

    修正 nobs / (nobs - 1) 如 Miettinen Nurminen 1985 所述

comparestr in [‘diff’, ‘ratio’ ‘odds-ratio’]

如果 compare 是 diff,那么假设检验是针对 diff = p1 - p2。 如果 compare 是 ratio,那么假设检验是针对由 ratio = p1 / p2 定义的风险比。 如果 compare 是 odds-ratio,那么假设检验是针对由 or = p1 / (1 - p1) / (p2 / (1 - p2) 定义的比值比。

correctionbool

如果 correction 为 True(默认),则使用 Miettinen 和 Nurminen 的小样本方差修正 nobs / (nobs - 1)。仅在 method=’score’ 时适用。

Returns:
pvaluefloat

p值是两个单侧检验的p值中的最大值

t1test results

下限单侧假设的结果实例

t1test results

单边假设在上限的结果实例

注释

状态:实验性,API和默认值可能仍会变化。

TOST等效性检验委托给test_proportions_2indep,并具有相同的方法和比较选项。


Last update: Oct 16, 2024