Get startedGet started for free

Comparing two proportions for paired samples (4)

Of course there are convenience functions in R available that make it easier to perform a McNemar test. The function is conveniently called mcnemar.test(). This functions takes a two-dimensional contingency table in matrix form. This test then calculates a chi-square and outputs a p value. An example of using the mcnemar.test() function is the following: mcnemar.test(matrix)

This exercise is part of the course

Inferential Statistics

View Course

Exercise instructions

  • Saved in your console is a contingency matrix called europe. Perform the McNemar test on this matrix and print the results to the console.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# perform a mcnemar test on the matrix europe
Edit and Run Code