Atlas
statminds
NonparametricThe underlying model family class (e.g. GLM, linear model, categorical matrix, log-linear).Parametric ReferenceStatistical methods that assume a specific probability distribution family (typically normal).12-stage workflow

Shapiro-Wilk Normality Test

Most powerful test for normality; tests if sample from normal distribution.

Model familyNonparametric
Hypothesistwo-tailed
AliasesShapiro-Wilk test · W test
G1
description
Visual Overview Dashboard
1

What is it?

Shapiro-Wilk Test evaluates whether a continuous sample is drawn from a normally distributed population by comparing ordered sample quantiles against expected normal statistics.

2

When to use it

  • Continuous Data: Ideal for checking assumptions before parametric modeling.
  • Small Samples: More powerful than other normality tests for N < 50.
3

Core Idea

Plots ordered sample scores against expected normal distribution quantiles (Q-Q Plot). A perfect normal distribution aligns straight along the diagonal:

Curve deviations indicate skewness, while points drifting off the ends indicate heavy-tailed outliers.

4

Hypotheses

H0: Data is normally distributed
Ha: Data is NOT normally distributed (skew or outliers exist)
5

How it works

  1. Sort sample data in ascending order.
  2. Calculate optimal weights matching normal statistics.
  3. Compute W statistic (ratio of squared slope to sample variance).
  4. Determine p-value. Low p rejects normality.
6

Assumptions

📊 Continuity: Measurements are continuous scale intervals.
👤 Independence: Data points are sampled independently.
7

Effect Size

The W statistic directly represents the coefficient of determination (fit quality) on the normal Q-Q plot. Values close to 1.00 indicate a robust normal shape.

8

Quick Example

Sample SizeW Statp-value
N = 250.9820.724 (H0 Retained)
N = 25 (skewed)0.8910.012 (H0 Rejected)
Interactive Sandbox

Shapiro-Wilk Live Q-Q Laboratory

Introduce skewness or extreme outliers to observe quantile displacement from the diagonal.

Presets
Skewness0.0
Outliers (Extreme Points)0
Sample Size (N)20
Quantile-Quantile Plot SpaceY: Sample values vs. X: Theoretical normal quantiles
Calculations Output
MetricValue
Shapiro-Wilk W Statistic0.9869
Degrees of Freedom (df)20
p-value (normality check)0.0000
Normality Verdict
❌ Non-Normal Distribution
Normality is rejected (W = 0.987, p = 0.0000). Use nonparametric methods instead.
01Hypothesis test logic

Hypotheses

Pragmatic null and alternative hypotheses defined in mathematical notation.

A hypothesis is a question sharpened to a point. Ambiguity is the enemy of inference.
Logic Core
Null · H₀

H₀: Data come from a normal distribution

Alternative · Hₐ

Hₐ: Data do not come from a normal distribution

Why it matters two-tailed

Tests for departure from normality in any direction (skewness, kurtosis, or both). Most powerful normality test for small to moderate samples (n=3 to n=5000). Should be supplemented with graphical methods (Q-Q plots, histograms).

02Model diagnostics

Assumptions

The core mathematical criteria needed to ensure that statistical testing remains unbiased and valid.

Build your analysis on rock, not sand. Verify the mathematical foundation before building the model.
Integrity Shield
6
Assumptions
1
Critical / High Severity
How to check
Inspect data type and measurement precision. Shapiro-Wilk designed for continuous variables but tolerates fine-grained discrete data (e.g., exam scores 0-100)
If violated
If coarse discrete/ordinal (e.g., Likert 1-5) → normality assumption likely inappropriate; use nonparametric methods. If binary/count → use appropriate distribution (binomial, Poisson)
How to check
Count observations. Shapiro-Wilk valid for n=3 to n=5000 in most implementations
If violated
If n < 3 → cannot test normality reliably. If n > 5000 → use Anderson-Darling or Kolmogorov-Smirnov, though with very large samples, normality tests become overly sensitive to trivial departures (rely on Q-Q plots and CLT)
How to check
Review study design: verify no repeated measures, no clustering, no time series structure
If violated
If repeated measures → test normality of residuals from mixed model. If time series → test after removing autocorrelation structure. If clustered → test normality within clusters or of random effects
How to check
Quick
Histogram: look for bimodality or multiple peaks suggesting mixed populations
Rigorous
Fit mixture model or examine data by known subgroups. Mixed populations often produce 'too normal' W values or specific departure patterns
If violated
If mixture suspected: (1) Test normality separately within subgroups; (2) Use mixture distribution models; (3) Examine Q-Q plot for pattern (bimodality, gaps); (4) Do not force single normal distribution on heterogeneous data
How to check
Quick
Boxplot and z-scores: identify |z| > 3 or values beyond 1.5×IQR
Rigorous
Investigate outliers: verify not data entry errors, measurement errors, or different populations. Assess impact via sensitivity analysis (test with/without outliers)
If violated
If data errors → correct or remove. If legitimate outliers from same population → they may indicate non-normality (e.g., heavy tails). Report results with and without outliers. Consider: (1) robust tests (e.g., Anderson-Darling); (2) transformation; (3) accepting non-normality
anderson darling
How to check
Quick
General guideline: n ≥ 30 for reasonable power to detect moderate departures. n < 20 has low power
Rigorous
Power analysis: Shapiro-Wilk has ~80% power to detect skewness |γ₁| > 1 or kurtosis |γ₂| > 2 with n=50 at α=0.05. With n=20, power is ~50% for same departures
If violated
If small n (n < 30): (1) Shapiro-Wilk remains valid but low power; (2) Rely heavily on Q-Q plots; (3) Consider normality 'plausible' unless strong evidence against; (4) Use robust methods regardless of test result. With n < 10, normality testing is nearly futile—use nonparametrics
03Residual Forensics

Diagnostics

Checking residual plots and indices to examine model deviations and ensure standard error integrity.

Trust, but verify. The outliers often hold more truth than the averages.
System Health
Essential checks
  1. Linear pattern = normality. Deviations: S-curve = skewness, points fall above/below ends = heavy/light tails. Q-Q plot is MORE informative than Shapiro-Wilk p-value for large n
  2. Good fit indicates normality. Look for: skewness (asymmetry), bimodality (multiple peaks), heavy tails (extreme values)
  3. |γ₁| < 0.5 and |γ₂| < 1 suggest approximate normality. |γ₁| > 1 or |γ₂| > 2 indicate substantial departure. Use z-tests: z = γ / SE for significance
  4. W > 0.95 suggests good fit. W < 0.90 indicates poor fit. W interpretation depends on n: with large n, W=0.98 may be significant
  5. Points should scatter randomly around zero. Patterns indicate specific departures: curve = skewness, funnel = heteroscedasticity
Recommended checks
  1. Agreement strengthens conclusion. Disagreement suggests borderline case or sensitivity to specific departure types
  2. Parametric tests assume normality within each group, not overall. Some groups may be normal while others aren't
  3. If transformation improves W statistic substantially (e.g., W increases from 0.92 to 0.98), use transformed data for analysis
  4. Large change indicates outliers drive non-normality. Assess if outliers are legitimate or errors
  5. With n > 200, p < 0.05 may reflect trivial departure. Focus on W statistic and graphical methods
  6. Parametric models assume normal residuals, not raw data. Testing raw data is incorrect
  7. CI provides uncertainty around W estimate. Wide CI suggests instability
  8. PPCC > 0.98 suggests good fit. Similar power to Shapiro-Wilk but more intuitive scale
04Live Instances

Applied Minds

Review concrete study examples, data layout guidelines, and copy executable syntax scripts.

Theory is the map. Practice is the terrain. Simulation bridges the gap.
Applied Wisdom
Example 01

Exam Scores Normality Assessment with Q-Q Plot

Demonstrates: (1) basic Shapiro-Wilk test workflow, (2) interpreting W statistic and p-value, (3) using Q-Q plot for visual confirmation, (4) calculating skewness and kurtosis as complementary measures.

# Shapiro-Wilk Normality Test: Exam Scores Example
# ================================================================
# Research Question: Are exam scores normally distributed?

library(tidyverse)
library(moments)  # skewness(), kurtosis()

# Create exam score data (n=35)
set.seed(101)
exam_scores <- c(
  rnorm(30, mean = 75, sd = 12),  # Most students
  rnorm(5, mean = 90, sd = 5)     # Few high achievers
)
exam_scores <- round(pmin(100, pmax(0, exam_scores)))  # Bound 0-100

n <- length(exam_scores)

cat("Sample size:", n, "\n")
cat("Mean:", round(mean(exam_scores), 2), "\n")
cat("SD:", round(sd(exam_scores), 2), "\n\n")

# -------- DESCRIPTIVE STATISTICS --------

cat("=== DESCRIPTIVE STATISTICS ===\n")
cat("Min:", min(exam_scores), "\n")
cat("Q1:", quantile(exam_scores, 0.25), "\n")
cat("Median:", median(exam_scores), "\n")
cat("Q3:", quantile(exam_scores, 0.75), "\n")
cat("Max:", max(exam_scores), "\n\n")

# Skewness and kurtosis
skew <- skewness(exam_scores)
kurt_excess <- kurtosis(exam_scores) - 3  # Excess kurtosis

cat("Skewness:", round(skew, 3), 
    ifelse(abs(skew) < 0.5, "(approximately symmetric)",
           ifelse(skew > 0, "(right-skewed)", "(left-skewed)")), "\n")
cat("Excess kurtosis:", round(kurt_excess, 3),
    ifelse(abs(kurt_excess) < 1, "(approximately mesokurtic)",
           ifelse(kurt_excess > 0, "(heavy tails)", "(light tails)")), "\n\n")

# -------- SHAPIRO-WILK TEST --------

shapiro_result <- shapiro.test(exam_scores)

cat("=== SHAPIRO-WILK TEST ===\n")
cat("W statistic:", round(shapiro_result$statistic, 4), "\n")
cat("p-value:", format.pval(shapiro_result$p.value, digits = 3), "\n\n")

# Interpret W statistic
if (shapiro_result$statistic > 0.95) {
  cat("W > 0.95: Good fit to normal distribution\n")
} else if (shapiro_result$statistic > 0.90) {
  cat("0.90 < W < 0.95: Moderate fit\n")
} else {
  cat("W < 0.90: Poor fit to normal distribution\n")
}

# Interpret p-value
if (shapiro_result$p.value >= 0.05) {
  cat("p >= 0.05: Fail to reject H₀; data consistent with normality\n\n")
} else {
  cat("p < 0.05: Reject H₀; significant departure from normality\n\n")
}

# -------- GRAPHICAL DIAGNOSTICS --------

par(mfrow = c(2, 2))

# 1. Histogram with normal overlay
hist(exam_scores, breaks = 10, freq = FALSE, 
     main = "Histogram with Normal Curve",
     xlab = "Exam Score", col = "lightblue", border = "white")
curve(dnorm(x, mean = mean(exam_scores), sd = sd(exam_scores)),
      add = TRUE, col = "red", lwd = 2)

# 2. Q-Q plot
qqnorm(exam_scores, main = "Q-Q Plot", pch = 19, col = "steelblue")
qqline(exam_scores, col = "red", lwd = 2)

# 3. Boxplot
boxplot(exam_scores, main = "Boxplot", ylab = "Exam Score", 
        col = "lightgreen", horizontal = FALSE)

# 4. Density plot
plot(density(exam_scores), main = "Kernel Density Estimate",
     xlab = "Exam Score", lwd = 2, col = "darkblue")
rug(exam_scores, col = "gray")

par(mfrow = c(1, 1))

# -------- OUTLIER CHECK --------

z_scores <- scale(exam_scores)
outliers <- which(abs(z_scores) > 3)

cat("=== OUTLIER CHECK ===\n")
if (length(outliers) > 0) {
  cat("Outliers detected(|z| > 3):\n")
  print(data.frame(
    Index = outliers,
    Score = exam_scores[outliers],
    Z = round(z_scores[outliers], 2)
  ))
  cat("\n")
} else {
  cat("No extreme outliers(|z| > 3) detected\n\n")
}

# -------- SENSITIVITY ANALYSIS --------

if (length(outliers) > 0) {
  scores_no_outliers <- exam_scores[-outliers]
  shapiro_no_outliers <- shapiro.test(scores_no_outliers)
  
  cat("=== SENSITIVITY ANALYSIS(without outliers) ===\n")
  cat("W statistic:", round(shapiro_no_outliers$statistic, 4), "\n")
  cat("p-value:", format.pval(shapiro_no_outliers$p.value, digits = 3), "\n")
  cat("Change in W:", 
      round(shapiro_no_outliers$statistic - shapiro_result$statistic, 4), "\n\n")
}

# -------- INTERPRETATION & RECOMMENDATIONS --------

cat("=== INTERPRETATION ===\n")
if (shapiro_result$p.value >= 0.05 && abs(skew) < 0.5 && abs(kurt_excess) < 1) {
  cat("Conclusion: Data are approximately normally distributed.\n")
  cat("Recommendation: Parametric tests(t-test, ANOVA) are appropriate.\n")
} else if (shapiro_result$p.value < 0.05) {
  cat("Conclusion: Data show significant departure from normality.\n")
  cat("Primary issue:",
      ifelse(abs(skew) > 1, "Skewness",
             ifelse(abs(kurt_excess) > 2, "Kurtosis", "Other")), "\n")
  cat("Recommendation: Consider(1) transformation(log, sqrt),\n")
  cat("(2) nonparametric tests, or(3) robust methods.\n")
  if (n >= 30) {
    cat("Note: With n ≥ 30, CLT may justify parametric tests for means\n")
    cat("despite mild non-normality(check Q-Q plot).\n")
  }
} else {
  cat("Conclusion: Borderline normality(non-significant but W < 0.95).\n")
  cat("Recommendation: Examine Q-Q plot closely. Consider robust methods.\n")
}
05Tactical Pivots

Alternatives

Structured fallback pathways for choosing alternative tests when normality or slopes requirements fail.

When the path is blocked, pivot. Rigor is not rigidity; it is the intelligent adaptation to reality.
Adaptive Strategy
Measurement Precision Ladder Ideal · Continuous / Ratio
Ratio
Maintain Shapiro-Wilk logic. The most powerful strike for auditing normality in small to moderate samples.
Peak Signal
Interval
Ideal for GLM Diagnostics. Ensure sample size is < 2000; the SW algorithm collapses beyond this threshold.
Standard Precision
Ordinal / Nominal
Abandon Normality. Use Chi-Square Goodness-of-Fit to model categorical alignment.
Identity Loss
Temporal Trajectory Audit Static Shape Snapshot
Static Audit
Bell-curve fit.
Stay with Shapiro-Wilk. Verify the foundational mandate for parametric discovery.
Massive-N
N > 2000.
Pivot to Kolmogorov-Smirnov or Jarque-Bera tests to maintain computational authority.
Adaptive Technical Safeguards · adaptive safeguards
non normality detected
  • Kruskal-Wallis / Mann-Whitney — Pivot to rank-based models to neutralize distributional noise.
  • Log-Transformation — Mathematically 'pull' the distribution toward normality.
extreme kurtosis
  • Anderson-Darling Test — Increase sensitivity to heavy tails that SW might under-weight.
  • Bootstrap Inference — bypass the shape mandate entirely using 1,000 resamples.
06Adjusted Comparisons

Post-hoc

Group mean comparisons and correction controls (e.g. Tukey HSD, Bonferroni) to protect against Family-Wise Error Rates.

The omnibus test opens the door; post-hoc analysis explores the room.
Forensic Detail
Adjusted Comparisons

Post-hoc pairwise tests defined for this model.

Interpretation Guidelines

No specific guidelines provided.

07Standardized scale impact

Effect Size

Understanding effect sizes (e.g., Cohen's d, Partial Eta-Squared) and clinical impact benchmarks.

Significance is noise. Magnitude is the signal. Measure the impact, not just the probability.
Impact Magnitude
N/A
Recommended Measure
08Statistical Power

Sample Size

Guidelines for minimum sample requirements and power analysis parameters.

An underpowered study is an ethical failure. Respect the data by collecting enough of it.
Power Protocol
Floor Requirements

The 'Stability Buffer': A minimum of 20 participants is recommended for a single-sample normality audit. Smaller samples often 'Pass' the test simply because they lack the power to detect non-normality.

Effect SizeParametersRequired n
Small EffectSubtle Skew (0.5)n ≈ 100
Medium EffectModerate Skew (1.0)n ≈ 40
Large EffectSevere Skew (2.0)n ≈ 20
Key considerations

The 'Significance Paradox': In very large samples (N > 200), Shapiro-Wilk will be significant even for trivial, non-impactful deviations. Rely on visual inspection (Q-Q plots) when your sample size reaches 'Elite' volumes.

G*Power StrategyBenchmark: Goodness-of-fit → Normal distribution. Parameters: Skewness/Kurtosis deviation, α = .05, Power = .80. Note: Shapiro-Wilk is the most powerful general-purpose normality strike available.
09APA narrative blueprint

Reporting

How to compile statistical results into publication prose matching APA and journal style guides.

Data does not speak for itself. It requires a translator. Be clear, be precise, be honest.
Narrative Arc
10Exhibit Builder

Manuscript Lab

Copy standard summary tables and forensic reporting grids to outline analysis details.

Table 1: Shapiro-Wilk Test for Normality
VariableW (Statistic)p-valueAssumption Status
Baseline Score0.98.452Met (Normal)
Post-Op Pain0.82< .001VIOLATED (Non-Normal)
Note. N = 100. Critical for validating parametric test assumptions.
p = .452Safe Passage. The baseline data is indistinguishable from a normal curve; parametric tests (T-tests/ANOVA) are safe to use.
p < .001 (Post-Op)Identifies Skewness. Post-op pain data is heavily non-normal (likely right-skewed). You MUST use non-parametric fallbacks (Wilcoxon).
Header glossary

The Correlation with Normality. W = 1.0 represents a perfect normal distribution. Lower values indicate deviation.

The 'Is it Normal?' Probability. If p < .05, we conclude the data is NOT normally distributed.

11Algorithmic Logic

Command Center

Syntax libraries and function parameters for executing calculations in stats packages.

Code is the modern laboratory. Clean execution ensures reproducible discovery.
Execution Engine
# 1. Execute Shapiro-Wilk Test
shapiro.test(df$score)

# 2. Visual Validation (QQ Plot)
performance::check_normality(lm(score ~ 1, data = df))
Library stack
R
statsperformance
Python
scipy.stats
Elite Forensic Strike

Shapiro-Wilk is overpowered in large samples (N > 500) and underpowered in small ones. Never rely on the p-value alone; always look at the QQ plot to see the 'Severity' of the deviation.

# Execute Multimodal Diagnostic
performance::check_model(model)
12The Over-adjustment Trap

Common Mistakes

Analytical caveats and corrections to maintain modeling integrity.

Wisdom is learning from the failures of others. Anticipate the error before it occurs.
Defensive Logic
Why it's wrong
ANOVA/t-tests assume normality within each group, not of pooled data. Testing overall data can miss group-specific violations
The correction
Test normality separately for each group. If any group violates normality, consider transformation or nonparametric alternative
Why it's wrong
With large n, Shapiro-Wilk detects trivial departures from normality that don't affect parametric test validity
The correction
Focus on W statistic (should be > 0.95), skewness/kurtosis magnitude, and Q-Q plot. With n > 100, parametric tests are robust to mild departures due to CLT
Why it's wrong
P-value doesn't tell you HOW data deviate from normality (skewness? kurtosis? outliers?). Q-Q plot shows the specific pattern
The correction
Always create Q-Q plot. Interpret Shapiro-Wilk result in conjunction with visual assessment
Why it's wrong
Parametric models assume normal residuals (errors), not raw outcome variable. Testing raw data is irrelevant
The correction
Fit model first, extract residuals, then test normality of residuals
Why it's wrong
Proceeding with parametric tests on non-normal data can lead to inflated Type I error or reduced power
The correction
If normality violated: (1) try transformation, (2) use nonparametric test, (3) use robust methods, or (4) justify parametric approach if n large and violation mild
Why it's wrong
Failing to reject H₀ doesn't prove normality—could be due to low power (small n). Normality is an approximation
The correction
Interpret as 'data consistent with normality' or 'no strong evidence against normality'. With small n, always examine plots
Why it's wrong
Shapiro-Wilk designed for continuous data. Discrete data often reject normality due to granularity, not true departure
The correction
For ordinal data, normality assumption is often inappropriate. Use nonparametric methods or ordinal regression
Why it's wrong
Single extreme outlier (possibly data error) can cause rejection of normality for otherwise normal data
The correction
Identify and investigate outliers first. Test normality with and without outliers (sensitivity analysis)
13Academic Lineage

References

Scholarly lineage and citation keys grounding the statistical framework.

We stand on the shoulders of giants. Honor the source of the method.
Academic Lineage
[1]
Shapiro, S. S., & Wilk, M. B. (1965). An analysis of variance test for normality (complete samples). Biometrika, 52(3/4), 591-611.
Original paper introducing the Shapiro-Wilk test
[2]
Razali, N. M., & Wah, Y. B. (2011). Power comparisons of Shapiro-Wilk, Kolmogorov-Smirnov, Lilliefors and Anderson-Darling tests. Journal of Statistical Modeling and Analytics, 2(1), 21-33.
Power comparison showing Shapiro-Wilk is most powerful normality test
[3]
Ghasemi, A., & Zahediasl, S. (2012). Normality tests for statistical analysis: A guide for non-statisticians. International Journal of Endocrinology and Metabolism, 10(2), 486-489.
Practical guide to normality testing for applied researchers
[4]
Rochon, J., Gondan, M., & Kieser, M. (2012). To test or not to test: Preliminary assessment of normality when comparing two independent samples. BMC Medical Research Methodology, 12, 81.
Discussion of when normality testing is necessary before parametric tests
[5]
Field, A., Miles, J., & Field, Z. (2012). Discovering statistics using R. Sage.
Applied statistics textbook with comprehensive normality testing examples
statminds · Shapiro-WilkMind reference · v2.2 · updated 2026-01-1715 of 15 sections