statsmodels.stats.contingency_tables.mcnemar

statsmodels.stats.contingency_tables.mcnemar(table, exact=True, correction=True)[source]

McNemar 同质性检验。

Parameters:
tablearray_like

一个方形的列联表。

exactbool

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

correctionbool

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

Returns:
A bunch with attributes:
statisticfloat or int, array

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

pvaluefloat or array

原假设等边际分布的p值。

注释

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


Last update: Oct 16, 2024