Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 39 · Descriptive Statistics

SPSS Crosstabs and Chi-Square: Tables, Percentages, Residuals, Cramér's V

Build contingency tables with SPSS Crosstabs: choose rows and columns, counts and percentages, expected counts, chi-square, Fisher's exact test, Phi, Cramér's V and adjusted residuals.

A crosstab (cross-tabulation or contingency table) counts how cases fall into the combinations of two categorical variables: gender by smoking status, plan by whether the customer renewed, region by preferred product. It is the main descriptive tool for two categorical variables, and with the chi-square option it also performs the first inferential test of Chapter 5, the test of association. This lesson covers the dialog, how to read percentages, the chi-square table and effect size.

Build a crosstab

Analyze > Descriptive Statistics > Crosstabs...

  • Row(s): one or more variables whose categories form the rows.
  • Column(s): the variables for the columns.
  • Layer: an optional third variable that splits the table into several (a control variable).
  • Display clustered bar charts and Suppress tables checkboxes.
  • Buttons: Exact..., Statistics..., Cells..., Format....

Rule of thumb: put the explanatory (independent) variable in the rows, the outcome (dependent) variable in the columns, and ask for Row %. Each row then shows how that group splits across the outcome. For "Does the plan affect renewal?", plan is explanatory, so show percentages within each plan.

Cells...

Group Choices
Counts Observed, Expected, Hide small counts
Percentages Row, Column, Total
Residuals Unstandardized, Standardized, Adjusted standardized
Noninteger Weights Round cell counts (default), truncate, no adjustments
  • Row %: each cell divided by its row total. Each row sums to 100%.
  • Column %: each cell divided by its column total. Each column sums to 100%.
  • Total %: each cell divided by the grand total.

The question you ask decides the percentage. "Of those on the Plus plan, how many renewed?" asks for a percentage within the Plus plan, so the Plus plan must be the row when using Row %, or the column when using Column %.

Statistics...

Tick Chi-square for the test. Other groups:

  • Nominal: Contingency coefficient, Phi and Cramér's V, Lambda, Uncertainty coefficient.
  • Ordinal: Gamma, Somers' d, Kendall's tau-b, tau-c.
  • Nominal by Interval: Eta.
  • Correlations (Pearson and Spearman), Kappa (agreement between raters), Risk (odds ratio and relative risk for 2x2 tables), McNemar, Cochran's and Mantel-Haenszel statistics.

The syntax:

TEXT
CROSSTABS
  /TABLES=plan BY renewed
  /FORMAT=AVALUE TABLES
  /STATISTICS=CHISQ PHI
  /CELLS=COUNT EXPECTED ROW ASRESID
  /COUNT ROUND CELL.

Read the table

For each cell you may see the Count, the Expected Count, the % within the row or column and the Adjusted Residual. The Total row and column are the marginals. Missing cases are dropped, and the output title says how many cases were Valid and Missing.

The chi-square test of independence

The null hypothesis: the two variables are independent (not associated). The test compares the observed counts with the expected counts under independence:

expected = (row total x column total) / grand total

chi-square = sum of (observed - expected)^2 / expected over all cells

with df = (rows - 1) x (columns - 1). A large chi-square (small Sig.) means the observed pattern would be unlikely if the variables were independent.

Python Stand-in: chi-square by hand, with cell contributions

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The Chi-Square Tests table

SPSS prints several rows:

Row When to use
Pearson Chi-Square The standard test; valid when expected counts are large enough
Continuity Correction 2x2 tables only; a conservative adjustment
Likelihood Ratio An alternative test; similar to Pearson in large samples
Fisher's Exact Test 2x2 tables; use when expected counts are small
Linear-by-Linear Association Tests a linear trend; meaningful only for ordered variables
N of Valid Cases The number of cases analyzed

The footnote under the table is important: "0 cells (0.0%) have expected count less than 5. The minimum expected count is ..." (SPSS fills in your own numbers). The usual condition for the Pearson test: no expected count below 1, and at least 80% of cells with expected counts of 5 or more. If it fails, combine categories, or use Fisher's exact test (2x2) or the Exact... button (Exact Tests module) for larger tables.

Report it in this form, with your own numbers: "There was a significant association between plan and renewal, chi-square(df, N = total) = value, p = value."

Effect size

A significant chi-square only says the association is unlikely to be zero. Phi (for 2x2) and Cramér's V (any size) tell you how strong it is, from 0 (no association) to 1 (perfect). Tick Phi and Cramér's V under Nominal. SPSS puts them in the Symmetric Measures table. Rough guidelines for tables where the smaller dimension minus one is 1: 0.1 small, 0.3 medium, 0.5 large; the thresholds shrink as the table gets bigger.

Cramér's V = sqrt(chi-square / (N x min(rows - 1, columns - 1)))

Adjusted standardized residuals

In a large table you want to know which cells drive the association. The adjusted standardized residual is roughly a z-score for each cell: values above about +1.96 (or below -1.96) mark cells with significantly more (or fewer) cases than expected under independence.

Python Stand-in: Cramér's V and adjusted residuals

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Controlling for a third variable

Put another variable in Layer 1 of 1 to produce a separate crosstab (and chi-square) for each of its categories, for example the plan-renewal table for each region. If the association disappears or reverses inside the layers, the third variable may be confounding it. (A related trap is Simpson's paradox.)

Ordinal and special cases

  • For two ordinal variables, prefer Gamma, Kendall's tau-b or Spearman correlation over plain chi-square, because chi-square ignores the order.
  • For paired yes/no data (before and after), use McNemar.
  • For 2x2 risk comparisons, tick Risk to get the odds ratio and its confidence interval.
  • For many categories with small counts, merge sensible categories before the test.

Common mistakes

  • Using percentages in the wrong direction and reaching the opposite reading.
  • Running chi-square on percentages or means instead of counts of cases.
  • Ignoring the expected-count footnote.
  • Treating a significant result as a strong effect, with no look at Cramér's V.
  • Running chi-square on dependent (repeated) observations; the cases must be independent.
  • Testing many pairs of variables and reporting only the significant ones.

Check your understanding

Quick check · 5 questions

of 5 answered You scored / 5 · perfect!

  1. 1. In a plan-by-renewal crosstab, you want the share of each plan's customers who renewed. Which percentage should you display (with plan in the rows)?

    With plan in the rows, Row % divides each cell by its plan's total, giving the renewal share within each plan.
  2. 2. What is the null hypothesis of the chi-square test of independence?

    The test starts from independence and asks whether the observed counts are unlikely under it.
  3. 3. In a 2x2 table, one expected count is 3. Which row of the Chi-Square Tests table is the safer choice?

    Fisher's exact test does not rely on large expected counts.
  4. 4. What does Cramér's V measure?

    Cramér's V is an effect size from 0 to 1 for categorical association.
  5. 5. An adjusted standardized residual of +2.8 in a cell means:

    Values beyond about +1.96 show a cell with more cases than independence would predict.

Summary

  • Crosstabs counts cases in combinations of two categorical variables; choose Row, Column or Total percentages to match your question.
  • The chi-square test compares observed with expected counts; check the expected-count footnote.
  • Use Fisher's exact test for small 2x2 tables, and Cramér's V or Phi for effect size.
  • Adjusted standardized residuals show which cells depart from independence.
  • Add a layer variable to control for a third factor.

Next: Compare Means and Summary Tables