SlideShare a Scribd company logo
2
Most read
3
Most read
Comparing Correlated Proportions With McNemar’s Test

        Suppose you are evaluating the effectiveness of an intervention which is
designed to make patients more likely to comply with their physicians’ prescriptions.
Prior to introducing the intervention, each of 200 patients is classified as compliant or
not. Half (100) are compliant, half (100) are not. After the intervention you reclassify
each patient as compliant (120) or not (80). It appears that the intervention has raised
compliance from 50% to 65%, but is that increase statistically significant?
        McNemar’s test is the analysis traditionally used to answer a question like this.
To conduct this test you first create a 2 x 2 table where each of the subjects is classified
in one cell. In the table below, cell A includes the 45 patients who were compliant at
both times, cell B the 55 who were compliant before the intervention but not after the
intervention, cell C the 85 who were not compliant prior to the intervention but were after
the intervention, and cell D the 15 who were noncompliant at both times.


                                             After the Intervention
                                       Compliant (1)          Not (0)           Marginals
Prior to the       Compliant (1)           45     A           55      B            100
Intervention
                   Not (0)                 85     C           15      D            100
Marginals                                   130                 70                 200


       McNemar’s Chi-square, with a correction for continuity, is computed this way:
      (| b − c | −1)2                            (| 55 − 85 | −1)2
 χ =
  2
                      . For the data above, χ =
                                             2
                                                                   = 6.007 . The chi-square is
           b+c                                       55 + 85
evaluated on one degree of freedom, yielding, for these data, a p value of .01425.
        If you wish not to make the correction for continuity, omit the “−1.” For these data
that would yield a chi-square of 6.429 and a p value of .01123. I have not investigated
whether or not the correction for continuity provides a better approximation of the exact
(binomial) probability or not, but I suspect it does.

McNemar Done as an Exact Binomial Test

       Simply use the binomial distribution to test the null hypothesis that p = q = .5
where the number of successes is either count B or count C from the table and N = B +
C. For our data, that is, obtain the probability of getting 55 or fewer failures in 85 + 55 =
140 trials of binomial experiment when p = q = .5. The syntax for doing this with SPSS
is
COMPUTE p=2*CDF.BINOM(55,140,.5).
EXECUTE.
and the value computed is .01396.
McNemar Done With SAS

Data compliance;
Input Prior After Count; Cards;
1 1 45
1 0 55
0 1 85
0 0 15
Proc Freq; Tables Prior*After / Agree; Weight Count; run;

                Statistics for Table of Prior by After

                        McNemar's Test
                   ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
                   Statistic (S)     6.4286
                   DF                 1
                   Asymptotic Pr > S 0.0112
                   Exact      Pr >= S 0.0140



       The “Statistic” reported by SAS is the chi-square without the correction for
continuity. The “Asymptotic Pr” is the p value for that uncorrected chi-square. The
“Exact Pr” is an exact p value based on the binomial distribution.

McNemar Done With SPSS
Analyze, Descriptive Statistics, Crosstabs. Prior into “Rows” and After into
“Columns.” Click “Statistics” and select “McNemar.” Continue, OK




             Prior * After Crosstabulation

Count

                                       After

                        0               1               Total

Prior    0                  15                 85               100
         1                  55                 45               100
         Total              70              130                 200


                 Chi-Square Tests

                                        Exact Sig. (2-
                        Value                  sided)

McNemar Test                                            .014a

N of Valid Cases                 200

a. Binomial distribution used.
Notice that SPSS does not give you a chi-square approximate p value, but rather
an exact binomial p value.

McNemar Done With Vasser Stats

      Go to http://faculty.vassar.edu/lowry/propcorr.html




      Enter the counts into the table and click “Calculate.”




      Very nice, even an odds ratio with a confidence interval. I am impressed.
More Than Two Blocks
        The design above could be described as one-way, randomized blocks, two levels
of the categorical variable (prior to intervention, after intervention). What if there were
more than two levels of the treatment – for example, prior to intervention, immediately
after intervention, six months after intervention. An appropriate analysis here might be
the Cochran test. See http://en.wikipedia.org/wiki/Cochran_test.

        See also McNemar Tests of Marginal Homogeneity at
http://ourworld.compuserve.com/homepages/jsuebersax/mcnemar.htm .

Return to Wuensch’s Stats Lessons

Karl L. Wuensch, July, 2008

More Related Content

PPTX
STATISTICS: Hypothesis Testing
PPT
Chi-square, Yates, Fisher & McNemar
PPTX
Testing of hypotheses
PPT
Mc namer test of correlation
PPTX
What is a Mann Whitney U?
PPT
Introduction to t-tests (statistics)
PPTX
Point and Interval Estimation
PPTX
STATISTICS: Hypothesis Testing
Chi-square, Yates, Fisher & McNemar
Testing of hypotheses
Mc namer test of correlation
What is a Mann Whitney U?
Introduction to t-tests (statistics)
Point and Interval Estimation

What's hot (20)

PPTX
Testing Of Hypothesis
PPTX
Bivariate data
PDF
Independent samples t-test
PPTX
Parametric vs Nonparametric Tests: When to use which
PPT
Ch4 Confidence Interval
PPTX
Normal distribution
PPT
HYPOTHESIS TESTING.ppt
PPT
Chi square mahmoud
PPT
Hypothesis Testing
PPTX
Null hypothesis for multiple linear regression
PPTX
Statistical inference
PPT
Spearman Rank Correlation Presentation
PPT
PDF
Chi square Test Using SPSS
PPTX
Reporting a paired sample t test
PPTX
Reporting a Factorial ANOVA
PPTX
PPT
Estimation and hypothesis testing 1 (graduate statistics2)
PPTX
Reporting the wilcoxon signed ranks test
Testing Of Hypothesis
Bivariate data
Independent samples t-test
Parametric vs Nonparametric Tests: When to use which
Ch4 Confidence Interval
Normal distribution
HYPOTHESIS TESTING.ppt
Chi square mahmoud
Hypothesis Testing
Null hypothesis for multiple linear regression
Statistical inference
Spearman Rank Correlation Presentation
Chi square Test Using SPSS
Reporting a paired sample t test
Reporting a Factorial ANOVA
Estimation and hypothesis testing 1 (graduate statistics2)
Reporting the wilcoxon signed ranks test
Ad

Viewers also liked (17)

PDF
Epidata lecture note
PDF
6. Categorical data analysis - Chi-Square & Fisher Exact Test
PPT
Non Parametric Tests
PPTX
Reporting Pearson Correlation Test of Independence in APA
PPTX
Introduction to EpiData
PPTX
Chi squared test
PPTX
Non parametric tests
PPTX
Friedman Test- A Presentation
PPTX
Non-Parametric Tests
PDF
STATISTICS AND PROBABILITY (TEACHING GUIDE)
PPTX
Basics of statistics
PDF
Data analysis using spss
PPTX
Reporting a Kruskal Wallis Test
PPTX
Reporting a non parametric Friedman test in APA
PPTX
Reporting Mann Whitney U Test in APA
PPTX
Testes parametricos e nao parametricos
PPTX
Reporting Chi Square Test of Independence in APA
Epidata lecture note
6. Categorical data analysis - Chi-Square & Fisher Exact Test
Non Parametric Tests
Reporting Pearson Correlation Test of Independence in APA
Introduction to EpiData
Chi squared test
Non parametric tests
Friedman Test- A Presentation
Non-Parametric Tests
STATISTICS AND PROBABILITY (TEACHING GUIDE)
Basics of statistics
Data analysis using spss
Reporting a Kruskal Wallis Test
Reporting a non parametric Friedman test in APA
Reporting Mann Whitney U Test in APA
Testes parametricos e nao parametricos
Reporting Chi Square Test of Independence in APA
Ad

Similar to Mc Nemar (20)

PPTX
Company Induction process and Onboarding
PPTX
Chi square(hospital admin)
PDF
Chisquare Test of Association.pdf in biostatistics
PDF
InnerSoft STATS - Methods and formulas help
PPT
Lecture 07 Category Shaoqi Rao Rev
PPT
Chapter 07 Chi Square
PPTX
Parametric & non parametric
PPT
THE CHI-SQUARE TEST IN DEPTH AND WITH EXAMPLES
PPTX
Chi square test
PDF
PPTX
Biostatistics- lesson is chapter-10.pptx
PPT
23-Statistical_tests_(chi-square,Fishers___&Macnemars))(UG1435-36).ppt
PDF
Hmisiri nonparametrics book
PPTX
Lecture chi squire. For Postgraduate and Undergraduate
PDF
Non Parametric Test by Vikramjit Singh
DOCX
Non Parametric Statistics
PPTX
Inferential statistics nominal data
PPT
chi-squaretest-170826142554.ppt
PPTX
Statistics Assignment Help
Company Induction process and Onboarding
Chi square(hospital admin)
Chisquare Test of Association.pdf in biostatistics
InnerSoft STATS - Methods and formulas help
Lecture 07 Category Shaoqi Rao Rev
Chapter 07 Chi Square
Parametric & non parametric
THE CHI-SQUARE TEST IN DEPTH AND WITH EXAMPLES
Chi square test
Biostatistics- lesson is chapter-10.pptx
23-Statistical_tests_(chi-square,Fishers___&Macnemars))(UG1435-36).ppt
Hmisiri nonparametrics book
Lecture chi squire. For Postgraduate and Undergraduate
Non Parametric Test by Vikramjit Singh
Non Parametric Statistics
Inferential statistics nominal data
chi-squaretest-170826142554.ppt
Statistics Assignment Help

More from OUM SAOKOSAL (20)

PPTX
Class Diagram | OOP and Design Patterns by Oum Saokosal
PPTX
Android app development - Java Programming for Android
PDF
Java OOP Programming language (Part 8) - Java Database JDBC
PDF
Java OOP Programming language (Part 7) - Swing
PDF
Java OOP Programming language (Part 6) - Abstract Class & Interface
PDF
Java OOP Programming language (Part 5) - Inheritance
PDF
Java OOP Programming language (Part 4) - Collection
PDF
Java OOP Programming language (Part 3) - Class and Object
PDF
Java OOP Programming language (Part 1) - Introduction to Java
PDF
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
PDF
Aggregate rank bringing order to web sites
DOC
How to succeed in graduate school
PDF
Google
PDF
E miner
PDF
Data preparation for mining world wide web browsing patterns (1999)
PDF
Consumer acceptance of online banking an extension of the technology accepta...
DOCX
When Do People Help
DOCX
Correlation Example
DOC
Sem Ski Amos
PPT
Sem+Essentials
Class Diagram | OOP and Design Patterns by Oum Saokosal
Android app development - Java Programming for Android
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 7) - Swing
Java OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 1) - Introduction to Java
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
Aggregate rank bringing order to web sites
How to succeed in graduate school
Google
E miner
Data preparation for mining world wide web browsing patterns (1999)
Consumer acceptance of online banking an extension of the technology accepta...
When Do People Help
Correlation Example
Sem Ski Amos
Sem+Essentials

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation theory and applications.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Per capita expenditure prediction using model stacking based on satellite ima...
Network Security Unit 5.pdf for BCA BBA.
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Weekly Chronicles - August'25 Week I
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
MYSQL Presentation for SQL database connectivity
Chapter 3 Spatial Domain Image Processing.pdf
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
The AUB Centre for AI in Media Proposal.docx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication

Mc Nemar

  • 1. Comparing Correlated Proportions With McNemar’s Test Suppose you are evaluating the effectiveness of an intervention which is designed to make patients more likely to comply with their physicians’ prescriptions. Prior to introducing the intervention, each of 200 patients is classified as compliant or not. Half (100) are compliant, half (100) are not. After the intervention you reclassify each patient as compliant (120) or not (80). It appears that the intervention has raised compliance from 50% to 65%, but is that increase statistically significant? McNemar’s test is the analysis traditionally used to answer a question like this. To conduct this test you first create a 2 x 2 table where each of the subjects is classified in one cell. In the table below, cell A includes the 45 patients who were compliant at both times, cell B the 55 who were compliant before the intervention but not after the intervention, cell C the 85 who were not compliant prior to the intervention but were after the intervention, and cell D the 15 who were noncompliant at both times. After the Intervention Compliant (1) Not (0) Marginals Prior to the Compliant (1) 45 A 55 B 100 Intervention Not (0) 85 C 15 D 100 Marginals 130 70 200 McNemar’s Chi-square, with a correction for continuity, is computed this way: (| b − c | −1)2 (| 55 − 85 | −1)2 χ = 2 . For the data above, χ = 2 = 6.007 . The chi-square is b+c 55 + 85 evaluated on one degree of freedom, yielding, for these data, a p value of .01425. If you wish not to make the correction for continuity, omit the “−1.” For these data that would yield a chi-square of 6.429 and a p value of .01123. I have not investigated whether or not the correction for continuity provides a better approximation of the exact (binomial) probability or not, but I suspect it does. McNemar Done as an Exact Binomial Test Simply use the binomial distribution to test the null hypothesis that p = q = .5 where the number of successes is either count B or count C from the table and N = B + C. For our data, that is, obtain the probability of getting 55 or fewer failures in 85 + 55 = 140 trials of binomial experiment when p = q = .5. The syntax for doing this with SPSS is COMPUTE p=2*CDF.BINOM(55,140,.5). EXECUTE. and the value computed is .01396.
  • 2. McNemar Done With SAS Data compliance; Input Prior After Count; Cards; 1 1 45 1 0 55 0 1 85 0 0 15 Proc Freq; Tables Prior*After / Agree; Weight Count; run; Statistics for Table of Prior by After McNemar's Test ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Statistic (S) 6.4286 DF 1 Asymptotic Pr > S 0.0112 Exact Pr >= S 0.0140 The “Statistic” reported by SAS is the chi-square without the correction for continuity. The “Asymptotic Pr” is the p value for that uncorrected chi-square. The “Exact Pr” is an exact p value based on the binomial distribution. McNemar Done With SPSS
  • 3. Analyze, Descriptive Statistics, Crosstabs. Prior into “Rows” and After into “Columns.” Click “Statistics” and select “McNemar.” Continue, OK Prior * After Crosstabulation Count After 0 1 Total Prior 0 15 85 100 1 55 45 100 Total 70 130 200 Chi-Square Tests Exact Sig. (2- Value sided) McNemar Test .014a N of Valid Cases 200 a. Binomial distribution used.
  • 4. Notice that SPSS does not give you a chi-square approximate p value, but rather an exact binomial p value. McNemar Done With Vasser Stats Go to http://faculty.vassar.edu/lowry/propcorr.html Enter the counts into the table and click “Calculate.” Very nice, even an odds ratio with a confidence interval. I am impressed.
  • 5. More Than Two Blocks The design above could be described as one-way, randomized blocks, two levels of the categorical variable (prior to intervention, after intervention). What if there were more than two levels of the treatment – for example, prior to intervention, immediately after intervention, six months after intervention. An appropriate analysis here might be the Cochran test. See http://en.wikipedia.org/wiki/Cochran_test. See also McNemar Tests of Marginal Homogeneity at http://ourworld.compuserve.com/homepages/jsuebersax/mcnemar.htm . Return to Wuensch’s Stats Lessons Karl L. Wuensch, July, 2008