Statistics Definitions > McNemar Test Example
What is the McNemar Test?
The McNemar test is a nonparametric test for paired nominal data. It’s used when you are interested in finding a change in proportion for the paired data. For example, you could use this test to analyze retrospective casecontrol studies, where each treatment is paired with a control. It could also be used to analyze an experiment where two treatments are given to matched pairs. This test is sometimes referred to as McNemar’s ChiSquare test because the test statistic has a chisquare distribution.
Assumptions for the McNemar Test
The three main assumptions for the test are:
 You must have one nominal variable with two categories (i.e. dichotomous variables) and one independent variable with two connected groups.
 The two groups in your the dependent variable must be mutually exclusive. In other words, participants cannot appear in more than one group.
 Your sample must be a random sample.
If your data does not meet these three assumptions, considering running another test for your data like a regular chisquare test.
Calculating the Test
In order to run a McNemar test, your data should be placed into a 2×2 contingency table, with the cell frequencies equaling the number of pairs. For example, a researcher is testing a new medication and records if the drug worked (“yes”) or did not (“no”). A table is set up with the count of individuals before and after being given the medication. The cell labels ad are in blue:
Cells b and c are used to calculate the test statistic; these cells are called “discordant.”
The McNemar test formula is:
For the set of data above, we have:
= (10010)^{2} / (100 + 10)
= 90^{2} / 100
= 73.63
You have several options for calculating the McNemar test using technology:
 This online calculator will calculate the McNemar test using inputs for any 2×2 contingency table that you provide input for.
 SPSS: The binomial distribution is used for the McNemar test. You can find excellent instructions here on the SFU website.
 SAS instructions can be found here on the Purdue website.


Need help with a homework or test question? Chegg offers 30 minutes of free tutoring, so you can try them out before committing to a subscription. Click here for more details.
If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.
Comments? Need to post a correction? Please post on our Facebook page.