SPSS command: SPSS HILOGLINEAR

Hierarchical loglinear analysis of multi-way tables

Hierarchical loglinear analysis looks for the simplest set of associations that reproduces a cross-tabulation of two to six categorical variables.

Free · No account · Files stay on your device · Updated 18 October 2026

What it tells you

Crosstabs runs the SPSS HILOGLINEAR procedure on your device: it tests whole orders of interaction (K-way effects), measures each effect's partial association, and removes unnecessary terms by backward elimination until the remaining generating class still fits the table.

  • Whether all effects of a given order — all two-way associations, the three-way interaction — can be dropped together (K-Way and Higher-Order Effects).
  • How much each individual association contributes after adjusting for the others (Partial Associations).
  • The smallest hierarchical model that still fits, step by step (Step Summary), and its likelihood-ratio and Pearson fit.
  • Which cells the final model misses, from observed and expected counts with residuals.

When to use it

Use it when

  • Three or more categorical variables and you want to know which pairs are associated after accounting for the rest.
  • Checking for conditional independence, such as whether age and purchase are unrelated once device is known.
  • Survey or audit tables where no variable is singled out as the outcome.

Use something else when

  • Only two variables: a chi-square test in Crosstabs answers the same question directly.
  • One variable is clearly the response: a logit model in general loglinear analysis or logistic regression is easier to interpret.
  • Many sparse cells, such as six factors with few cases: expected counts become tiny and chi-square tests unreliable.

How to run it in Crosstabs

  1. 01

    Choose Hierarchical loglinear analysis

    Open case-level data in Statistics mode and, in the General linear model group, pick Hierarchical loglinear analysis (HILOGLINEAR). For an aggregated table, declare the count column as a frequency weight.

  2. 02

    Tick the factors

    Under Factors (2 to 6) tick the categorical variables that form the table.

  3. 03

    Pick the starting model

    Set Model to Saturated (needed for partial associations and parameter estimates), All two-way interactions or Main effects only.

  4. 04

    Backward elimination and run

    Keep Use backward elimination ticked to drop effects whose removal p exceeds .05, then click Run.

Worked example

Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.

Try with example data

Data

400 synthetic shoppers cross-classified by age (Under 35, 35+), device (Mobile, Desktop) and bought (Yes, No). Younger shoppers use mobile more, and mobile shoppers buy less often; age has no direct link to buying (fixed seed). Model = Saturated with Use backward elimination ticked.

K-Way and Higher-Order Effects
ItemKdfLikelihood Ratio Chi-SquareLikelihood Ratio Sig.Pearson Chi-SquarePearson Sig.Number of Iterations
K-way and Higher Order Effects17104.405<.001110.400<.0010
2460.504<.00159.901<.0012
310.002.9670.002.96712
K-way Effects1343.901<.00150.499<.0010
2360.502<.00159.899<.0010
310.002.9670.002.9670
Partial Associations
EffectdfPartial Chi-SquareSig.Number of Iterations
age10.250.6172
device11.962.1612
bought141.689<.0012
age*device153.699<.0012
age*bought10.018.8922
device*bought15.600.0182
Goodness-of-Fit Tests
ItemChi-SquaredfSig.
Likelihood Ratio0.0202.990
Pearson0.0202.990

Model (generating class): age*device, device*bought.

How to read it

The three-way interaction is negligible (K = 3: likelihood-ratio χ²(1) = 0.002, p = .967). Partial associations show significant age×device (χ² = 53.70, p < .001) and device×bought (χ² = 5.60, p = .018) links but no age×bought link (p = .892). Backward elimination keeps exactly those two generating classes: the final model fits with χ²(2) = 0.020, p = .990 — age and buying are independent once device is known.

Output tables explained

Data Information
Valid, missing and weighted cases, and the number of categories of each factor.
K-Way and Higher-Order Effects
Likelihood-ratio and Pearson tests that all effects of order K and higher are zero, and that the K-way effects alone are zero.
Partial Associations
For each effect, the partial chi-square from removing it from the model of its order; shown for a saturated starting model.
Parameter Estimates
Saturated-model effect-coded (sum-to-zero) estimates with 0.5 added to every cell, with Z tests and confidence intervals.
Step Summary
Each elimination step: the generating class, the effect deleted and its chi-square change.
Goodness-of-Fit Tests
Likelihood-ratio and Pearson chi-square of the final model; a large p means the model reproduces the table. Cell Counts and Residuals follow.

Assumptions and notes

  • Cell counts are independent Poisson or multinomial counts — each case appears in one cell only.
  • Hierarchy: whenever an interaction is in the model, all of its lower-order terms are too.
  • Expected counts are not too small; most should exceed 5 for the chi-square approximations.

How the results are validated

HILOGLINEAR is checked against Poisson GLM fits in statsmodels and a NumPy iterative-proportional-fitting implementation on a four-factor table: K-way likelihood-ratio and Pearson statistics and partial associations agree within 1e-7, saturated effect-coded estimates and standard errors (delta 0.5) within 1e-8, and backward elimination must reach the same final model, with its fit statistics within 1e-7 and identical df. Validation evidence

Questions

What is a generating class?

The highest-order terms of a hierarchical model. A generating class of age*device, device*bought implies the main effects of all three variables and those two associations, but no age*bought term.

Why are expected counts fitted to full convergence?

Iterative proportional fitting here runs until the expected counts stop changing, rather than stopping after SPSS's default 20 cycles, so they are exact maximum-likelihood values. Results can differ from SPSS in the last decimals when SPSS stopped early.

How do I analyse a table I only have as counts?

Enter one row per cell with a count column, set it as the workspace weight and declare it a frequency weight. Each row then counts as that many identical cases.

Why are partial associations missing?

They and the parameter estimates are computed only when Model is Saturated. Start from the saturated model and let backward elimination simplify it.

Run Hierarchical Loglinear Analysis on your own data

Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.

Open the workspace

SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.