McNemar's test

McNemar's test allows to compare two paired samples of binary data. Run it in Excel using the XLSTAT add-on statistical software.

mac-nemar-test-general-dialog-box.png

McNemar's test definition and advantages

McNemar’s test is a special case of the Cochran’s Q test when there are only two treatments. As for the Cochran’s Q test, the variable of interest is binary. However, the McNemar’s test has two advantages:

  1. Obtaining an exact p-value is possible;
  2. The data can be summarized in a 2x2 contingency table.

In the case of the two-tailed (or two-sided) test, the null (H0) and alternative (Ha) hypotheses are:

H0: Treatment 1 = Treatment 2 and Ha: Treatment 1 ≠ Treatment 2

In the one-tailed case, you need to distinguish the left-tailed (or lower-tailed or lower one-sided) test and the right-tailed (or upper-tailed or upper one-sided) test. In the left-tailed test, the following hypotheses are used:

H0: Treatment 1 = Treatment 2 and Ha: Treatment 1 < Treatment 2

In the right-tailed test, the following hypotheses are used:

H0: Treatment 1 = Treatment 2 and Ha: Treatment 1 > Treatment 2

Input data for the McNemar's test

There are three possible formats are available for the input data:

  1. You can select data in a "raw" format. In this case, each column corresponds to a treatment and each row to a subject (or individual, or bloc).
  2. You can also select the data in a "grouped" format. Here, each column corresponds to a treatment, and each row corresponds to a unique combine of the k treatments. You then need to select the frequencies corresponding to each combine.
  3. You can also select a contingency table with two rows and two columns. In the case where you choose this, the first and second treatments are respectively considered as corresponding to the rows and the columns. The positive response cases (or successes) are considered as corresponding to the first row of the contingency table for the first treatment, and to the first column for the second treatment.
ternary diagramneural network diagram

analyze your data with xlstat

14-day free trial