molecalculator

Moles & Molar Mass

How to Test for Normality: Methods & Examples

Calculator No. 01-8611 · Updated · Formula and assumptions shown below

The calculator on this page is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

To test for normality, you compare your data’s distribution against the bell-shaped normal curve using graphical plots (histogram, Q-Q plot) and statistical tests (Shapiro–Wilk, Anderson–Darling, Kolmogorov–Smirnov). The most common approach is to run the Shapiro–Wilk test for small samples (n < 50) and the Anderson–Darling test for larger samples, while always checking a Q-Q plot to see how closely your points follow the straight diagonal line.

Formula

The Shapiro–Wilk test computes a W statistic from the ordered sample values. For a sample of size n with values x(1) ≤ x(2) ≤ … ≤ x(n), the formula is:

W = ( Σ ai x(i) )² / Σ (xi − x̄)²

where ai are coefficients derived from the expected values of the order statistics under normality, x̄ is the sample mean, and the denominator is the total sum of squared deviations. The exact coefficients are tabulated and depend on n. A W close to 1 indicates normality. The p-value is the probability of observing a W this small (or smaller) if the data truly come from a normal distribution. In the calculator above, we show a placeholder approximation for illustration; in practice you would use statistical software to obtain the exact W and p-value.

Worked Example

Suppose you have a sample of 30 measurements with a mean of 0 and a standard deviation of 1 (standardized data). Using the default values in the calculator:

  • Sample mean (m) = 0
  • Sample standard deviation (sd) = 1
  • Sample size (n) = 30

The calculator returns an approximate W = 0.9869 + 0.0003 × 30 = 0.9959. This is very close to 1, suggesting the data are consistent with normality. The p-value placeholder is not meaningful; in a real test, you would compare the p-value to your significance level (e.g., 0.05). If p > 0.05, you fail to reject the null hypothesis of normality.

Assumptions

  • The sample is a random sample from the population.
  • Observations are independent.
  • The variable is continuous (at least approximately).
  • The test is sensitive to sample size; very large samples may reject normality for minor deviations.

Graphical Methods

Before running any formal test, always plot your data. A histogram overlaying a normal density curve gives a quick visual check: look for a symmetric bell shape. A Q-Q plot (quantile-quantile plot) is more reliable: plot your sorted data against the theoretical quantiles of a normal distribution. If the points fall roughly along the straight line y = x, normality is plausible. Systematic curvature (S-shape) suggests skewness; points that fan out at the ends indicate heavy tails. Graphical methods are subjective but often more informative than a single p-value, especially for small samples.

Formal Statistical Tests

Several tests quantify departure from normality. The most common are:

  • Shapiro–Wilk test: Best for small samples (n < 50). It is powerful but can be conservative for very small n.
  • Anderson–Darling test: Good for moderate to large samples; gives more weight to the tails.
  • Kolmogorov–Smirnov test: Compares the empirical distribution to a fully specified normal distribution (mean and variance known). It is less powerful because it uses the specified parameters, not estimated ones.
  • Jarque–Bera test: Based on skewness and kurtosis; works well for large samples.
  • D’Agostino’s K² test: Combines skewness and kurtosis into an omnibus test.

Each test has a null hypothesis: the data come from a normal distribution. A low p-value (typically < 0.05) indicates that the data are unlikely to be normal.

Choosing the Right Test

There is no single best test; the choice depends on your sample size and context:

  • For n < 50, use the Shapiro–Wilk test.
  • For 50 ≤ n < 300, Anderson–Darling or Shapiro–Wilk both work; Anderson–Darling is often preferred for its sensitivity to tails.
  • For n ≥ 300, even small deviations become significant; rely more on graphical assessment and consider the Central Limit Theorem (which makes normality of the sampling distribution less critical).
  • If you are testing residuals from a regression, the Shapiro–Wilk test is standard.

In practice, many statisticians recommend a combination: always look at a Q-Q plot and run one formal test. If the plot looks fine and the p-value is above 0.05, treat the data as normal.

Common Mistakes and Misconceptions

One frequent error is using the Kolmogorov–Smirnov test with estimated parameters; you should use the Lilliefors correction or the Anderson–Darling test instead. Another mistake is ignoring the sample size: with large samples, the test may reject normality for trivial deviations that have no practical impact. Conversely, with very small samples (n < 10), the tests have low power and may fail to detect non-normality. Also, remember that the tests check the distribution of the data, not the distribution of the sample mean; for t-tests and ANOVA, the sampling distribution of the mean matters, and the Central Limit Theorem often makes normality less critical for n > 30.

Alternatives When Data Are Not Normal

If your data fail the normality test, you have several options:

  • Transform the data: common transformations include log, square root, or Box–Cox. Re-test after transformation.
  • Use non-parametric tests: For comparing groups, use the Mann–Whitney U test instead of the t-test, or the Kruskal–Wallis test instead of ANOVA.
  • Use robust methods: trimmed means, bootstrapping, or rank-based procedures.
  • Use a different distribution: fit a skewed distribution like the gamma or log-normal if it matches the data.

Always consider the practical impact: many statistical procedures are fairly robust to moderate departures from normality, especially with larger samples.

Frequently Asked Questions

What is the null hypothesis in a normality test?
The null hypothesis is that the sample comes from a normally distributed population. If the p-value is greater than your significance level (e.g., 0.05), you do not reject the null, meaning there is no strong evidence against normality.

Why does my large sample fail the normality test even though the histogram looks normal?
With large samples, the test has high power to detect tiny deviations from normality. These deviations may be statistically significant but practically irrelevant. In such cases, rely on graphical inspection and consider whether the deviation affects your analysis.

Can I use a t-test if my data are not normally distributed?
Yes, if your sample size is large enough (n > 30) and the data are not heavily skewed, the t-test is robust due to the Central Limit Theorem. Alternatively, use a non-parametric test like the Mann–Whitney U test.

What is the difference between a Q-Q plot and a P-P plot?
A Q-Q plot compares quantiles of your data to quantiles of the theoretical normal distribution, while a P-P plot compares cumulative probabilities. Q-Q plots are more sensitive to deviations in the tails and are generally preferred.

Should I test normality before or after removing outliers?
Outliers can heavily influence normality tests. It is better to first identify and investigate outliers (they may be data entry errors), then decide whether to exclude them based on domain knowledge. Re-run the test after any removal, and report what you did.

Is the Shapiro–Wilk test valid for any sample size?
The Shapiro–Wilk test was designed for small to moderate samples (up to about 5000). For very large samples, it may be overly sensitive; use Anderson–Darling or graphical methods instead.

Related

Formula used
in m | Sample mean | - | 0 | -999999
in sd | Sample standard deviation | - | 1 | 0
in n | Sample size | - | 30 | 2
out w | Shapiro–Wilk W statistic | - | (0.9869 + 0.0003 * n) | 4
out p | Approx. p-value | - | 0.5 | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →