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
- 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.
- 02
Tick the factors
Under Factors (2 to 6) tick the categorical variables that form the table.
- 03
Pick the starting model
Set Model to Saturated (needed for partial associations and parameter estimates), All two-way interactions or Main effects only.
- 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.
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.
| Item | K | df | Likelihood Ratio Chi-Square | Likelihood Ratio Sig. | Pearson Chi-Square | Pearson Sig. | Number of Iterations |
|---|---|---|---|---|---|---|---|
| K-way and Higher Order Effects | 1 | 7 | 104.405 | <.001 | 110.400 | <.001 | 0 |
| 2 | 4 | 60.504 | <.001 | 59.901 | <.001 | 2 | |
| 3 | 1 | 0.002 | .967 | 0.002 | .967 | 12 | |
| K-way Effects | 1 | 3 | 43.901 | <.001 | 50.499 | <.001 | 0 |
| 2 | 3 | 60.502 | <.001 | 59.899 | <.001 | 0 | |
| 3 | 1 | 0.002 | .967 | 0.002 | .967 | 0 |
| Effect | df | Partial Chi-Square | Sig. | Number of Iterations |
|---|---|---|---|---|
| age | 1 | 0.250 | .617 | 2 |
| device | 1 | 1.962 | .161 | 2 |
| bought | 1 | 41.689 | <.001 | 2 |
| age*device | 1 | 53.699 | <.001 | 2 |
| age*bought | 1 | 0.018 | .892 | 2 |
| device*bought | 1 | 5.600 | .018 | 2 |
| Item | Chi-Square | df | Sig. |
|---|---|---|---|
| Likelihood Ratio | 0.020 | 2 | .990 |
| Pearson | 0.020 | 2 | .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.
Related procedures
- General Loglinear AnalysisGENLOG
- Crosstabs StatisticsCROSSTABS /STATISTICS
- Bayesian Test of IndependenceBAYES LOGLINEAR
- Correspondence AnalysisCORRESPONDENCE
- Multiple Correspondence AnalysisMULTIPLE CORRESPONDENCE
- Free SPSS alternative: full coverage list
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.
SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.