Skip to main content
This lesson reviews between-group differences for discrete variables. At the end of this lesson, you will be able to:
  1. Describe the chi-square test of independence, Fisher exact test, and McNemar test
  2. Interpret the results of each test

Terms that appear frequently throughout this lesson are defined below:

Term Definition
Discrete Variables that have a finite number of possible values
Chi-square A test of observed and expected frequencies
Fisher exact test Similar to the chi-square test of independence; used when the expected frequencies are small
McNemar test A test of paired frequencies (e.g., frequency before and frequency after)

I. Chi-Square Test

Nominal data is common in health sciences research (e.g., the presence or absence of disease, adherence or non-adherence, gender, and socio-economic status). By far, the most common approach to analyzing discrete or nominal data is the chi-square test.

The chi-square test examines the difference between the observed and expected frequencies of a variable. Consider the contingency table below (i.e., n= 300 pregnant women). If exposure had no effect, we might expect that the proportion of individuals in both groups would be the same. The chi-square test can determine if the frequencies in the “exposed” group differ from those we would expect if there were no association between exposure and pregnancy:

  Complicated Pregnancy Normal Pregnancy Total
Exposure 75 50 125
No Exposure 25 150 175
Total 100 200 300

II. Fisher Exact Test

One limitation to the chi-square test is its inaccuracy when the expected frequency in any cell is small. As a common convention, the Fisher exact test should be used anytime that a frequency is less than 5 (n < 5).

III. McNemar Test

The chi-square and Fisher exact test are appropriate for independent, or unpaired, variables. When repeated measures are used to collect frequencies for nominal data, for example a pre- and post-test, the McNemar test should be used. Consider the table below (n=350 participants), which provides frequencies for those that agree or disagree with vaccination before an educational video and after. In this example, 150 participants agree with vaccination before and after the video, 25 agree before but disagree after the video, 160 disagree before and agree after the video, and 15 disagree with vaccination before and after the video. The McNemar Test can determine if the educational video significantly impacted agreement or disagreement with vaccination:

    After Video
    Agree with Vaccination Disagree with Vaccination
Before Video Agree with Vaccination 150 25
Disagree with Vaccination 160 15

Example 1: Readmission Rates

Methods:

The objective of this study was to determine if a difference existed in hospital readmission rates at 60 days postdischarge between the intervention group (i.e., pharmacist visit within 60 days of discharge) and control group (i.e., no pharmacist visit). Chi-square analyses were used to assess differences in hospital readmissions between the groups and demographic (i.e., age, gender, and race/ethnicity) characteristics between the intervention and control groups. To achieve 80% power (α = 0.05), it was estimated that 75 patients per group would be needed to address the study objectives.
Characteristic Intervention Control P
n 66 65  
Age, years (mean ± SD) 47.7 ± 10.5 46.5 ± 10.7 0.5106
Women (%) 68.2 60.0 0.3290*
White (%) 20.0 55.4 < 0.0001*
No. medications (mean ± SD) 8.5 ± 4.5 5.1 ± 2.1 < 0.0001
No. diseases (mean ± SD) 5.1 ± 2.0 2.3 ± 1.5 < 0.0001
Hospital readmission (%) 18.2 43.1 0.0020*

Nominal variables:

  • Group (Intervention/Control)
  • Gender (Women/Not Women)
  • Race/Ethnicity (White/Not White)
  • Hospital readmission (Yes/No)

Chi-square analyses:

  • Group vs Gender
  • Group vs Race/Ethnicity
  • Group vs Hospital readmission

*Chi-square results:

When comparing the intervention and control groups , no significant differences in gender ( p = 0.3290) were noted. However, the control group had a significantly higher percentage of whites (p < 0.0001). Of the 65 patients in the control group, 28 (43.1%) were readmitted to the hospital within 60 days compared with 12 of 66 patients (18.2%) in the intervention group. Thus, a significantly higher percentage of patients in the control group were readmitted to the hospital (p = 0.0020).

Example 2: Malnutrition

Methods:

In the following study, the chi-square test was used to compare nominal variables and the Fisher exact test when expected values were ​​less than five.  A p-value < 0.05 was considered significant.

Health status, n (%) Malnutrition Risk of Malnutrition Normal Total P value
Physical exercises         0.002
Yes 1 (7.1) 13 (24.1) 22 (51.2) 36 (32.4)  
No 13 (92.9) 41 (75.9) 21 (48.8) 75 (67.6)  
Chronic diseases         0.430
Yes 12 (85.7) 48 (88.9) 34 (79.1) 94 (84.7)  
No 2 (14.3) 6 (11.1) 9 (20.9) 17 (15.3)  
Dental problem         0.207
Yes 7 (50.0) 19 (35.2) 11 (25.6) 37 (33.3)  
No 7 (50.0) 35 (64.8) 32 (74.4) 74 (66.7)  
Gastro-intestinal problem         0.056
Yes 1 (7.1) 22 (40.7) 15 (34.9) 38 (34.2)  
No 13 (92.9) 32 (59.3) 28 (65.1) 73 (65.8)  
Falls         1.000
Yes 4 (28.6) 17 (31.5) 14 (32.6) 35 (31.5)  
No 10 (71.4) 37 (68.5) 29 (67.4) 76 (68.5)  
Smoking         0.611
Yes 4 (28.6) 20 (37.0) 12 (27.9) 36 (32.4)  
No 10 (71.4) 34 (63.0) 31 (72.1) 75 (67.6)  
Alcohol         0.140
Yes 0 (0.0) 2 (3.7) 6 (14.0) 8 (7.2)  
No 14 (100.0) 52 (96.3) 37 (86.0) 103 (92.8)  

Chi-square results (all variables in the table):

This table allows us to see the health factors that have association with the nutritional status of older adults in this sample. Physical exercises (p = 0.002), for example, showed an association with nutritional status.

For more information