G-Test (Likelihood-Ratio χ²)

Coming soon

Categorical

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 now

Likelihood-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.

Result

The variables were associated, G²(2) = 10.6, p = .005.

How you'd report it (APA)

A G-test showed a significant association, G²(2) = 10.6, p = .005.

When to use it

  • Sparse r × c contingency
    An ecology study cross-tabulates pollinator species (5 species) with plant host (4 hosts); several cells have < 5 expected.
  • Information-theoretic test in ecology / population genetics
    Population 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

Hypotheses

H₀: the two categorical variables are independent.
Hₐ: the two variables are associated.

Parameter tested: joint distribution P(row, col)

Assumptions (and what to do if they fail)

Expected counts are adequate (Cochran's rule — at least 80% of cells with E ≥ 5 AND no cell with E < 1).medium

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.

Williams continuity correction is beneficial for small / moderate samples and for 2 × 2 tables specifically.low

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 →