12.9: What’s the Difference Between McNemar and Independence?

Learning Statistics with R - A tutorial for Psychology Students and other Beginners · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-SA 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    12.9: What’s the Difference Between McNemar and Independence?

    Let’s go all the way back to the beginning of the chapter, and look at the cards data set again. If you recall, the actual experimental design that I described involved people making two choices. Because we have information about the first choice and the second choice that everyone made, we can construct the following contingency table that cross-tabulates the first choice against the second choice.

    cardChoices <- xtabs( ~ choice_1 + choice_2, data = cards )
    cardChoices
    ##           choice_2
    ## choice_1   clubs diamonds hearts spades
    ##   clubs       10        9     10      6
    ##   diamonds    20        4     13     14
    ##   hearts      20       18      3     23
    ##   spades      18       13     15      4

    Suppose I wanted to know whether the choice you make the second time is dependent on the choice you made the first time. This is where a test of independence is useful, and what we’re trying to do is see if there’s some relationship between the rows and columns of this table. Here’s the result:

    chisq.test( cardChoices )

    Alternatively, suppose I wanted to know if on average, the frequencies of suit choices were different the second time than the first time. In that situation, what I’m really trying to see if the row totals in cardChoices (i.e., the frequencies for choice_1) are different from the column totals (i.e., the frequencies for choice_2). That’s when you use the McNemar test:

    mcnemar.test( cardChoices )
    
    ## 
    ##  McNemar's Chi-squared test
    ## 
    ## data:  cardChoices
    ## McNemar's chi-squared = 16.033, df = 6, p-value = 0.01358

    Notice that the results are different! These aren’t the same test.


    This page titled 12.9: What’s the Difference Between McNemar and Independence? was last modified on Mon, 08 Jan 2024 09:03:03 GMT and is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Danielle Navarro via source content that was edited to the style and standards of the LibreTexts platform.