G-Test (Likelihood-Ratio χ²)
Coming soonCategorical
This test is implemented and is currently going through StatMinds’ production verification: every statistic is independently checked against a trusted reference (scipy / R), locked with regression tests, and the screen is exercised across assumption-met/violated and significant/non-significant scenarios before it opens up.
See what’s live nowLikelihood-ratio alternative to Pearson χ² for contingency tables.
G = 2 · Σ O · ln(O/E); under H₀ of independence G ~ χ²((r-1)(c-1)) asymptotically. Slightly more robust to sparse cells than Pearson χ² and has a clean information-theoretic interpretation (G = 2N × KL-divergence between observed and expected distributions). Reports G, p, Williams continuity correction, and Cramér's V effect size. Standard tool in ecology, population genetics, and bioinformatics where likelihood-ratio statistics are the expected currency.
Worked example
Are two categorical variables associated (likelihood-ratio version)?
The G-test (likelihood-ratio χ²) tests contingency-table association, an alternative to Pearson's chi-square.
The variables were associated, G²(2) = 10.6, p = .005.
A G-test showed a significant association, G²(2) = 10.6, p = .005.
When to use it
- Sparse r × c contingencyAn ecology study cross-tabulates pollinator species (5 species) with plant host (4 hosts); several cells have < 5 expected.
- Information-theoretic test in ecology / population geneticsPopulation geneticist tests whether allele frequencies (3 alleles) differ across 4 populations using G-test on a 3×4 table; reports G with information-theoretic interpretation as 2
When NOT to — use instead
- Paired same-subject dataG-test assumes INDEPENDENT subjects in cells. → McNemar's Test (paired 2\u00d72)
- Continuous outcomeG-test is for categorical data only. → One-Way ANOVA (3+ groups)
- Very small samples (any cell expected < 1)Asymptotic G breaks down. → Fisher's Exact Test
- Ordered predictor with binary outcomeWhen predictor is ordinal AND outcome binary, Cochran-Armitage trend is more powerful for monotone-trend hypotheses. → Cochran-Armitage Trend Test
Hypotheses
Parameter tested: joint distribution P(row, col)
Assumptions (and what to do if they fail)
Check: Report min E; count cells below 5.
If violated: Very sparse tables still break the χ² approximation, though G is less biased than Pearson χ² in this regime.
Check: G_williams = G / q, where q = 1 + (a² − 1) / (6 · N · df) with a = sum of 1/row_total + sum of 1/col_total − 1.
If violated: Williams correction is automatically applied and reported; it biases G slightly toward the null.
Ready to run a G-Test (Likelihood-Ratio χ²) on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →