statsmodels.stats.contingency_tables.SquareTable.symmetry

SquareTable.symmetry(method='bowker')[source]

Test for symmetry of a joint distribution.

This procedure tests the null hypothesis that the joint distribution is symmetric around the main diagonal, that is

\[\]

p_{i, j} = p_{j, i} for all i, j

Returns:
Bunch

A bunch with attributes

  • statisticfloat

    chisquare test statistic

  • p-valuefloat

    p-value of the test statistic based on chisquare distribution

  • dfint

    degrees of freedom of the chisquare distribution

See also

mcnemar
homogeneity

Notes

The implementation is based on the SAS documentation. R includes it in mcnemar.test if the table is not 2 by 2. However a more direct generalization of the McNemar test to larger tables is provided by the homogeneity test (TableSymmetry.homogeneity).

The p-value is based on the chi-square distribution which requires that the sample size is not very small to be a good approximation of the true distribution. For 2x2 contingency tables the exact distribution can be obtained with mcnemar