Foundations to Frontier
Tests
D. Classical Machine Learning › D6 Decision Trees

CHAID: Chi-Squared Automatic Interaction Detection

CHAID (Kass, 1980) builds multiway decision trees with statistical tests instead of impurity measures. For each categorical predictor it merges categories whose response distributions are not significantly different, tests the merged table with a χ² test, adjusts the p-value with a Bonferroni factor for all the ways the categories could have been grouped, and splits on the most significant predictor, stopping when nothing is significant. This page covers the merge step for nominal and ordinal predictors, Bonferroni factors (Stirling numbers), stopping by significance rather than pruning, and what the tests do and do not control. In the exercises you implement CHAID's merge-and-test machinery; then you measure spurious splits on pure-noise data and accuracy on real structure against unadjusted CHAID and CART.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Split only when the evidence says so

Suppose you want to know which ground-station sites drop more satellite passes. With six sites, ID3 or CART would happily split on “site” even if every site behaved the same and the differences were chance. CHAID asks a statistician’s question first: are these sites significantly different? It merges sites that look alike, checks the remaining differences with a χ² test, charges itself for having searched for the best grouping (a Bonferroni correction), and splits only if the result is still significant. The tree stops growing on its own, without pruning.

CHAID: merge categories that look alike, then test
A20%B25%C43%D60%E78%F15%
merge {A} + {B} (p = 0.59) → merge {AB} + {F} (p = 0.33) → merge {C} + {D} (p = 0.12)
groups ABF | CD | E · raw p 4.5e-11 × Bonferroni S(6, 3) = 90 → adjusted p 4.0e-9
Bars share a colour when CHAID has merged their sites. With few passes per site, noise hides real differences and CHAID merges aggressively (sometimes everything into one group: no split). With many passes it recovers the true pattern, three levels: AB(F) ≈ 20%, CD ≈ 50%, E ≈ 80%. The Bonferroni factor charges for having searched over groupings.
Why engineers care

CHAID is popular in survey analysis, marketing and reliability studies, where predictors are categorical (site, vendor, lot, shift) and stakeholders want multiway “segments” backed by p-values. Its significance-based stopping guards against reporting chance patterns as findings.

📝 Quick check (Level 0)
0/3 answered
  1. 1. CHAID chooses splits using…
  2. 2. CHAID stops growing when…
  3. 3. CHAID splits are…

Level 1: Beginner

★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.

Merging and testing by hand

Merge test. Sites A (20 drops in 100 passes) and B (22 in 100). The 2 × 2 table [[20, 80], [22, 78]] has expected counts 21 and 79 in each row:

χ² = 2·(1²/21) + 2·(1²/79) = 0.095 + 0.025 = 0.121, with 1 degree of freedom, so p = 0.73.

A and B are not significantly different, so CHAID merges them. Sites A (20/100) and C (50/100) give χ² = 19.8 and p ≈ 9·10⁻⁶, so they stay apart.

Bonferroni factor. If CHAID ends with r groups out of c original categories, it has implicitly chosen among all ways of grouping:

  • nominal predictors: S(c, r) groupings (Stirling numbers of the second kind). For example S(6, 3) = 90, S(6, 2) = 31 and S(4, 2) = 7;
  • ordinal predictors, where only adjacent categories may merge: C(c − 1, r − 1). For example C(5, 2) = 10 for 6 ordered levels in 3 groups.

Example. The merged 3-group table has raw p = 0.001. For a nominal predictor the adjusted p is 0.001 × 90 = 0.09, which is not significant at 0.05. For an ordinal predictor it is 0.001 × 10 = 0.01, which is significant.

The steps in plain English:

  1. For each predictor, merge the least-different pair of categories until all remaining pairs differ significantly.
  2. Test the merged predictor × outcome table and multiply its p-value by the Bonferroni factor.
  3. Split on the predictor with the smallest adjusted p, if it is below α (one branch per merged group).
  4. Recurse in each branch; stop when nothing is significant or nodes get too small.
📝 Quick check (Level 1)
0/3 answered
  1. 1. p = 0.73 for two sites means CHAID will…
  2. 2. S(4, 2) equals…
  3. 3. Ordinal predictors may merge…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.

The algorithm in detail

Response types. Categorical outcomes use the Pearson χ² test (or likelihood ratio). Continuous outcomes use the F-test, as in ANOVA. Ordinal outcomes use a test for trend.

Predictor types.

  • nominal: any categories may merge;
  • ordinal: only adjacent categories may merge;
  • “floating”: ordinal plus a missing category that may join any group;
  • continuous predictors are first binned (for example into deciles).

Merge step (Kass, 1980). Repeat: find the pair with the largest p-value (least different). If it exceeds α_merge, merge the pair. Optionally, re-split merged groups if some subset now differs significantly.

Bonferroni adjustment. p_adj = B·p, where B counts the ways the c categories could yield r groups: S(c, r) for nominal and C(c − 1, r − 1) for ordinal.

Exhaustive CHAID (Biggs, de Ville and Suen, 1991) keeps merging all the way down to two groups and picks the most significant grouping along the path, a more thorough search.

CHAID versus CART.

CHAID CART
Splits multiway (merged categories) binary
Criterion adjusted χ² / F p-value impurity decrease
Size control stop when nothing is significant grow, then prune by CV
Output segments with p-values prediction-focused tree
Weak spots many tests, binning of numerics no significance notion, variable-selection bias
🐍 Exercise 1: CHAID's merge-and-test machinery
Implement the χ² p-value, Stirling numbers of the second kind, Bonferroni factors (nominal and ordinal), the merge step for nominal and ordinal predictors, and the adjusted predictor p-value; verify that CHAID merges categories with equal rates, respects ordinal adjacency, and gives a noise predictor no significance.
📝 Quick check (Level 2)
0/3 answered
  1. 1. For a continuous outcome, CHAID uses…
  2. 2. Exhaustive CHAID differs by…
  3. 3. Continuous predictors in CHAID are…

Level 3: Advanced

★★★★☆ Advanced⏱ 30 minGraduate level, with full derivations and proofs.

Theory

What the Bonferroni factor controls. It accounts for searching over groupings within one predictor, so a single predictor’s adjusted p-value is valid (if conservative) under the null. It does not account for:

  • the choice among several predictors (another multiple comparison);
  • the many nodes tested down the tree.

Exercise 2 shows this. On pure-noise data with 8 predictors, Bonferroni CHAID still made a spurious root split in 17% of runs, more than α = 5%. With 8 independent tests at 0.05, up to 1 − 0.95⁸ ≈ 34% would be expected without any adjustment.

Conservativeness and selection bias. Bonferroni over-penalises predictors with many categories, the opposite of ID3’s bias. In exercise 2, every spurious split it made used a predictor with few levels. Conditional inference trees (Hothorn, Hornik and Zeileis, 2006) use permutation tests to get unbiased variable selection with proper multiplicity control.

Statistical tests as stopping rules. Pre-pruning by significance can stop too early when two predictors interact (as in XOR), since neither is significant alone. Post-pruning (CART) can recover such structure. In exchange, CHAID’s trees come with interpretable p-values for each split.

Interview questions.

  • Why are unadjusted χ² tests on optimised groupings invalid? The grouping was chosen to maximise the statistic, so its null distribution is not χ². Bonferroni (or permutation) corrects this.
  • When choose CHAID over CART? When predictors are categorical, stakeholders want multiway segments with significance statements, and data are plentiful. For pure prediction accuracy, prefer pruned CART or ensembles.
📝 Quick check (Level 3)
0/3 answered
  1. 1. CHAID's Bonferroni factor accounts for…
  2. 2. Bonferroni-adjusted CHAID tends to under-select predictors with…
  3. 3. Significance-based stopping can miss…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Do the tests prevent spurious splits?

History.

  • AID (Morgan and Sonquist, 1963) and THAID (Messenger and Mandell, 1972) were early survey-analysis trees.
  • Kass (1980) introduced CHAID with χ² merging and Bonferroni adjustment.
  • Biggs, de Ville and Suen (1991) proposed exhaustive CHAID.
  • CHAID shipped in SPSS AnswerTree and became a staple of market segmentation.
  • Conditional inference trees (2006) put statistical stopping on a permutation-test footing.

Exercise 1.

  • S(4, r) = 1, 7, 6, 1, so a 4-category nominal predictor split into 2 groups carries B = 7 (ordinal: 3).
  • CHAID merged A with B and C with D (adjusted p = 1.9·10⁻³³).
  • Under ordinal order 1–5 it kept 5 apart, while nominal merging joined 5 with 1–2.
  • A 10-level noise predictor got adjusted p = 1.0.

Exercise 2. Setup: 8 nominal predictors with 2–15 levels and a binary label, n = 300.

Method spurious root split (null data) spurious splits on ≥ 10-level predictors accuracy (signal) nodes
CHAID, Bonferroni 17% 0% 0.737 5.9
CHAID, unadjusted 100% 83% 0.705 15.7
CART, depth 4 100% 83% 0.693 24.6
  • Without adjustment, every null dataset produced a split, mostly on many-level predictors, where the best grouping looks impressive by chance.
  • Bonferroni CHAID refused most spurious splits, but not all: 17% against a nominal 5%, because it does not correct for choosing among 8 predictors.
  • On real structure, the adjusted tree was the smallest and the most accurate. CHAID’s significance stopping worked as regularisation, while depth-4 CART without pruning overfit.
  • Caveat: pruned CART would close much of the accuracy gap. The point here is that statistical stopping, not just impurity, controls false discoveries.
🐍 Exercise 2 (research): spurious splits and accuracy
On pure-noise and structured categorical data, compare Bonferroni-adjusted CHAID, unadjusted CHAID and a depth-4 CART tree: how often each splits noise at the root (and on which predictors), and test accuracy and size on structured data.

CHAID in AI, robotics and aerospace

  • Reliability segmentation: failure rates by vendor, lot, site and shift, with significance statements.
  • Ground-segment analytics: which stations, antennas or passes drive outages.
  • Survey and human-factors studies: operator questionnaires analysed by demographic segments.
  • Statistical stopping ideas also appear in streaming trees (Hoeffding trees) and conditional inference forests.

References

  1. G. V. Kass (1980). “An exploratory technique for investigating large quantities of categorical data.” Applied Statistics 29(2).
  2. D. Biggs, B. de Ville, E. Suen (1991). “A method of choosing multiway partitions for classification and decision trees.” Journal of Applied Statistics 18(1).
  3. T. Hothorn, K. Hornik, A. Zeileis (2006). “Unbiased recursive partitioning: a conditional inference framework.” JCGS 15(3).
  4. J. N. Morgan, J. A. Sonquist (1963). “Problems in the analysis of survey data, and a proposal.” JASA 58.
  5. W.-Y. Loh (2014). “Fifty years of classification and regression trees.” International Statistical Review 82(3).