Skip to content

BCompare groups · Guide test 165

Royston multivariate normality test

Combines transformed marginal normality statistics while accounting for correlations.

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

Do it in CodeSplash

In the app, set it up in Analyze with this method:

In Multivariate normality tests, choose Test = Royston.

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 · Royston multivariate normality test

40
0.50
0.00

0 is symmetric.

0.70

Below 1: heavier tails than normal.

0.050

Your data

Simulated with a known ρ

If H₀ were true

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

The formula

H=ep∑j[Φ−1(12Φ(−zj))]2∼χe2H = \dfrac{e}{p}\sum_j \Bigl[\Phi^{-1}\bigl(\tfrac12\Phi(-z_j)\bigr)\Bigr]^2 \sim \chi^2_e

With your numbers

H=4.93,e=2.00,n=40H = 4.93,\qquad e = 2.00,\qquad n = 40
zjz_j
Royston's normalizing transform of margin j's Shapiro–Wilk W (Shapiro–Francia W′ when that margin's kurtosis exceeds 3)
ee
equivalent degrees of freedom (ν in the guide's formula): between 1 and p, smaller when the margins are correlated

The verdict

H(2.00) = 4.93, p = .085

p > α = .050: compatible with H₀

Royston's test only looks at the margins, so a non-normal joint shape with normal margins passes it.

Statistic
4.927
p-value
0.0852
Royston multivariate normality test on 40 (x, y) pairs: H(2.00) = 4.93, p = .085. The p-value is above α = .050, so the data are compatible with H0.

Royston multivariate normality test on 40 (x, y) pairs: H(2.00) = 4.93, p = .085. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: multivariate normality, assessed through correlated marginal normality statistics.

Assumptions

Independent identically distributed p-dimensional observations; positive definite covariance and sufficient n relative to p. The null is a multivariate normal distribution with unknown mean/covariance. The cited implementation supports 4≤n≤2000.

Formula

H=νp∑j=1p[Φ−1{pj/2}]2ν=p1+(p−1)cˉ\begin{gathered}H=\frac{\nu}{p}\sum_{j=1}^{p}\left[\Phi^{-1}\{p_j/2\}\right]^2\\[5pt]\nu=\frac{p}{1+(p-1)\bar c}\end{gathered}

Parameters and notation

pjp_j is a Royston-calibrated marginal W p value (Shapiro–Wilk, or Shapiro–Francia in the specified heavy-tail variant). For n≥12n\ge12 it is pj=Φ(−zj)p_j=\Phi(-z_j) with zj={log⁡(1−Wj)−mn}/snz_j=\{\log(1-W_j)-m_n\}/s_n, where mnm_n and sns_n are Royston’s polynomial mean and standard deviation of log⁡(1−W)\log(1-W); for 4≤n≤114\le n\le11 Royston (1992) uses a separate transformation of W. c̄ averages transformed off-diagonal correlations c(r)=r⁵[1−0.715(1−r)^0.715/v], v=0.21364+0.015124(log n)²−0.0018034(log n)³. The implementation’s W transformations must match this adjustment.

Structure of the method

Apply the specified Shapiro–Wilk/Shapiro–Francia-based marginal procedure, transform each coordinate's evidence, and adjust the combined statistic for dependence between coordinates. The effective degrees of freedom arise from the correlation correction. This is a marginal-statistic combination, not a fully affine-invariant joint-distance test.

Estimated and nuisance parameters

Marginal normality summaries, sample correlations, and their transformation-dependent effective degrees of freedom are estimated. Location/scale are absorbed into the component statistics; the estimated correlation correction is not an independently tuned neural parameter.

Settings and design choices

Fix the supported sample-size range, marginal-test selection rule, covariance/correlation conventions, and missing-value policy. Arbitrary marginal p-values cannot be inserted into the Royston formula because its transformation and dependence calibration are specific to the component construction.

Fitting and adaptation

Use the complete documented algorithm on the final analysis matrix. When calibrating by fitted-normal simulation, repeat the marginal-test choice, transforms, correlations, and aggregation for each replicate. If variables were selected after inspecting marginal failures, account for that selection or use a fresh validation sample.

Sensitivity and robustness

Normal marginals can coexist with a nonnormal dependence structure that this approach misses. Correlation extremes, small n, unsupported sample sizes, ties and near-constant variables can compromise approximations. Rotation can change the result, so interpret it for the measured coordinates and complement it with joint diagnostics rather than claiming invariant evidence about every representation of the data.

How to use and calibrate

Use χ²ν approximately or a fitted multivariate normal bootstrap repeating the full marginal selection/calibration rule.

Example application

Combine evidence of marginal departures while accounting approximately for correlation.

Interpretation and pitfalls

Watch out

Marginal normality does not imply joint normality. Royston is not affine invariant and may miss dependence-only departures; do not substitute arbitrary marginal p values into its calibration.

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.
  • Rewritten in the review: parameters and notation.
  • Not in the correction log: Edition 2's Parameters field regressed (raw TeX without $$, drops v4's c(r) transform and v constants, covers only n ≥ 12); the Academy merges v4 and edition 2 (academy/import/corrections/edition2.yaml).

Python and R

Current MVN function interface. Mardia prints skewness and kurtosis components together: use the component named in this entry. Covariance must be estimable and observations independent.

Python · invokes R

Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: MVN

# 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<-matrix(rnorm(120),ncol=3);Y<-matrix(rnorm(150,mean=.3),ncol=3)
print(MVN::royston(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

Not run — Syntax checked; runtime not verified in the final environment · needs MVN

set.seed(2026)
X<-matrix(rnorm(120),ncol=3);Y<-matrix(rnorm(150,mean=.3),ncol=3)
print(MVN::royston(X))

Sources

Statistics guide v4 (historical):
Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final 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 165, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT165.