ADescribe · Guide test 124
Cressie–Read power divergence tests
A family of count based goodness of fit tests containing Pearson and likelihood ratio cases.
Do it in CodeSplash
In the app, set it up in Analyze with one of these methods:
- χ² test of independence — Are two categorical variables associated?
- Goodness of fit (χ² / G test) — Do the observed category frequencies match expected proportions?
In χ² test of independence, choose Test statistic = Cressie–Read (λ = 2/3 or your λ). In Goodness of fit (χ² / G test), choose Statistic = Cressie–Read (λ = 2/3 or your λ).
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Cressie–Read power divergence tests
Your data
Edit the countsDashed lines: the counts H₀ expects (equal shares).
If H₀ were true
- The reference: how CR varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .015).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- family index: 1 gives Pearson's χ², 0 the G test, ⅔ Cressie and Read's compromise
The verdict
CR(3) = 10.51, p = .015
p ≤ α = .050: reject H₀
λ = ⅔ keeps the χ² reference accurate in smaller samples than either Pearson or G.
- Statistic
- 10.512
- p-value
- 0.0147
Cressie–Read power divergence tests on 41, 36, 24, 19 across 4 categories: CR(3) = 10.51, p = .015. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: observed categorical frequencies follow specified/fitted expected probabilities.
Assumptions
Independent multinomial counts; regular expectations and sufficient sample size.
Formula
Parameters and notation
λ is the divergence tuning parameter: λ=1 gives Pearson; limit λ→0 gives G²; λ=2/3 is a common Cressie–Read choice.
Structure of the method
Apply a power-divergence transformation to observed-to-expected count ratios and sum over cells. Pearson and likelihood-ratio tests are special cases or limits; the selected lambda determines which discrepancies and sparse-cell configurations receive emphasis.
Estimated and nuisance parameters
Null category probabilities may be fixed or fitted from a parametric count model. The observed total and expected counts are computed summaries. Lambda is a test-design choice, not a fitted nuisance parameter.
Settings and design choices
Prespecify lambda, category construction, sparse-cell pooling, degrees-of-freedom adjustment and significance level. Implement the lambda-zero or lambda-minus-one limits separately and define zero-count behavior rather than relying on undefined floating-point expressions.
Fitting and adaptation
Estimate null parameters with the stated fitting method, then use a justified chi-square limit or simulate multinomial counts and repeat the full fit. For new datasets follow the same divergence and binning rule. Selecting lambda after observing rejection strength requires a calibrated maximum/search procedure or an independent selection sample, not ordinary fine-tuning.
Sensitivity and robustness
Sparse expectations, structural zeros, clustered observations and overdispersion can invalidate the usual reference. Related lambdas applied to the same counts are correlated analyses, not independent confirmations. Report component residuals and the selected divergence to make a significant global discrepancy interpretable.
How to use and calibrate
Use χ² with appropriate fitted-parameter degrees of freedom or null simulation; define zero-cell limits carefully.
Example application
Assess categorical model fit using an explicitly chosen divergence.
Interpretation and pitfalls
Watch out
These are related statistics within one family, not independent evidence from repeated tests on the same table.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Cressie–Read member lambda=2/3; Pearson and likelihood-ratio G are other members. This example has no zero observed cells.
Validated — Executed successfully in the validation environment · needs numpy, scipy
import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
print(stats.power_divergence([18,22,17,23,20],f_exp=[20]*5,lambda_=2/3))
Output
Power_divergenceResult(statistic=np.float64(1.300902949932342), pvalue=np.float64(0.8612223141554006))
Validated — Executed successfully in the validation environment · needs Base/standard library
obs<-c(18,22,17,23,20);E<-rep(20,5);lambda<-2/3
T<-2/(lambda*(lambda+1))*sum(obs*((obs/E)^lambda-1));print(c(statistic=T,p=pchisq(T,4,lower.tail=FALSE)))
Output
statistic p 1.3009029 0.8612223
Sources
- SciPy — SciPy · power_divergencedocs.scipy.org
- scipy.stats.power_divergencedocs.scipy.org
- Statistics guide v4 (historical):
- R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 124, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT124.