Mathematics and Statistics Support

Tests for association between categorical variables

Chi-squared test

Use: Used when looking for an association between two nominal variables. This can also be thought of as looking for differences between groups when the outcome (dependent variable) is nominal.
Example: Chi-squared tests are often used to analyse survey data which often consists of lots of questions with tick boxes. People like to compare responses to a question by groups such as gender.

Data considerations: Ensure there is only one row per participant with all the reponses from one indidual in the same row. Each question should have it's own column.
Before carrying out a Chi-squared test, check how many people are in each group. If you have a lot of categories and/or small numbers in some groups, consider combining similar groups together.
Chi-squared is meant for nominal rather than ordinal data. If both variables are ordinal, you may wish to consider looking for a trend using Spearmans's correlation or use alternative methods within the Chi-squared menu instead (see resource sheet for more details).

Log-linear analysis

If you are interested in looking at the association between several categorical variables simultaneously, Log-linear is a more advanced extension to Chi-squared tests.

Click on the download button to get the appropriate resource for the test and software package you want help with.

SPSS

R Sheet

R Script

Jamovi

SAS

Mathematical
Understanding
Summarising categorical data
Chi-squared test

Need help choosing the right statistical test? Use our online test chooser

SHU Maths Logo