Skip to content

ADescribe · Guide test 105

Shapiro–Francia test

Tests normality using a correlation with expected normal order statistics.

Runs in CodeSplashPython (calls R) example not runR example validated

Do it in CodeSplash

In the app, set it up in Analyze with one of these methods:

In Normality test (one test), choose Test = Shapiro–Francia.

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 · Shapiro–Francia test

40
0.60

Sinh–arcsinh shape: 0 is symmetric.

1.00

Below 1: heavier tails than normal; 1 with ε = 0 is exactly normal.

0.050

Your data

Drag a point or use ↑/↓ to change it
Sample · n = 40 · mean 0.63

If H₀ were true

z = 0.81
  1. The reference: how z varies across samples when H₀ is true (Royston's normal approximation).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .208).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

W′=cor(x(i), mi)2,z=ln⁡(1−W′)−μnσnW' = \mathrm{cor}\left(x_{(i)},\,m_i\right)^2,\qquad z = \dfrac{\ln(1-W')-\mu_n}{\sigma_n}

With your numbers

W′=0.96,z=0.81W' = 0.96,\quad z = 0.81
mim_i
approximate expected normal order statistics
μn, σn\mu_n,\ \sigma_n
Royston's normalizing constants for ln(1 − W′)

The verdict

W′ = 0.96, z = 0.81, p = .208

p > α = .050: compatible with H₀

A simpler cousin of Shapiro–Wilk: the squared correlation of a Q–Q plot. Good for larger samples and heavy-tailed alternatives.

Statistic
0.813
p-value
0.2080
Shapiro–Francia test on Sample: n = 40: W′ = 0.96, z = 0.81, p = .208. The p-value is above α = .050, so the data are compatible with H0.

Shapiro–Francia test on Sample: n = 40: W′ = 0.96, z = 0.81, p = .208. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: a normal population generated the observations.

Assumptions

Independent identically distributed continuous observations; H0 is a normal distribution with unknown mean and positive variance. Censoring, truncation, clustering and fitted regression residuals require different calibration.

Formula

W′=Corr⁡(x(i),mi)2W^\prime=\operatorname{Corr}(x_{(i)},m_i)^2

Parameters and notation

mi is the expected ith standard normal order statistic, often approximated by normal quantiles; sample size n controls calibration.

Structure of the method

Order the sample and compute its squared correlation with expected normal order statistics or the specified quantile approximation. A dedicated Shapiro–Francia calibration transforms this statistic using sample size; borrowing Shapiro–Wilk p-values would mismatch the statistic and its null distribution.

Estimated and nuisance parameters

Estimate sample location and scale implicitly through correlation. The normal-order quantile convention is fixed by the implementation, not selected from the data. The simplified weighting differs from Shapiro–Wilk’s covariance-adjusted coefficients even when both produce statistics near one.

Settings and design choices

Specify the implementation and its quantile/p-value approximation, missing-value policy, and significance level. The cited nortest implementation accepts 5–5000 observations. A valid input size is only a software constraint; it does not certify adequate sensitivity to the departures relevant to the application.

Fitting and adaptation

Re-sort and recalibrate for new observations. If observations are fitted residuals or transformed after model selection, simulation must include the relevant estimation/selection steps to mimic the intended null. There is no neural fine-tuning; parameter-free normality testing still depends on data-generation assumptions.

Sensitivity and robustness

Ties from rounding, extreme observations, mixtures, censoring, and dependence affect the order-statistic pattern. A high p-value is not the posterior probability that normality is true. Compare the Q–Q pattern and scientific consequences of deviations, especially in the tails or near decision thresholds.

How to use and calibrate

Use the Shapiro–Francia lower-tail reference, not the Shapiro–Wilk table.

Example application

Assess normality with a normal order statistic correlation test.

Interpretation and pitfalls

Watch out

This simplifies Shapiro–Wilk weights; the statistics and p values are not interchangeable.

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.

Python · invokes R

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::sf.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()
R

Validated — Executed successfully in the validation environment · needs nortest

set.seed(2026)
x <- rnorm(60)
print(nortest::sf.test(x))
Output
	Shapiro-Francia normality test

data:  x
W = 0.97903, p-value = 0.3284

Sources

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 105, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT105.