# McNemar test for N*N contingency tables

• mnb96
In summary, the conversation is about performing a statistical test for symmetry on a 4x4 contingency table. The approach discussed involves treating the table as a 4x4 matrix and creating a symmetrized version, then applying a Chi2 goodness-of-fit test. The speaker is suspicious of this approach as it is not commonly used and believes that if it were a valid method, it would have been discovered by someone else. However, they later find that this test already exists and the correct number of degrees of freedom is N(N-1)/2 = 6.

#### mnb96

Hi,

I have a 4x4 contingency table that by visual inspection looks approximately symmetric, in the sense that for each entry aij we approximately have $a_{ij} = a_{ji}$ for $i,j=1,2,3,4$.
I would like to know how can I perform a statistical test for symmetry.

An attempt I made was to treat the whole contingency table as a 4x4 matrix $O$, and create its symmetrized version $E=(O+O^T)/2$. At this point I could simply apply a Chi2 goodness-of-fit test (with 9 degrees of freedom) between the observed distribution $O$ and the expected one $E$.

What makes me suspicious is that I haven't found this kind of approach anywhere. Instead, only the simplest case of 2x2 tables is reported in the literature under the name of McNemar's test.

It's reasonable to think that if the generalization of McNemar's test was so trivial, then somebody else would have "invented" it. This makes me suspect that my approach is incorrect.

I might have found the answer to my question: Apparently the test I proposed already exists under the name of https://www.statistik.tu-dortmund.de/fileadmin/user_upload/Lehrstuehle/MSind/SFB_475/2005/tr29-05.pdf (see first formula on page 4).

...just the number of degrees of freedom in my original post is incorrect: it should be N(N-1)/2 = 6, i.e. the number of dof in a NxN symmetric matrix.

## 1. What is the McNemar test for N*N contingency tables?

The McNemar test is a statistical test used to analyze data from a contingency table with two categorical variables, each with two levels. It is commonly used to compare paired proportions or frequencies between two groups.

## 2. How does the McNemar test differ from other statistical tests?

The McNemar test is unique in that it analyzes data from a contingency table rather than from individual data points. It also takes into account the paired nature of the data, making it more suitable for analyzing before-and-after or matched data.

## 3. What assumptions are necessary for the McNemar test?

The McNemar test assumes that the two categorical variables are dependent on each other and that the data is paired. It also assumes that the sample size is large enough to satisfy the chi-square distribution.

## 4. How do you interpret the results of a McNemar test?

If the p-value from the McNemar test is less than the chosen significance level, it indicates that there is a significant difference between the paired proportions or frequencies. If the p-value is greater than the significance level, there is insufficient evidence to conclude a significant difference.

## 5. When should the McNemar test be used?

The McNemar test is most appropriate for analyzing paired data with two categorical variables, such as before-and-after data or matched data. It is commonly used in medical and social sciences research to compare the effects of interventions or treatments on a binary outcome.