# McNemar test

Command: | Statistics Crosstabs McNemar test |

## Description

The *McNemar test* is a test on a 2x2 classification table when you want to test the difference between paired proportions, e.g. in studies in which patients serve as their own control, or in studies with "before and after" design.

In the *McNemar test* dialog box, two discrete dichotomous variables with the classification data must be identified. Classification data may either be numeric or alphanumeric (string) values. If required, you can convert a continuous variable into a dichotomous variable using the Create groups tools. The variables together cannot contain more than 2 different classification values.

For example, in a study a test is performed before treatment and after treatment in 20 patients. The results of the test are coded 0 (negative) and 1 (positive). Is there a significant change in the test result before and after treatment?

## How to enter the data in the spreadsheet

## Required input

The dialog box for the McNemar test is completed as follows:

Select two discrete variables with related classification data. Classification data may either be numeric or alphanumeric (string) values, but both variables cannot contain more than 2 different classification values.

After you have completed the dialog box, click OK to obtain the classification table with the relevant statistics.

## Classification table

The program displays the 2x2 classification table.

## Difference and P-value

The program gives the difference between the proportions (expressed as a percentage) with 95% confidence interval.

When the (two-sided) P-value is less than the conventional 0.05, the conclusion is that there is a significant difference between the two proportions.

In the example, 45% of cases were positive before treatment (Classification A = 1) and 35% were positive after treatment (Classification B = 1). The difference before and after treatment is -10% with 95% CI from -29.1% to 9.1%, which is not significant (P=0.625, n=20).

## Note

The two-sided P-value is based on the cumulative binomial distribution.

The 95% confidence interval is calculated according to Sheskin, 2011.

## Literature

- Altman DG (1991) Practical statistics for medical research. London: Chapman and Hall.
- Sheskin DJ (2011) Handbook of parametric and nonparametric statistical procedures. 5
^{th}ed. Boca Raton: Chapman & Hall /CRC.

## See also

- Sample size calculation for McNemar test
- Frequency table & Chi-squared test
- How to define and use labels for the different categories of a variable
- Fisher's exact test
- Cochran's Q test
- Frequencies bar charts

## External links

- McNemar's test on Wikipedia.