Understand the idea
A common mix-up: the assumption is almost never about your raw column being bell-shaped. It is about what is left over after the model has explained what it can.
In a two-group comparison, body mass overall may look two-humped simply because the two species differ. Subtract each bird's own group average and the leftovers can be perfectly bell-shaped. That is what the test needs.
It also matters far less than people fear. With a reasonably large sample, averages behave in a bell-shaped way even when individual measurements do not; that is the Central Limit Theorem doing the work. Normality is worth worrying about when the sample is small, when the data are strongly lopsided, or when a couple of extreme points dominate.
Look at a histogram and a Q-Q plot of the residuals before you look at a normality test. With many rows, a normality test flags harmless departures; with few rows, it misses real ones.
This is often called the normal distribution assumption, but it is about the residuals, not the raw outcome column. Shapiro-Wilk and Anderson-Darling are formal tests of normality, but with large samples they flag tiny, harmless departures, so a Q-Q plot is usually the better guide.
Practitioner explanation
For the t-tests, ANOVA and OLS the requirement is on the error term. What actually needs to be approximately normal is the sampling distribution of the estimator, and the CLT delivers that for the mean under finite variance as n grows, at a rate governed by skewness (Berry-Esseen). Kurtosis affects variance estimation more than location.
This produces the standard practical guidance: with n per group in the tens and mild skew the t procedures are robust; with strong skew, heavy tails or influential outliers at small n both the p-value and interval coverage degrade, and the degradation is worse for one-sided tests. Prediction intervals and quantile estimates, unlike the mean, require the distributional assumption at ALL sample sizes because there is no averaging to invoke.
Use diagnostics rather than gates. Q-Q plots reveal the KIND of departure (skew, tails, discreteness) that a single p-value cannot. Shapiro-Wilk is the most powerful of the omnibus tests at small n but becomes hypersensitive above roughly n = 1000, where it will reject on departures too small to affect any inference, which is precisely why KernelStats reports the check alongside the plot rather than blocking the analysis on it.
When to use it
Consider it when
Check residuals whenever the sample is small, the data are visibly skewed, or the analysis reports prediction intervals or quantiles rather than a mean.
Use caution when
Do not test the raw response column instead of the residuals, and do not use a normality test as an automatic gate on a large sample, where it rejects departures too small to matter.
Formulas and symbols
Shapiro-Wilk statistic
x_(i) are the ordered observations and a_i are constants derived from the expected order statistics of a normal sample. W near 1 indicates normality.
Alternatives
- Mann-Whitney U Test. Two independent groups, small n, and clear skew or outliers. It tests stochastic ordering rather than means, so state the changed hypothesis when reporting.
- Bootstrap Confidence Interval. You want an interval for the mean (or another statistic) without assuming a distributional form, and n is adequate for resampling.
- Kruskal-Wallis Test. Three or more groups with the same small-n, non-normal situation.
Worked example
Scenario
Comparing body mass between 151 Adelie and 123 Gentoo penguins. The two group means differ by about 2.9 pooled standard deviations, so the pooled histogram of body mass is clearly bimodal.
Result
Shapiro-Wilk on the raw pooled column gives W = 0.968, p < .001. On the within-group residuals it gives W = 0.988, p = .022.
Interpretation
Two lessons, and the second is the one people miss. First, most of the pooled departure was the species difference itself, exactly the signal the test is meant to find, and removing it moves W from 0.968 to 0.988, much closer to 1. Second, the residual test STILL rejects at .05, because with n = 274 Shapiro-Wilk detects departures far too small to affect a comparison of means. Judge the size of the departure from the Q-Q plot rather than from the verdict: a W of 0.988 is a mild departure and the t-test is robust to it at this sample size.
Dataset: penguins.csv
Common misconceptions
Misconception
The data must be normally distributed to run a t-test.
Correction
The residuals, not the raw data, carry the assumption, and only weakly at moderate to large n, because the CLT applies to the sampling distribution of the mean. A bimodal response column is expected when the groups genuinely differ.
Misconception
A significant Shapiro-Wilk test means the analysis is invalid.
Correction
At large n it detects departures far too small to affect the inference. Judge the SIZE of the departure from a Q-Q plot and ask whether it plausibly affects the estimator you are reporting.
References
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.11 Measures of skewness and kurtosis / normal probability plot, NIST/SEMATECH (2012), §1.3.3.21.
