ADescribe · Guide test 111
Pearson chi square normality test
Compares binned frequencies with frequencies expected under a fitted normal distribution.
Do it in CodeSplash
In the app, set it up in Analyze with one of these methods:
- Normality tests (battery) — Is a numeric variable (or each group of it) plausibly normal — by tests and by shape?
- Normality test (one test) — Is a numeric variable (or each group of it) plausibly normally distributed?
In Normality test (one test), choose Test = Pearson χ².
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 · Pearson chi-square normality test
Sinh–arcsinh shape: 0 is symmetric.
Below 1: heavier tails than normal; 1 with ε = 0 is exactly normal.
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how P 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 = .035).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- number of equiprobable classes, ⌈2n^{2/5}⌉
- observed count in class j
- k − 1 minus the two estimated parameters
The verdict
P(6) = 13.55, p = .035
p ≤ α = .050: reject H₀
Binning throws information away, so it is the weakest normality test here; it is the template for χ² goodness of fit with estimated parameters.
- Statistic
- 13.550
- p-value
- 0.0351
Pearson chi-square normality test on Sample: n = 40: P(6) = 13.55, p = .035. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: observations follow a normal distribution.
Assumptions
Independent observations; prespecified binning or a justified data-dependent binning scheme; enough expected counts.
Formula
Parameters and notation
B bins with endpoints lb,ub. Estimation method and bin selection determine the valid reference; B−3 is conventional when two parameters are appropriately fitted to grouped counts.
Structure of the method
Create bins, compute observed frequencies, estimate normal probabilities between bin boundaries and sum Pearson count discrepancies. Binning and normal-parameter estimation are integral steps in the procedure; their order and data dependence determine which chi-square approximation is justified.
Estimated and nuisance parameters
Normal mean/scale are nuisance quantities. Observed and expected bin counts are computed summaries. Bin boundaries may be fixed scientifically or generated by a declared rule, but are not model weights.
Settings and design choices
Select the number of bins, boundary rule, pooling of sparse bins, estimation method and adjusted versus unadjusted reference. More bins expose localized misfit but reduce expected counts and can undermine approximation accuracy.
Fitting and adaptation
For reliable custom calibration, simulate from the fitted normal model, repeat parameter fitting, recreate any adaptive boundaries and recount every replicate. Do not merely subtract two degrees of freedom after arbitrary preprocessing. New data require the same fitting/bucketing rule, not transferred fitted counts. Record bins and expected frequencies with the result.
Sensitivity and robustness
Results can change materially with bin origin and width. Very sparse expected cells, zero fitted probabilities and adaptive bin searches require special handling. Ungrouped mean/SD estimates do not automatically yield the textbook grouped-data chi-square reference; the source documentation explicitly distinguishes these cases.
How to use and calibrate
Use the source’s adjusted calibration or bootstrap the entire fitting/binning procedure.
Example application
Assess a normal model when data are available as grouped frequencies.
Interpretation and pitfalls
Watch out
B−3 is not automatically exact when parameters are estimated from ungrouped data and bins are adaptive.
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
Normality is assessed for independent observations. For model diagnostics, test residual assumptions in context; do not automatically choose a downstream test based on a preliminary normality p-value.
Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: nortest
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
x <- rnorm(60)
print(nortest::pearson.test(x))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Validated — Executed successfully in the validation environment · needs nortest
set.seed(2026)
x <- rnorm(60)
print(nortest::pearson.test(x))
Output
Pearson chi-square normality test data: x P = 9.3, p-value = 0.3176
Sources
- nortest — nortest · pearson.testAuthor documentation/source reviewed: nortest 1.0-4.search.r-project.org
- pearson.testsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 111, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT111.