Sidebar Menu

The McNemar Test, developed by McNemar in 1947, is a non-parametric analysis designed to assess whether there is a significant difference between two dependent paired variables, such as conditions before and after a treatment. This analysis is particularly applied to nominal or categorical data. For example, the data may include categories such as "Agree" and "Disagree" or "True" and "False." The McNemar Test can be considered a special case of the Cochran Q test when there are only two data categories (k=2). In the analysis, these two conditions are often scored, for example, by assigning "True" as 1 and "False" as 0, where both scores are dichotomous and mutually exclusive. When using SmartstatXL, this test offers a reliable statistical solution for data analysis under these conditions.

Case Example

In the following case, consumer preference is observed both before and after treatment. There are only two categories, Other and Store Brand. Before analysis, these two nominal data are scored into dichotomous numbers, 0 and 1. A score of 1 is for Other and 0 for Store Brand.

Analysis Steps

Here are the steps for performing the McNemar Test using SmartstatXL, Excel Add-in:

  1. Activate the worksheet (Sheet) to be analyzed.
  2. Place the cursor on the dataset (to create a dataset, see the Data Preparation method). The dataset can be arranged in two layouts:
  3. Grouped by level/grade (comparison between levels)
  4. Grouped by variable (comparison between variables)
  5. If the active cell is not on the dataset, SmartstatXL will automatically try to determine the dataset.
  6. Activate the SmartstatXL Tab
  7. Click the Non-Parametric Menu. SmartstatXL will display a dialog box to ensure whether the dataset is correct or not (usually, the cell address of the dataset is automatically selected correctly).
  8. If it is correct, Click the Next Button
  9. Next, the following Non-Parametric Test Dialog Box will appear:
  10. If the data layout used is based on a comparison between variables, the following dialog box will appear:
  11. Finally, press the "OK" button.

Analysis Results

The following is the Analysis Output for the McNemar Test:

Statistical Summary

From the analysis using the McNemar Test, we want to determine whether there is a significant difference in consumer preferences before and after treatment.

Let's interpret the analysis results:

  1. Proposed Hypothesis:
    • H0 (Null Hypothesis): There is no difference in the proportion between the two conditions.
    • H1 (Alternative Hypothesis): There is a difference in the proportion between the two conditions.
  2. Statistical Results:
    • The contingency table produced values a = 59, b = 48, c = 26, and d = 64.
    • The Chi-Square value is 5.959 with a p-value of 0.015.
    • Normal approximation yields a Z-value of 2.441 with the same p-value, 0.015.
  3. Interpretation:
    • Because the p-value (0.015) is less than 0.05, we reject the null hypothesis (H0). This means there is sufficient evidence to state that there is a significant difference in consumer preferences before and after treatment.

Conclusion:

Based on the McNemar Test analysis, there is a significant difference in consumer preferences before and after treatment. Consumer preferences towards "Other" and "Store Brand" changed after the treatment, with a significance level of 0.05.