Chi-square Tests Overview

Chi-square tests are very useful in understanding relationships and proportions. This is a concise overview.

The following 5-minute video provides an introduction to Chi-square tests:

How to pronounce “Chi-square.”

Chi sounds like “Hi” but with a K. So, say Chi-square like “Ki-square.” And Chi is the Greek letter Χ, so we can write Chi-square as Χ2.

The Chi-Square hypothesis test is used for investigating and answering questions related to the proportions or distribution of Frequency (counts) of Categorical variables.

A Chi-square test can only be used for categorical (count) data.

  • Categorical data are often at the nominal scale – names, but can also be at the ordinal level of measurement, e.g. freshman, sophomore, etc.
  • Categorical data is discrete data, which means it can be counted and divided into categories or grouped according to characteristics. The counts are called frequencies.
  • The Chi-square tests will not work with continuous data. Data such as percentages or data that is measured (time, weight, height, etc.) will not work. But continuous data can be “binned.” Age is a continuous variable, but we often capture it in bins, e.g. we count the number of people who checked the “26 to 40” box on the age question. And, if you know the ‘denominator,’ you can convert percentages/prevalence back to counts. See example here.

Examples of Categorical Variables:

  • Favorite color: Red, Blue, Orange, Green, other.
  • Test outcome: Pass/Fail; Unsatisfactory, Approaching Competency, Competent, Exemplary
  • Treatment results: Better/Worse/No Change
  • Party affiliation: Republican/Democrat/Independent
  • Age: <18, 18-25, 26-40, 41-60, 61-80, 81+
  • Day: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
  • Size: Small, Medium, Large, Extra Large

We call the groups of categories Variables.

Categorical variables have multiple categories which are also called levels.

  • The Party Affiliation variable has three categories/levels: Republican, Democrat, independent.
  • The Age variable has six categories/levels.

Assumptions for Chi-square tests:

  • Categories must be mutually exclusive. A subject (e.g. survey participant) can only be put in one category.
  • A Chi-square test can only be used for inference about a population when you have a representative or random sample. If the sample is not random, the results may be biased. If you use a convenience/non-probability sample, the results may be representative only for the sample itself.
  • Sample size. The 30 observations rule of thumb does not apply to a Chi-square test because the distribution does not have to be “normal”. The minimum size for your sample depends on the number of variables and the number of levels in those variables. Generally, you need an expected count of at least 5 in each cell for most Chi-square tests. More about this in later sections.

Example of a Data Table from a sample:

The image below is an example of a categorical data summary table for counts of survey participants’ responses to questions on their level of education and their gender. This is from one random sample with 1213 people responding to the two questions.

Note that the very small observed counts in some cells will likely result in the expected counts violating the Chi-square test “> 5” rule. Combining the two gender categories with small counts might be advisable for running the Chi-square test.

Data table of two categorical variables: Eductaiton Level and Gender Reported.

Chi-square test Theory video

The following 5-minute video provides an explanation of what the Chi-square test does.

Three Types of Chi-square tests

  • One-way Goodness of Fit (Distribution)
  • Two-way Test for Independence (Relationship)
  • Two-way Test for Homogeneity (Proportion)

One-way Goodness of Fit Test

Data come from single random sample with the individuals classified according to one categorical variable. A One-way Chi-square test is a goodness of fit test. It determines if the distribution (proportion) of frequencies in a sample “fit” a hypothesized (assumed) specific distribution.

Example research questions using One-way Goodness of Fit test:

  • “Are there significant differences in the proportions of open-heart surgeries recovered in CVICU on different days of the week.”
  • “Is there a difference in the frequency of crimes reported in three areas of the city?”
  • “Is there a difference in the distribution of responses of our satisfaction survey results for 2018 and 2019?”

The Null and Alternative hypotheses would be:

  • Null Hypothesis Ho: The data are consistent with a specified distribution.
  • Alternative Hypothesis Ha: The data are not consistent with a specified distribution.

The Null specifies the proportion of observations at each level of the categorical variable. The alternative says that at least one of the specified proportions is not true. Note, that if one is not true, because the whole must equal the parts, at least one other proportion is not true.

Visualization of data is usually helpful to understanding. Here is a bar chart showing an expected distribution of patient admissions and the observed counts of patient admissions.

Instructions (with examples) on how to conduct the One-way Goodness of Fit Test are here

Two-way Test for Independence

Data comes from a single random sample with the individuals classified according to two categorical variables. The test determines if there is a relationship between the two variables.

Example research questions using Two-way Test for Independence:

  • “Is there a relationship between sex of the child (age 1 to 4) and the cause of death (six categories) last year in Alabama?
  • “Is there a difference in the distribution of how a tax bill was paid (in person vs mailed vs electronic) over the four tax seasons in our city?
  • “Is the level of success of a Trio [educational] program student dependent upon the type [race] of student?”

The Null and Alternative hypotheses would be:

  • Ho: The variables are independent [not related].
  • Ha: The variables are not independent [are related].

Below is a visualization for a two-way Test for Independence between a survey participant’s marital status and their level of education:

More information on and Instructions for how to conduct the Two-way Test for Independence are here

Two-way Test for Homogeneity

Data come from two or more populations (samples) with individuals classified according to one categorical variable. The test compares the proportions in the two samples and determines if they are significantly different.

The Null and Alternative hypotheses would be:

  • Ho: The proportions in the populations/samples are equal.
  • Ha: The proportions in the populations/samples are not equal.

Example: A hospital implemented a program intended to reduce the number of patients having to return to the ER within 30 days of their discharge. The administrator needs to know if the program has in fact reduced the rate of readmissions to the ER. The summary tables below contain the data collected shown as counts and as percentages:

Data tables comparing counts of patient readmissions before and after staff training course.

The research question is: “Is there a significant difference in the proportion of patients readmitted before and after the new training program?

The Null and Alternative hypotheses stated formally would be:

  • Ho: The proportion of patients being readmitted before and after the training program are the same.
  • Ha: The proportion of patients being readmitted before and after the training program are statistically significantly different.

Below is a visualization of the data for this Test for Homogeneity:

Column chart comparing proportion of patients readmitted before and after training course.

For more info on the Two-way Test for Homogeneity click here

drdawn67

drdawn67

Leave a Reply

Leave a Reply

Your email address will not be published.

ad

About Me

Dr. Dawn Wright

I’m Dr. Dawn Wright. I have been teaching college statistics and business analytics for over 10 years.  I have been asked many questions in that time and I have most of my answers here. 

Recent Posts

ad

Follow Me

Weekly Tutorial

ad

Sign up for our Newsletter

Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit