McNemar's test is a simple test for for checking whether pairwise measurements from two categories are independent. Here, I investigate the properties of the test and how it is used in R.
In contrast to independent measurements, matched data consist of measurements that should be considered together. For example, matching can be used in clinical studies. Here, patients that exhibit similar characteristics are paired in order to remove confounding effects. Matched data can also arise naturally when multiple measurements are performed on the same entity. For example, matched data can arise when a clinical marker is measured once before and once after a treatment intervention. Irrespective of how the matched data were generated, their structure should be taken into account through the use of appropriate statistical tests.
The most common type of matched data are paired measurements, which consist of two data points. For this type of data, the following significance tests are available:
|Type of dependent variable||Tests|
|Quantitative||Paired t-test, Wilcoxon signed rank test|
Click on a variable type in the table to obtain more information on how to use the corresponding significance tests in R.
If you have more than two matched measurements, then you are dealing with repeated-measures data. An example of a significance test that handles such data is repeated-measures one-way ANOVA.
Posts that deal with matched data
In the following posts, you can find more specific information on how you can handle matched data.
Measurements often come in pairs. Here I discuss what can go wrong when performing statistical tests that do not take this structure into account.
If you want to compare the means or medians of paired measurements, you can use a paired Student's t-test or a Wilcoxon signed rank test, respectively. This post explores the properties of these two tests and contrasts them.