statsmodels.sandbox.stats.runs.mcnemar

statsmodels.sandbox.stats.runs.mcnemar(x, y=None, exact=True, correction=True)[source]

麦克尼马尔检验

Parameters:
x, yarray_like

两个配对的数据样本。如果 y 为 None,则 x 可以是 2 行 2 列的列联表。x 和 y 可以有多个维度,然后结果是在假设轴零包含样本的观测值的情况下计算的。

exactbool

如果 exact 为 true,则将使用二项分布。 如果 exact 为 false,则将使用卡方分布,这是对于大样本量的检验统计量分布的近似。

correctionbool

如果为真,则对卡方分布使用连续性校正(如果exact为假。)

Returns:
statfloat or int, array

如果 exact 为 false,则检验统计量是卡方统计量。如果使用精确二项分布,则此统计量包含 min(n1, n2),其中 n1, n2 是在一个样本中为零而在另一个样本中为一的案例。

pvaluefloat or array

零假设等效应的p值。

注释

这是Cochran’s Q检验的一个特殊情况。当使用卡方分布时,结果是相同的,除了连续性校正。


Last update: Oct 16, 2024