When do you need the chi-square test of independence?
You have two categorical variables and one nagging question: are they related? Does beverage preference differ between men and women? Is smoking status associated with education level? Is defect type linked to the factory shift that produced it?
Whenever both variables are categories — not numbers, not scores — the chi-square test of independence is the right tool. It compares the counts you actually observed in each combination of categories with the counts you would expect if the two variables had nothing to do with each other. A big gap between observed and expected means the variables are probably associated.
SPSS runs this test through its Crosstabs procedure, and the whole thing takes about two minutes once you know where to click. This tutorial walks you through the click-by-click steps, gives you a paste-ready syntax block, shows you how to read each part of the output, and finishes with how to report the result in APA style (7th edition).
What the test actually tells you
Start with the hypotheses, because everything SPSS prints makes more sense once you know what is being tested:
- Null hypothesis: the two variables are independent — knowing someone’s category on one variable tells you nothing about their category on the other.
- Alternative hypothesis: the two variables are associated — the distribution of one variable shifts depending on the category of the other.
Behind the scenes, SPSS computes a χ² statistic by adding up, across every cell of the table, the squared difference between the observed count and the expected count, divided by the expected count. Large χ² values with small p-values are evidence against independence.
One important limitation: a significant chi-square tells you that the variables are related, not how strongly or which cells drive the association. That is why this tutorial also covers effect sizes (Phi and Cramer’s V) and how to eyeball the percentage pattern in the table.
Assumptions to check before you run it
The test is simple, but it has rules. Check these before you trust the p-value:
- Two categorical variables. Each variable should be nominal (gender, region, defect type) or ordinal (education level, satisfaction rating). If you have a scale variable, recode it into categories first or choose a different test.
- Independent observations. Each case appears in exactly one cell of the table. One row per person, per item, per observation. Repeated measurements on the same people need a different test (for example, McNemar’s test for paired 2×2 data).
- Adequate expected counts. This is the big one. The standard rule of thumb: no more than 20% of cells should have an expected count below 5, and no cell should have an expected count below 1. SPSS prints this check for you automatically (more on that below).
- Random sampling. If you want to generalize beyond your sample, the data should come from a reasonably random selection process.
If the expected-count rule is violated, your options are: collect more data, combine small categories in a sensible way, or use an exact test — Fisher’s exact test for 2×2 tables is the classic choice.
An illustrative example we will carry through
Imagine you survey 200 people and record two variables: gender (male, female) and beverage preference (tea, coffee). You want to know whether beverage preference is associated with gender. This is a made-up, illustrative example — the point is to show you where every number comes from in the SPSS output, not to report real research.
In your SPSS Data View, you need one column for gender (coded 1 = male, 2 = female, with value labels) and one column for beverage (1 = tea, 2 = coffee, with value labels). One row per respondent.
Running the test in SPSS: click-by-click
- Go to Analyze → Descriptive Statistics → Crosstabs.
- Move your row variable (for example, gender) into the Row(s) box and your column variable (beverage) into the Column(s) box. Which goes where does not change the test result — it only changes how the table reads.
- Click Statistics. Check Chi-square. Also check Phi and Cramer’s V — this gives you the effect size, which you will want when you report the result. Click Continue.
- Click Cells. Keep Observed checked and add Expected. Under Percentages, check Row (and Column or Total if they help your story). The expected counts let you see where the surprises are; the percentages let you describe the pattern in plain language. Click Continue.
- If you have a 2×2 table and a small sample, click Exact and select Exact — SPSS will then compute the Fisher’s exact test p-value as a backup. Click Continue.
- Click OK. SPSS builds three important tables for you.
Paste-ready SPSS syntax
Prefer syntax, or need to rerun the same analysis on new data? Paste this into a syntax window, replace the variable names with yours, select it all, and press Run:
CROSSTABS
/TABLES=gender BY beverage
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ PHI
/CELLS=COUNT EXPECTED ROW COLUMN TOTAL
/COUNT ROUND CELL.What each line does:
/TABLES=gender BY beverage— builds the contingency table (rows BY columns)./STATISTICS=CHISQ PHI— requests the chi-square tests and the Phi/Cramer’s V effect sizes./CELLS=COUNT EXPECTED ROW COLUMN TOTAL— prints observed counts, expected counts, and row, column, and total percentages.
How to interpret the SPSS output
SPSS gives you three tables that matter. Read them in this order:
1. The Crosstabulation table
This is your raw material: observed counts, expected counts, and percentages for every combination of categories. Before you look at any p-value, eyeball the pattern. For example, if 68% of women prefer tea but only 41% of men do, while the expected counts assume no difference at all, you already have a story — the test just tells you whether the story is statistically convincing.
2. The Chi-Square Tests table
Find the row labeled Pearson Chi-Square. It shows three things:
- Value — the χ² statistic itself. Bigger means a bigger gap between observed and expected counts.
- df — degrees of freedom, equal to (number of rows − 1) × (number of columns − 1). A 2×2 table has 1 df; a 2×3 table has 2 df.
- Asymptotic Significance (2-sided) — the p-value. This is the number you decide on.
Decision rule: if the p-value is below your significance level (usually .05), reject the null hypothesis — the two variables are significantly associated. If it is above .05, you do not have enough evidence to claim an association.
Two extra things to check in this table:
- The footnote below the table. SPSS prints something like “0 cells (0.0%) have expected count less than 5. The minimum expected count is 42.30.” If more than 20% of your cells have expected counts below 5, treat the p-value with caution and consider the remedies in the assumptions section.
- The Continuity Correction row (2×2 tables only). This is a more conservative p-value. Most researchers report the Pearson chi-square row rather than the corrected one, but it is there if your field expects it.
3. The Symmetric Measures table
Statistical significance is not the same as practical importance — with 10,000 cases, even a trivial association becomes “significant.” That is why you requested Phi and Cramer’s V:
- Phi — the effect size for 2×2 tables.
- Cramer’s V — the effect size for larger tables (SPSS prints it alongside Phi in all tables).
Both range from 0 (no association) to 1 (perfect association). A widely used rough guideline is .10 = small, .30 = medium, .50 = large, though sensible interpretation depends on your field. Report the effect size alongside the p-value so readers can judge whether the association actually matters.
Reporting in APA style (7th ed.)
APA style packs the whole result into one compact sentence. The template is:
χ²(df, N = n) = value, p = .xxx, V = .xx
Formatting rules to follow:
- Italicize the χ², p, and V symbols (in Word: select the symbol and press Ctrl+I).
- Report the test statistic to two decimal places and the p-value to three decimal places — or write p < .001 when SPSS prints .000.
- APA omits the leading zero for statistics that cannot exceed 1 (so p = .007, not 0.007), but keeps it for χ² and N (χ² = 9.85, N = 200).
- State the conclusion in plain words first, then the numbers in parentheses.
Put together, a results paragraph reads something like this (fill in your own numbers from the output):
“Beverage preference was significantly associated with gender, χ²(1, N = 200) = 9.85, p = .002, V = .22. A larger proportion of women than men preferred tea, while men were more likely than women to prefer coffee — a pattern visible in the row percentages of the contingency table.”
Notice the structure: a plain-language claim, the APA-formatted statistics, and one sentence describing the direction of the association. That last sentence is what makes the result useful — the numbers alone never tell the reader how the variables are related.
Key Takeaways
- The chi-square test of independence checks whether two categorical variables are associated — observed counts versus the counts you would expect if there were no association.
- In SPSS: Analyze → Descriptive Statistics → Crosstabs, then add Chi-square (and Phi/Cramer’s V) under Statistics and Expected counts plus percentages under Cells.
- Check the footnote in the output: if more than 20% of cells have expected counts below 5, the p-value may not be trustworthy.
- Read the Pearson Chi-Square row for the p-value — below .05 means the association is statistically significant.
- Always report an effect size (Phi for 2×2, Cramer’s V otherwise): significance tells you whether, effect size tells you how much.
- Report in APA as χ²(df, N = n) = value, p = .xxx, with a plain-language description of the pattern.
Frequently asked questions
What is the difference between the chi-square test of independence and the goodness-of-fit test?
The independence test uses two categorical variables and asks whether they are associated, working from a contingency table. The goodness-of-fit test uses one categorical variable and asks whether its observed distribution matches a hypothesized distribution (for example, an equal split). In SPSS, the goodness-of-fit version lives under Analyze → Nonparametric Tests → One Sample.
My expected counts are too low. What should I do?
You have three good options. First, collect more data if you can — small samples are the usual cause. Second, combine small categories in a way that still makes substantive sense (for example, merging “strongly disagree” with “disagree”). Third, for 2×2 tables use Fisher’s exact test, which does not rely on the large-sample approximation; click the Exact button in the Crosstabs dialog and choose Exact.
Which variable goes in rows and which in columns?
It does not change the χ² value or the p-value at all — the test is symmetric. Choose the layout that makes your percentages answer the question you care about. A common convention is to put the grouping or explanatory variable in the rows and read the row percentages: “among men, what percentage prefer tea?” versus “among women, what percentage prefer tea?”
My chi-square is significant — does that mean the effect is large?
Not necessarily. The p-value depends heavily on sample size: with a few thousand cases, even a trivially small association will be “significant.” This is exactly why you should report Phi or Cramer’s V. A significant χ² with V = .08 is a real but tiny association; with V = .45 it is a substantial one. Always report both.
Can I use the chi-square test with ordinal variables?
Yes — the test treats the categories as groups and works fine with ordinal data. However, it ignores the ordering, so it cannot detect a trend across ordered categories. If a trend is your hypothesis (for example, satisfaction rising with education level), the Linear-by-Linear Association row in the output, or a trend-specific test, is the more powerful choice.
Need this done on your data? Get a free quote → /services/