Study Notes on McNemar's Test for Paired Proportions

FMPH 102: Biostatistics in Public Health

Comparing Paired Proportions


Overview of Continuous and Binary Variables

  • Inference for Means

    • One Sample

    • Two Independent Samples

    • Two Paired Samples

  • Inference for Proportions

    • One Sample

    • Two Independent Samples

    • Two Paired Samples


Binary Variables and Paired Samples

Focus on Binary Variable: Two Paired Samples

  • Binary Variables: Conduct exact binomial test using SPSS.

  • Paired Proportions: Implement the McNemar test.


Paired Samples Designs for Binary Outcomes

  • Variety of Designs: Paired samples occur in various designs including:

    • Pre-post Test Study Design: Notable for lacking a control group.

    • Two Treatments for Same Subject: Examples include:

    • Skin cancer examined on left vs. right arm of drivers.

    • Heart disease comparison in smoking vs. non-smoking twins.

    • Crossover Design: Participants receive both treatments successively.

    • Paired-Match Case-Control Studies: Each case matches with a similar control individually.


McNemar's Test

Application Context

  • Applicable to 2x2 contingency tables with matched pairs to analyze marginal frequencies.

  • McNemar's Test: A statistical method for paired binary data.


Example: Sexual Behaviors in Botswana Military

Study Details

  • Sample Size: n=161 (Dataset: Botswana.sav).

  • Reported Behaviors: Comparison of sexual behavior via diary vs. survey recordings.

  • Outcomes Evaluated:

    • Sexual relations with spouse: Yes/No

    • Sexual relations with others: Yes/No

Data Collection:

  1. Participants reported sexual behavior within two weeks through:

    • Sample 1 (Diary): 13/161 reported having sex.

    • Sample 2 (Survey): 6/161 reported having sex.

  2. Note: Sample 1 and Sample 2 consist of the same individuals.

  3. Hypotheses:

    • Null Hypothesis (H0): $p{Diary} = p{Survey}$ (same proportion across instruments).

    • Alternative Hypothesis (Ha): $p{Diary} \neq p{Survey}$.

Sample Estimates Calculation:

  • $\hat{p}_1 = \frac{13}{161} \approx 0.081$

  • $\hat{p}_2 = \frac{6}{161} \approx 0.037$


Constructing the Data Table

Survey (Retrospective)

Total

No

Yes

Diary (Prospective)

No

146

2

148

Yes

9

4

13

Total

155

6

161

Notes on Table Structure:

  • Distinct from 2x2 tables for Independent Samples Test.

  • The counts here represent paired data.


Structure of McNemar’s Test for Paired Proportions

Cross-tabulated Counts:

  • Variables: a, b, c, d where:

    • Concordant Pairs (values at a, d):

    • (No/No) and (Yes/Yes)

    • Discordant Pairs (values at b, c):

    • (No/Yes) and (Yes/No)

Table Configuration:

2nd Sample

No

Yes

1st Sample

No

a

b

Yes

c

d


Statistical Focus of McNemar’s Test:

  • Focus on Discordant Pairs (Why?)

  • Formulas for proportions:

    • $P_1 = \frac{c+d}{a+b+c+d}$

    • $P_2 = \frac{b+d}{a+b+c+d}$

  • Hypothesis simplification:

    • Null Hypothesis (H0): $P1 = P2 \implies \frac{c+d}{a+b+c+d} = \frac{b+d}{a+b+c+d}$. This simplifies to:

    • Only considering c and b in discordant pairs for statistical significance.


McNemar Test Statistics and Calculations

McNemar Test Statistic (without continuity correction):

$z_M = \frac{b - c}{b + c}$

McNemar Test Statistic (with continuity correction):

  • Recommended Method:
    $z_{M,c} = \frac{b - c - 1}{b + c}$

  • This approach uses continuous distributions to approximate discrete outcomes.


Example: Calculation from Botswana Dataset

Applying Continuity Correction:

  • For the Botswana dataset:
    $z_{M,c} = \frac{|2-9|-1}{\sqrt{9+2}} = \frac{6}{\sqrt{11}} \approx 1.81$

Interpretation:

  • Results indicate the construction of the null hypothesis and the application of the continuity corrected test.


The Plan for Conducting McNemar’s Test

  1. Calculate McNemar’s test statistic using the continuity correction.

  2. State hypothesis:

    • $H0: pc = pb, z{M,c} \sim Normal(0,1)$

  3. P-value:

    • Derived from the standard normal distribution table.

Example Result Analysis

  • For the Botswana data:

    • $z_{M,c} = 1.81$

    • P-value determined through lookup: 0.070.

    • Conclusion: No significant difference between survey instruments.


Importance of the Continuity Correction

  • Case Analysis:

    • Using continuity correction gives $z_{M,c} = 1.81$ with p-value 0.070.

    • Without correction, $z_M = \frac{7}{\sqrt{11}} = 2.11$, leading to a false significance with p-value = 0.035.


Statistical Analysis Using SPSS for Botswana Dataset

  1. Data Structure: Load Botswana.sav.

  2. Use: Analyze > Descriptive Statistics > Crosstabs.

  3. Set up:

    • Columns: Survey, Rows: Diary

    • Count cases by outcome pairs.


Applying McNemar’s Test in SPSS

  • Execution Steps:

  1. Navigate to Analyze > Descriptive Statistics > Crosstabs.

  2. Under Statistics, select McNemar for the paired test.

  3. Interpret results from the output for p-value (Exact Sig. in SPSS).

  • Example Output:

    • P-value = 0.065 leading to the conclusion of no significant difference based on survey instruments.


Cannabis Crossover Study Overview

Study Design:

  • Investigated the effects of smoked medicinal cannabis on HIV-related neuropathic pain.

  • Participants: n=28, randomized crossover study design comparing cannabis with placebo.

Key Measures:
  • Evaluated side effects: used McNemar’s test to analyze occurrences of side effects during cannabis vs. placebo weeks.

  • Example Comparison: Elevated heart rate observed; test statistics determined as:

    • $z_{M,c} = \frac{(13-1-1)}{\sqrt{(13+1)}} = \frac{11}{\sqrt{14}} \approx 2.94$, yielding a significant p-value of 0.003.


Statistical Analysis Using SPSS for Cannabis Crossover Study

  • Create dataset in SPSS:

    • Input columns for: cannabis, placebo, count on the dataset.

  • Statistical evaluation followed with weight cases and appropriate statistical tests for McNemar.


Key Ideas on McNemar’s Test

  • Tests aimed at H0: $pc = pb$ by focusing on discordant cells.

  • Total number of discordant pairs (b+c) becomes pivotal for analysis.

  • Designs of McNemar test statistics correlate to one-sample hypothesis tests making it applicable for binary outcome evaluations such as the cannabis study.


Conclusion

  • Importance of using continuity corrections where inherent bias can cause misinterpretation in results.

  • Correct statistical approaches such as McNemar’s test remain vital in evaluating health behaviors and treatment outcomes.