Chapter 1 · Getting the data ready

Is your data normal enough for the test?

Normality checks, Q-Q plots, transformations, outliers and residual diagnostics.

Read first: Descriptive statistics, Choosing a test

The problem first

You are a second-year Medicine resident. Your thesis compares CRP on day 3 in two groups of patients with pneumonia. You run the Shapiro-Wilk test on the CRP column of all patients together and get p < 0.001.

You write “data not normal”, switch every comparison to the Mann-Whitney test, and report only medians. Your co-resident, with 600 patients, gets p < 0.001 for haemoglobin too and does the same. At the pre-submission seminar, the statistician asks one question.

“Which values had to be normal, and what did the test tell you that a plot did not?”

Start here

What exactly has to be normal?

For a t-test or ANOVA, the values within each group should be roughly normal. For regression, the residuals should be. The outcome column with all groups pooled together does not have to be normal.

Each groupOne pooled columngroup Agroup Btwo humps81114178111417haemoglobin, g/dL
Made-up teaching example. Each group is normal, but a treatment that moves one group up makes the pooled column two-humped, and a normality test on that column would reject normality. Check each group separately, or check the residuals (each value minus its group mean). The other assumptions of these tests, independent observations and similar variances, are in the choosing a test chapter.

“Roughly normal” matters most for small samples. The t-test compares means, and the mean of many patients follows a nearly normal distribution even when individual values do not. This is the central limit theorem, explained below. So the question is not only “are these data normal?” but “are they far enough from normal, for this sample size, to change the p-value and CI?”

Checking by eye

How do you check the shape by looking?

A histogram shows the shape, a box plot shows the spread and outliers, and a Q-Q plot compares your values with those a normal sample of the same size would have.

-2-1012101214expected z for each rankHb, g/dL4th smallest of 10:11.5 g/dLat z = −0.38Points near the line:shape consistent witha normal distribution
Made-up teaching data: Hb in 10 women. Sort the values, then place each one above the z-score expected for its rank in a normal sample of 10 (for the 4th smallest, z = −0.38). If the data are normal, the points lie near a straight line. This is a Q-Q (quantile-quantile) plot: observed quantiles against expected normal quantiles.
Normalon the lineRight skewbends upward at the rightHeavy tailsS shape: both ends offOne outlierone point far above
Drawn from exact quantiles of each shape, 25 values. Right skew: the highest values are further from the centre than a normal curve allows, so the points bend upward at the right. Left skew bends the other way. Heavy tails: both ends move away from the line. An outlier: one point sits far from an otherwise straight line. Histograms of small samples change shape with the choice of bins, so the Q-Q plot is easier to judge.

Interactive

Skew the population and watch the Q-Q plot and the Shapiro-Wilk p-value at 20 and 500 patients

The same population is sampled twice. Only the number of patients changes.

Try this: with the first set of patients, start at a population skewness of 0.61. Both Q-Q plots bend only a little. The test on 500 patients gives p < 0.001 and the test on 20 patients gives p = 0.529. Then move the skewness to 0 and to 1.75.

Teaching example with made-up laboratory values. Both samples come from the same population. The dashed line on each Q-Q plot passes through the first and third quartiles.

0.61

0 = symmetric (normal). Above 1 = strongly skewed to the right.

Samplesfirst set of patients

Same population, new random samples

20 patients: W = 0.959, p = 0.529, sample skewness 0.46

500 patients: W = 0.982, p = < 0.001, sample skewness 0.51

With 20 patients the Shapiro-Wilk test does not reject normality. With 500 patients from the same population it rejects normality. The population shape is the same in both. Only the number of patients differs.

500 patients: histogram5529120 patients: Q-Q plotexpected z24673500 patients: Q-Q plotexpected z29155

Normality tests

What do the Shapiro-Wilk and Kolmogorov-Smirnov tests actually test?

Both test the null hypothesis that the data come from a normal distribution. A small p-value says the data are unlikely to be exactly normal. A large p-value does not prove that they are normal.

The Shapiro-Wilk test is based on the correlation between the ordered data and the corresponding normal scores, the same comparison a Q-Q plot shows. W close to 1 means the points lie close to a straight line. The Kolmogorov-Smirnov test measures the largest vertical gap between the cumulative proportion of your data and the cumulative normal curve. When the mean and SD are estimated from the same data, as they almost always are, the plain Kolmogorov-Smirnov p-value is not correct and the Lilliefors correction is needed.

0%50%100%1020501002005001000patients in the sample (log scale)strong skew (2)mild skew (0.5)normal data11%98%
Simulated with SciPy: 4,000 samples at each size, Shapiro-Wilk at α 0.05. Mild skew = skewness 0.5, strong skew = skewness 2. With 20 patients, mild skew was flagged in only 11% of samples. With 500 patients, the same mild skew was flagged in 98%, although a t-test on the means of 500 patients is not affected by it. With 10 patients, even strong skew was missed in 71% of samples.

This is why normality tests are least useful exactly where you would want them. For small samples they have little power and most samples pass. For large samples even a small deviation from normality gives a significant result, although it will not affect a parametric test (Ghasemi and Zahediasl, 2012). Look at the plots, and use the test as supporting information.

FeatureShapiro-WilkKolmogorov-Smirnov
ComparesOrdered values with expected normal scores (a correlation)Cumulative proportion of the data with the cumulative normal curve (largest gap)
Mean and SD from the same dataAllowed for by the testNeeds the Lilliefors correction. The plain test is for a mean and SD fixed in advance
PowerBetter than K-S, even after the Lilliefors correctionLower. Ghasemi and Zahediasl advise that it should no longer be used for normality
SPSS ExploreGiven for 3 to 5,000 cases (no weights or integer weights)Given with a Lilliefors significance level
Rshapiro.test(), 3 to 5000 valuesks.test() only with parameters specified in advance

Running a normality test and then choosing between a t-test and a Mann-Whitney test on the same data changes the error rates of the second test. Rochon, Gondan and Kieser (2012) found that this two-stage procedure seriously altered the conditional type I error rates, although the overall error rate and power stayed within acceptable limits in their examples. Planning the analysis from the type of outcome and earlier data avoids the problem.

The central limit theorem

Why does a t-test still work with skewed data in large samples?

Because it compares means, and means of many patients are close to normally distributed even when individual values are skewed.

single patients051015skewness 2.00SD 5.00 daysmeans of 5051015skewness 0.89SD 2.24 daysmeans of 30051015skewness 0.37SD 0.91 days
Exact distributions for an exponential hospital stay with mean 5 days (dashed line). One patient at a time, the skewness is 2. The mean of 5 patients has skewness 0.89. The mean of 30 patients has skewness 0.37 and an SD of 0.91 days. The skewness of the mean falls as 1 ÷ √n.

Lumley and colleagues (2002) put it directly: the t-test and linear regression are valid even in very small samples if the outcome is normal, and in large samples they are valid for any distribution. Some guides give 30 or 40 patients as the size above which non-normality should not cause major problems. The number really needed depends on the shape: in the figure the mean of 30 still has some skew.

What the central limit theorem does not do

  • It does not make individual values normal. A reference range or a prediction for one patient still needs the real distribution.
  • It does not help much in small samples, which is where most thesis groups are.
  • One extreme value still pulls the mean and inflates the SD.
  • It does not make the mean the right summary. With very skewed data, a median or a ratio may answer the clinical question better.

Transformations

What does taking the log do to skewed data?

It turns multiplication into addition. Values that double in steps become equally spaced, so a long right tail is pulled in towards the rest.

Ordinary scale (mg/L)510204080160Log scale510204080160each doubling = the same step
Made-up CRP values. Many laboratory values, such as CRP, ferritin and triglycerides, vary by multiplying factors, so their right tail is long on the ordinary scale and roughly symmetric on the log scale.

Choosing a transformation

TransformationUse forCautions
Square root, √xMild right skew, countsNeeds x ≥ 0. The difference has no simple clinical meaning
Log, ln x or log₁₀ xRight skew in positive values, especially when the SD grows with the meanNeeds x > 0. Adding a constant to deal with zeros changes the results
Reciprocal, 1/xVery strong right skewReverses the order of the values. Can overcorrect
Square, x²Left skewRarely needed in clinical data

The Box-Cox method (Box and Cox, 1964) chooses a power from the data, and includes the log, square root and reciprocal as special cases. Whatever you choose, ICH E9 asks for transformations of key variables to be specified in the protocol with a rationale.

Back-transformation: what the numbers mean on the original scale

  • The mean of log values, back-transformed (emean of ln x), is the geometric mean, not the arithmetic mean.
  • A difference between two means of log values, back-transformed, is the ratio of the geometric means. Its CI back-transforms to a CI for that ratio.
  • The SD of log values cannot be back-transformed into an SD in mg/L. Report the geometric mean with its CI, or the median and IQR.

Interactive

Choose a transformation and watch the residuals, the t-test and the effect estimate change

The same 20 CRP values from the worked example below, analysed on four scales.

Try this: look at the Q-Q plot with no transformation, then choose Log. The residuals move onto the line and their skewness falls from 1.73 to 0.19. Then try Reciprocal: the skewness rises again to 1.16, now caused by the smallest CRP values.

Teaching example with made-up CRP values (mg/L), 10 patients in each group. Residual = each value minus its own group mean, on the chosen scale. The t-test is the unpaired Student t-test on that scale.

Transformation

Residuals: skewness 1.73, Shapiro-Wilk W = 0.830, p = 0.002

t-test on this scale: t = 1.73, df 18, p = 0.100

Difference in means 40.2 mg/L (95% CI -8.5 to 88.9), in the units patients are measured in.

Values, not transformedAB2550100230CRP, mg/LQ-Q plot of the 20 residualsexpected z

Outliers

What should you do with an outlier?

First find out why it is extreme. Correct data-entry and measurement errors. Keep genuine values, and show how much they change the result.

12 patients: slope 0.11 per yearone more patient: slope −0.0030102030years of diabetes7%8%
Made-up teaching data. Twelve patients give a slope of 0.11% HbA1c per year of diabetes (p < 0.001). One added patient with 30 years of diabetes and HbA1c 6.8% flattens the line to −0.003 per year (p = 0.89). The point is far from the others on the x-axis (leverage 0.78) and far from the line, so its Cook's distance, a measure of how much the fitted line changes when that point is removed, is 18.7.
  1. Look for extreme values on box plots, Q-Q plots and residual plots.
  2. Check each one against the case record. Correct errors, such as a haemoglobin of 112 entered instead of 11.2.
  3. Do not delete a genuine value because it is inconvenient. It may be the patient who matters most.
  4. Run the analysis with the actual values and again without them (or with a method less affected by them), and report both.

In a normal distribution only 0.27% of values lie more than 3 SD from the mean, so a standardised residual far beyond ±3 deserves a check. In a box plot, points beyond 1.5 × IQR from the quartiles are drawn separately.

Regression

What has to be checked after fitting a regression?

The residuals: each observed value minus the value the model predicts. If the model is right, residuals scatter evenly around zero with no pattern.

Even bandassumptions look metFunnelspread growsCurvewrong shape of modelRuns in time ordernot independent
Residuals plotted against fitted values (first three) or against the order in which patients were measured (fourth). Only the first panel shows no problem.
AssumptionHow to checkIf it fails
LinearityResiduals against fitted values: no curveAdd a squared term or transform x or y
Constant spread (homoscedasticity)Same plot: no funnel. Breusch-Pagan testTransform y, or use heteroscedasticity-consistent SEs
Normal residualsQ-Q plot of residualsMatters most in small samples. Consider log(y)
IndependenceStudy design. Residuals in time order: Durbin-Watson testRepeated measures or clustered data need other models
No single point in controlLeverage and Cook's distanceCheck the data, then report with and without

When the spread is not constant, the least-squares coefficients are still unbiased, but their ordinary standard errors, CIs and p-values are not correct. Heteroscedasticity-consistent (“sandwich”) standard errors correct them without changing the coefficients.

Interactive

Add spread in older patients or a curve, and watch the residual plot

The same 60 made-up patients each time. The fitted line changes little, but the residual plot shows what is wrong.

Try this: move the extra spread from 0 to 3. The residual plot fans out and the Breusch-Pagan p-value falls from 0.620 to 0.007. The slope moves only from 0.81 to 0.94, but its ordinary SE is no longer correct. Then set the spread back to 0 and choose Curved: the residuals form a U.

Teaching example with made-up data: systolic BP in 60 adults aged 30 to 80 years. The true slope is 0.8 mmHg per year.

0

At 3, the SD at age 80 is 4 times the SD at age 30

True relationship

Slope 0.81 mmHg per year · ordinary SE 0.058 · heteroscedasticity-consistent (HC3) SE 0.064

Breusch-Pagan (Koenker) χ² = 0.25, df 1, p = 0.620 · Shapiro-Wilk on residuals p = 0.599

The residuals form an even band around zero: no pattern.

Data and fitted line305580age, yearsResiduals against fitted values0fitted SBP

Decide

A check has failed: what do you do now?

Answer two questions. Each answer links to the section that explains it.

What are you analysing?

When a check fails: all possible answers
  • Keep the t-test or ANOVA: Means of large groups are close to normal even when the values are not. Check that a mean still answers your clinical question, and report it with its 95% CI.
  • Log-transform, then back-transform: Analyse the log values. Report geometric means and their ratio with the 95% CI, not a difference in mg/L.
  • Rank test: Mann-Whitney U, Wilcoxon signed-rank or Kruskal-Wallis. Report medians and IQR. The test compares ranks, not means.
  • Welch's t-test: It does not assume equal variances. R uses it by default in t.test().
  • Change the model: The straight line is the wrong shape. Add a squared term, or transform x or y, and check the residuals again.
  • Transform y, or use heteroscedasticity-consistent SEs: The coefficients are still unbiased, but the ordinary standard errors and p-values are not correct. A log of y often evens out the spread.
  • Consider log(y), and check the sample size: In a large sample, skewed residuals matter less for the tests on the coefficients. In a small one, a log of y or a different model may be needed.
  • Check the values, then analyse with and without: Correct data-entry errors. Keep genuine values and report how much the result changes without them (ICH E9).

Comparison

Log transformation or a rank test: which answers your question?

Both deal with right-skewed data, but they estimate different things.

Featuret-test on log valuesMann-Whitney U test
Question answeredHow many times higher is the typical value in one group?Do values in one group tend to be larger than in the other?
Effect estimateRatio of geometric means with a 95% CIThe test gives a p-value. A CI needs additional methods
NeedsAll values above zero. Roughly normal on the log scaleIndependent observations. Ordinal or continuous values
Extreme valuesPulled in, but still counted by sizeCount only as the highest or lowest rank
Adjusting for other variablesPossible: regression on log(y)Not in the basic test
ReportGeometric means (95% CI) and their ratioMedians (IQR) and the p-value
Worked example belowRatio 2.21 (0.96 to 5.08), p = 0.061U = 74, exact p = 0.075

The formula

Skewness, back-transformation and a worked example

Teaching example with made-up data: CRP (mg/L) on day 3 in two groups of 10 patients.

g₁ = [Σ(x − x̄)³ ÷ n] ÷ [Σ(x − x̄)² ÷ n]1.5

g₁
moment coefficient of skewness: 0 for a symmetric shape, positive for a long right tail
G₁
the small-sample adjusted version some software reports: G₁ = g₁ × √[n(n − 1)] ÷ (n − 2)

geometric mean = emean of ln x · ratio of geometric means = e(mean ln x₁ − mean ln x₂)

Group A: 12, 18, 25, 31, 40, 52, 66, 90, 140, 230. Group B: 6, 9, 11, 15, 19, 24, 30, 38, 55, 95.

  1. Original scale. Means 70.4 and 30.2 mg/L. Medians 46.0 and 21.5. SDs 68.1 and 27.2. The mean is well above the median and the SD is close to the mean: right skew. g₁ = 1.44 and 1.46 (G₁ = 1.71 and 1.73). Shapiro-Wilk p = 0.019 and 0.026.
  2. Natural log. Means of ln CRP 3.874 and 3.082, SDs 0.921 and 0.851. g₁ = 0.20 and 0.19. Shapiro-Wilk p = 0.99 and 0.997.
  3. t-test on the log values. Difference 0.792, t = 2.00, df 18, p = 0.061. 95% CI for the difference −0.041 to 1.625.
  4. Back-transform. Geometric means e3.874 = 48.1 and e3.082 = 21.8 mg/L. Ratio e0.792 = 2.21, 95% CI e−0.041 = 0.96 to e1.625 = 5.08.
  5. For comparison. t-test on the original values: difference 40.2 mg/L (95% CI −8.5 to 88.9), p = 0.100. Mann-Whitney U = 74, exact p = 0.075.

ratio of geometric means = e0.792 = 2.21 → 95% CI 0.96 to 5.08

A mean ± 2 SD “normal range” on the original scale for group A would run from 70.4 − 2 × 68.1 = −65.8 mg/L, an impossible value. That is the practical sign that the mean and SD do not describe these data.

In a real paper

Checking normality and log-transforming in a randomised trial

Open-access paper · CC BY

James PT, Jawla O, Mohammed NI, Ceesay K, Akemokwe FM, Sonko B, et al. A novel nutritional supplement to reduce plasma homocysteine in nonpregnant women: A randomised controlled trial in The Gambia. PLoS Med. 2019;16(8):e1002870.

The study: A three-arm randomised trial in 298 nonpregnant women in rural Gambia: a new drink powder, a multiple micronutrient tablet (UNIMMAP) or no supplement for 12 weeks. The outcome, plasma homocysteine, was right skewed, so the authors analysed it on the log scale in linear regression models.

What the authors wrote
“We first assessed the homocysteine variables for normality using the Shapiro-Wilk test. Variables were right skewed but satisfied normality assumptions after log transformation.”
In plain words

They tested the shape of the homocysteine values with the Shapiro-Wilk test and found a long right tail. After taking logs the values were close enough to normal. Every comparison was then made on log homocysteine, and each regression coefficient (β) was converted back into a percentage difference in the geometric mean with (eβ − 1) × 100.

ReportedValueWhat it means
β, drink powder vs control, 12 weeks−0.27 (−0.35 to −0.19)Difference in mean log homocysteine, adjusted for baseline homocysteine, age and BMI
Percent difference in geometric means−23.6 (−29.5 to −17.1), p < 0.001Back-transformed: the typical homocysteine was about 24% lower than in controls
Drink powder vs UNIMMAP, 12 weeks−8.8 (−15.8 to −1.2), p = 0.025A smaller difference between the two supplements
Geometric mean, control arm, week 1210.18 (9.54–10.87) μmol/L, n = 82The back-transformed mean of the log values
Check these when you read it
  • The normality check was on the homocysteine values. For an adjusted regression the assumption concerns the residuals, and the paper does not report a residual check.
  • Results are percentage differences in geometric means, not differences in μmol/L. Convert back to the clinical scale before judging importance.
  • The primary analysis used complete cases: 82, 84 and 77 women had week-12 values. Compare with the numbers randomised.

How to run it

How to check assumptions in SPSS, R and jamovi

Every step below was checked against the official documentation. Steps that could not be checked are left out.

SPSS Statistics

  1. Analyze > Descriptive Statistics > Explore. Select the outcome as the dependent variable and the group as the factor variable.
  2. In the Display group, select Both or Plots, then click Plots and select Normality plots with tests. The output gives normal probability and detrended normal probability plots, the Kolmogorov-Smirnov statistic with a Lilliefors significance level, and the Shapiro-Wilk statistic (for 3 to 5,000 cases with no weights or integer weights).
  3. For regression, in the Linear Regression dialog box click Plots. Plot the standardised residuals (*ZRESID) on the vertical axis against the standardised predicted values (*ZPRED) on the horizontal axis, and request the histogram and normal probability plot of standardised residuals.

R

# Shape of each group: Q-Q plot and Shapiro-Wilk test
a <- crp[group == "A"]
qqnorm(a); qqline(a)            # qqline passes through the 1st and 3rd quartiles
shapiro.test(a)                 # needs 3 to 5000 non-missing values

# t-test on log values, then back-transform
fit <- t.test(log(crp) ~ group, var.equal = TRUE)   # default var.equal = FALSE gives Welch's test
exp(fit$conf.int)               # 95% CI for the ratio of geometric means

# Regression diagnostics
m <- lm(sbp ~ age)
plot(m)                         # residuals vs fitted, Q-Q, scale-location, residuals vs leverage
cooks.distance(m)
lmtest::bptest(m)               # Breusch-Pagan, Koenker's studentized version by default
lmtest::coeftest(m, vcov. = sandwich::vcovHC(m))   # vcovHC default type is "HC3"
MASS::boxcox(m)                 # profile likelihood for the Box-Cox power

jamovi

The options below are documented for jmv, the R package of jamovi's own analyses, under the same analysis names.

  • Descriptives: Shapiro-Wilk p-value, skewness, kurtosis, histograms, box plots and Q-Q plots.
  • Independent Samples T-Test: Shapiro-Wilk tests of normality, Q-Q plots of residuals, Levene's test for homogeneity of variances, and Welch's and Mann-Whitney U tests.
  • Linear Regression: Shapiro-Wilk test on the residuals, Q-Q plot of residuals, residual plots, the Durbin-Watson test for autocorrelation and summary statistics for Cook's distance.

How to report it

What to write in the methods and results

Say how you checked the assumptions, what you did about them, and give results on the scale you analysed plus the back-transformed values.

Methods:

“The distribution of CRP in each group was examined with histograms and normal Q-Q plots. CRP was right skewed and was analysed on the natural log scale, as planned in the protocol. Results were back-transformed and are presented as geometric means and their ratio with 95% confidence intervals.”

Results:

“The geometric mean CRP on day 3 was 48.1 mg/L in group A and 21.8 mg/L in group B, a ratio of 2.21 (95% CI 0.96 to 5.08; t-test on log values, p = 0.061).”

The SAMPL guidelines (Lang and Altman) ask authors to identify procedures that modify raw data before analysis, such as transforming measurements to make distributions closer to normal, to confirm that the assumptions of the test or analysis were met (for linear regression, whether an analysis of residuals confirmed linearity), and to report how any outlying values were treated.

By specialty

Assumption problems by specialty

HbA1c in 300 patients on two drugs. Shapiro-Wilk on the whole column gives p < 0.001.

Look at each group, or the regression residuals, on a Q-Q plot. With 150 per group, mild skew does not stop a t-test on means.

Common myths

Common mistaken beliefs

  • Myth: Shapiro-Wilk p > 0.05 proves the data are normal.

    It means the test did not detect non-normality. In the simulation above, with 10 patients it missed strongly skewed data in 71% of samples.

  • Myth: A significant normality test in a large sample rules out a t-test.

    With 500 patients the test flagged mild skew in 98% of samples. At that size the t-test on means is still valid (Lumley et al., 2002). Look at the plots.

  • Myth: The whole outcome column must be normal.

    The values within each group, or the residuals of a regression, are what matter. Two normal groups with different means make a two-humped column.

  • Myth: Non-parametric tests have no assumptions.

    They still need independent observations, and they answer a question about ranks, not means.

  • Myth: Outliers should be deleted.

    Only proven errors should be corrected or removed. ICH E9 asks for an analysis with the actual values and one that reduces the outlier effect, with the differences discussed.

  • Myth: A log transformation always fixes skew.

    It needs positive values and suits right skew. In the worked example the reciprocal left the residual skewness at 1.16, with the tail now coming from the smallest values.

  • Myth: The central limit theorem makes the data normal.

    It concerns the distribution of the mean. Individual values, reference ranges and small samples are not covered by it.

Why this matters to you

Five consequences of getting assumption checks wrong

  1. Protocol sent back

    ICH E9 expects transformations of key variables to be specified in the protocol with a rationale. "Normality will be checked" is not a plan.

  2. A different test for every variable

    Choosing the test from the p-value of a normality test on pooled data gives an analysis that changes with sample size, not with the clinical question.

  3. Questions you cannot answer at the viva

    "Why Mann-Whitney?" needs an answer about the shape of each group, the sample size and what the result estimates.

  4. Misreading papers

    A geometric mean ratio of 0.76 means 24% lower. Reading it as a difference of 0.76 units is a common error.

  5. Harm to patients

    A mean ± 2 SD range on skewed data can give an impossible negative lower limit, as in the worked example (−65.8 mg/L), and misclassify patients.

History

History of checking assumptions

  1. 1964

    George Box and David Cox

    Published "An analysis of transformations", the family of power transformations that includes the log, square root and reciprocal as special cases.

  2. 1965

    Samuel Shapiro and Martin Wilk

    Published "An analysis of variance test for normality (complete samples)" in Biometrika: the Shapiro-Wilk test.

  3. 1967

    Hubert Lilliefors

    Published the Kolmogorov-Smirnov test for normality with the mean and variance unknown, that is, estimated from the sample.

  4. 1968

    Martin Wilk and Ram Gnanadesikan

    Published "Probability plotting methods for the analysis of data" in Biometrika, still cited as a reference for Q-Q plots of residuals.

  5. 1995

    Patrick Royston

    Published a remark on the algorithm for the W-test (AS R94). The documentation of R's shapiro.test(), which accepts 3 to 5000 values, refers to it for the accuracy of its approximate p-value.

  6. 2002

    Thomas Lumley and colleagues

    Showed by simulation in extremely non-normal data that the t-test and linear regression are valid for any distribution in large samples.

  7. 2012

    Justine Rochon, Matthias Gondan and Meinhard Kieser

    Showed that a preliminary Shapiro-Wilk test used to choose between the t-test and the Mann-Whitney test alters the conditional type I error rates of the main test.

Guidelines

Assumptions, transformations and outliers in guidelines

ICH E9 (1998), section 5.4

“Transformations (e.g. square root, logarithm) should be specified in the protocol and a rationale provided, especially for the primary variable(s).”

ICH E9 (1998), section 5.3

If no procedure for outliers was set in the protocol, “one analysis with the actual values and at least one other analysis eliminating or reducing the outlier effect should be performed and differences between their results discussed.”

SAMPL guidelines, preliminary analyses

“Identify any statistical procedures used to modify raw data before analysis,” for example transforming continuous measurements to make distributions closer to the normal distribution.

SAMPL guidelines, regression

“Confirm that the assumptions of the analysis were met. For example, in linear regression indicate whether an analysis of residuals confirmed the assumptions of linearity.” “If relevant, report how any outlying values were treated in the analysis.”

Reading a paper

Five checks on how a paper handled assumptions

  • Was normality judged within each group, or on the residuals, and not on the pooled outcome column?
  • Were plots used, or only a normality test whose result depends heavily on the sample size?
  • If the data were transformed, were results back-transformed and described correctly (geometric means, ratios)?
  • For regression, do the authors say how the residuals were checked for linearity, constant spread and outliers?
  • Were outliers handled as stated in advance, with results given with and without them?

Why is it called that?

Word surgery

“Assumption”

In everyday speech

Something you believe without proof, often a guess.

In research

A condition under which a test gives correct p-values and CIs, such as normal residuals or equal variances. It should be checked, not believed.

“Transformation”

In everyday speech

A complete change, a makeover.

In research

The same values placed on a different scale (log, square root). The order of the values is kept, except with the reciprocal, which reverses it.

Memory trick

Plot first, test second. A normality test answers “exactly normal?”, and its answer depends mostly on how many patients you have.

Residual

Latin residuum: "that which is left behind"

What is left of each observed value after the model's prediction is subtracted.

Outlier

out- + lie: first used c. 1600 for a stone quarried and removed but left unused

A value lying far from the rest of the data. It needs checking, not automatic removal.

Transform

Latin transformare: "change in shape", from trans "across" + formare "to form"

Changing the scale of the values so that their distribution changes shape.

Assumption

Latin assumptio: "a taking up, receiving, acceptance"

A condition a method takes as given. Its meaning "something taken for granted" dates from the 1620s.

Exam answers

Model answer outlines

Assumptions of ANOVA and how to check them

MD Community Medicine 2013
  1. Independence: each observation comes from a different, unrelated patient (except planned repetition in repeated measures designs). Checked from the study design, not from a test.
  2. Normality within groups: the outcome in each group, or the residuals, is roughly normal. Check with a Q-Q plot of the residuals or of each group, supported by the Shapiro-Wilk test. With large groups the F-test is little affected by mild non-normality, because it compares means.
  3. Equal variances (homoscedasticity): similar spread in every group. Check with box plots and Levene's test. If it fails, use Welch's ANOVA or the Games-Howell post hoc test.
  4. Measurement outcome on an interval or ratio scale.
  5. For repeated measures ANOVA: sphericity, checked with Mauchly's test.
  6. If assumptions fail: transform (log for right skew, then back-transform), use the Kruskal-Wallis test (or Friedman for repeated measures), and check outliers against the records.
  7. Caution: normality tests have little power in small samples and flag trivial deviations in large ones, so decide mainly from plots and plan the analysis in the protocol.

Parametric and non-parametric tests: differences, and the assumptions of parametric tests

Ph.D. RM 2013
FeatureParametricNon-parametric
AssumesA distribution (usually normal) with parameters such as mean and SDNo particular distribution
Works onActual valuesRanks or signs
SummaryMean and SDMedian and IQR
Examplest-tests, ANOVA, Pearson rMann-Whitney U, Wilcoxon, Kruskal-Wallis, Friedman, Spearman rho
Best forMeasurements, roughly normal within groupsOrdinal data, skewed data in small samples, outliers

Assumptions of parametric tests, and how to check each:

  1. Normality of the values within each group, or of the residuals: histogram and Q-Q plot, Shapiro-Wilk test (Kolmogorov-Smirnov needs the Lilliefors correction and has less power).
  2. Equal variances: box plots, Levene's test. Welch's t-test if they differ.
  3. Independent observations: from the design.
  4. Interval or ratio scale of measurement, with random sampling.

Points that earn marks: in large samples the central limit theorem makes the t-test valid for skewed data. A log transformation with back-transformation to geometric means is an alternative to a rank test for right-skewed positive data. Normality tests have low power in small samples.

The one thing to remember

Check the shape of each group, or of the residuals, on a plot, and decide what to do from the plot, the sample size and the clinical question, not from the p-value of a normality test.

All worked examples and interactive elements use made-up numbers for teaching. Every statistic was computed in Python (SciPy 1.15, statsmodels 0.14), and the simulation of normality tests used 4,000 samples per point.

Sources: James PT et al. PLoS Med 2019;16(8):e1002870 (doi:10.1371/journal.pmed.1002870, PMID 31408467). Ghasemi A, Zahediasl S. Int J Endocrinol Metab 2012;10(2):486–9 (doi:10.5812/ijem.3505, PMID 23843808). Lumley T, Diehr P, Emerson S, Chen L. Annu Rev Public Health 2002;23:151–69 (doi:10.1146/annurev.publhealth.23.100901.140546, PMID 11910059). Rochon J, Gondan M, Kieser M. BMC Med Res Methodol 2012;12:81 (doi:10.1186/1471-2288-12-81, PMID 22712852). Box GEP, Cox DR. J R Stat Soc B 1964;26(2):211–43 (doi:10.1111/j.2517-6161.1964.tb00553.x). Shapiro SS, Wilk MB. Biometrika 1965;52(3–4):591–611 (doi:10.1093/biomet/52.3-4.591). Lilliefors HW. J Am Stat Assoc 1967;62(318):399–402 (doi:10.1080/01621459.1967.10482916). Wilk MB, Gnanadesikan R. Biometrika 1968;55(1):1–17 (doi:10.1093/biomet/55.1.1). Royston P. Appl Stat 1995;44(4):547 (doi:10.2307/2986146). ICH E9 Statistical Principles for Clinical Trials, 1998. Lang TA, Altman DG. Basic statistical reporting for articles published in biomedical journals: the SAMPL Guidelines. Int J Nurs Stud 2015;52(1):5–9 (doi:10.1016/j.ijnurstu.2014.09.006, PMID 25441757). IBM SPSS Statistics 30 documentation (Explore Plots; Linear Regression Plots). R documentation for stats, lmtest, sandwich and MASS, and the jmv package documentation, accessed 15 September 2026.

Further reading: Indrayan A, Malhotra RK. Medical Biostatistics. 4th ed. Boca Raton: CRC Press; 2018. ISBN 978-1-4987-9953-9. Jawlik AA. Statistics from A to Z: Confusing Concepts Clarified. Hoboken, NJ: Wiley; 2016 (doi:10.1002/9781119272021).

Past papers

TNMGRMU questions on checking assumptions

Questions from MD, MS, DM, MCh and Ph.D. papers that this chapter helps you answer. Tap a sitting to open the university's own question paper.

  1. ×1Assumptions in ANOVAMD Community Medicine · Oct 2013
  2. ×1Distinguish between Parametric and Non Parametric Tests. What are the assumptions of the Parametric Tests?Ph.D. RM · Jul 2013

Further reading

Related Stateazy articles