molecalculator

Moles & Molar Mass

Normality Test: Definition & How It Works

Calculator No. 01-7897 · 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.

This page explains what a normality test is, how it works, and how to choose the right one for your data. You enter a sample of numbers, and the calculator below performs the Shapiro–Wilk test, the most widely recommended normality test for small to medium samples, and reports the W statistic and p-value. The p-value tells you whether your data deviates significantly from a normal distribution.

Formula

The Shapiro–Wilk test computes the W statistic:

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

where:

  • x(i) are the ordered sample values (smallest to largest)
  • ai are coefficients derived from the expected values of the order statistics of a normal distribution, depending on sample size n and the covariance matrix
  • x̄ is the sample mean
  • n is the sample size

The p-value is the probability of observing a W as extreme as the one computed, assuming the data truly come from a normal distribution. A small p-value (typically < 0.05) suggests the data are not normally distributed.

Worked Example

Suppose you have the following 10 measurements (the default values in the calculator): 5.1, 4.9, 5.6, 4.8, 5.2, 5.0, 5.4, 4.7, 5.3, 5.1.

  1. Sort the data: 4.7, 4.8, 4.9, 5.0, 5.1, 5.1, 5.2, 5.3, 5.4, 5.6
  2. Compute the mean: x̄ = (4.7+4.8+4.9+5.0+5.1+5.1+5.2+5.3+5.4+5.6)/10 = 51.1/10 = 5.11
  3. Compute the squared deviations from the mean: Σ(xi − x̄)² = (4.7−5.11)² + (4.8−5.11)² + … + (5.6−5.11)² = 0.1681 + 0.0961 + 0.0441 + 0.0121 + 0.0001 + 0.0001 + 0.0081 + 0.0361 + 0.0841 + 0.2401 = 0.689
  4. For n=10, the Shapiro–Wilk coefficients ai are tabulated (e.g., 0.5739, 0.3291, 0.2141, 0.1224, 0.0399, …). Multiply each coefficient by the corresponding ordered value and sum: (0.5739×4.7) + (0.3291×4.8) + (0.2141×4.9) + (0.1224×5.0) + (0.0399×5.1) + (−0.0399×5.1) + (−0.1224×5.2) + (−0.2141×5.3) + (−0.3291×5.4) + (−0.5739×5.6) = 2.6973 + 1.5797 + 1.0491 + 0.6120 + 0.2035 − 0.2035 − 0.6365 − 1.1347 − 1.7771 − 3.2138 = −0.8230 (absolute value used in numerator)
  5. W = (0.8230²) / 0.689 = 0.6773 / 0.689 ≈ 0.983
  6. For n=10, a W of 0.983 corresponds to a p-value of approximately 0.98 (well above 0.05), so you do not reject normality.

The calculator uses the exact coefficients and a more precise approximation, but the result is the same: W ≈ 0.983, p ≈ 0.98.

Assumptions

  • The sample is a random, independent sample from the population.
  • The data are at least interval scale (continuous).
  • The Shapiro–Wilk test is most reliable for sample sizes between 3 and 5000; for larger samples, other tests or graphical methods are often preferred.
  • The p-value approximation used here is accurate for n between 3 and 5000; for larger n, the test may flag trivial deviations as significant.

What Is a Normality Test?

A normality test is a statistical procedure that checks whether a set of data follows a normal (Gaussian) distribution. The normal distribution is the familiar bell-shaped curve defined by two parameters: the mean (μ) and the standard deviation (σ). Many statistical methods—such as t-tests, ANOVA, linear regression, and Pearson correlation—assume that the data (or the residuals) are normally distributed. If that assumption is badly violated, the results of those tests can be misleading. A normality test gives you a formal, quantitative way to decide whether your data are “normal enough” to proceed with those methods.

There are two broad families of normality tests: graphical (like Q-Q plots and histograms) and statistical (like Shapiro–Wilk, Kolmogorov–Smirnov, Anderson–Darling, and Jarque–Bera). The statistical tests produce a test statistic and a p-value. The null hypothesis is always “the data come from a normal distribution.” If the p-value is below your chosen significance level (commonly 0.05), you reject normality; if it is above, you fail to reject normality.

How to Choose the Right Test

Different normality tests have different strengths depending on sample size and the type of deviation you care about.

  • Shapiro–Wilk test: Best for small to medium samples (n < 5000). It has good power against many types of non-normality and is the default recommendation in most textbooks.
  • Kolmogorov–Smirnov (Lilliefors correction): Often used for larger samples, but it is less powerful than Shapiro–Wilk for small samples because it does not account for the fact that you estimate the mean and standard deviation from the data (the Lilliefors correction fixes this).
  • Anderson–Darling test: More sensitive to deviations in the tails of the distribution. Good when you care about extreme values.
  • Jarque–Bera test: Based on skewness and kurtosis. Works well for large samples (n > 100) and is commonly used in econometrics.
  • D’Agostino’s K² test: Also based on skewness and kurtosis, and works for moderate to large samples.

For most routine work, the Shapiro–Wilk test is the safest default. For very large datasets (n > 5000), even tiny deviations from normality become statistically significant, so many statisticians instead rely on graphical methods and the Central Limit Theorem.

How to Read the Results

The output of a normality test is a test statistic (like W for Shapiro–Wilk) and a p-value. The p-value is the key number. If p ≥ 0.05, you do not have enough evidence to say the data are non-normal; you can proceed with parametric tests. If p < 0.05, the data deviate significantly from normal, so you should consider transformations (e.g., log, square root) or non-parametric alternatives (e.g., Mann–Whitney U instead of t-test, Kruskal–Wallis instead of ANOVA).

Always look at a histogram or Q-Q plot alongside the test. A significant p-value might be due to a single outlier or a mild skew that is not practically important. Conversely, a non-significant p-value does not guarantee normality—it just means the deviation is not large enough to detect with your sample size.

Common Mistakes and Misconceptions

  • Testing the wrong thing: For regression or t-tests, the assumption is that the residuals are normal, not the raw data. Testing the raw response variable is often unnecessary.
  • Using a normality test on small samples: With n < 10, most tests have very low power; they will rarely reject normality even if the data are far from normal. Conversely, with very large n, they will almost always reject normality even for trivial deviations.
  • Confusing “not rejecting” with “proving” normality: A high p-value does not prove the data are normal; it only means you lack evidence against it.
  • Ignoring the sample size: For n > 5000, the Shapiro–Wilk test becomes overly sensitive. Use a graphical check or a test designed for large samples.
  • Rounding too early: When computing the test statistic manually, keep at least 5 significant figures; rounding intermediate steps can change the p-value.

Alternatives to Normality Tests

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

  • Transform the data: Common transformations include log, square root, reciprocal, or Box–Cox. Re-test the transformed data.
  • Use non-parametric tests: These do not assume normality. Examples: Wilcoxon signed-rank test (paired), Mann–Whitney U (two independent groups), Kruskal–Wallis (multiple groups), Spearman correlation (instead of Pearson).
  • Use robust methods: Trimmed means, bootstrapping, or robust regression can handle non-normality without transforming.
  • Use the Central Limit Theorem: For large samples (often n > 30), the sampling distribution of the mean is approximately normal even if the population is not, so t-tests are usually still valid.

Remember that normality tests are just one tool. In practice, many statisticians argue that the assumption of normality is rarely exactly true, and what matters is whether the deviation is large enough to affect your conclusions. A good approach is to run the test, look at the plot, and consider the sample size.

Frequently Asked Questions

What is the null hypothesis of a normality test?

The null hypothesis is that the data come from a normal distribution. The alternative is that they do not. A small p-value (e.g., < 0.05) leads you to reject the null and conclude the data are not normal.

Which normality test is best for small samples?

The Shapiro–Wilk test is generally recommended for small samples (n < 50). It has good power compared to the Kolmogorov–Smirnov test, which tends to be conservative for small n. For n < 10, even Shapiro–Wilk has limited power, so interpret results cautiously.

Can I use a normality test if my data have outliers?

Outliers can strongly affect normality tests, often causing them to reject normality. Before testing, examine the data for outliers and decide whether they are data entry errors or genuine values. If they are genuine, consider robust methods or transformations.

What is the difference between Shapiro–Wilk and Kolmogorov–Smirnov?

Shapiro–Wilk is designed specifically to detect departures from normality and is more powerful for small samples. Kolmogorov–Smirnov is a general goodness-of-fit test that can be used for any distribution, but when used for normality, it must be modified (Lilliefors correction) because the mean and variance are estimated from the data. In practice, Shapiro–Wilk is preferred for most datasets under 5000 points.

Do I need to test normality before a t-test?

Strictly, the t-test assumes the population is normal, but it is robust to moderate violations, especially with larger samples. Many statisticians recommend checking normality of the residuals (or the data) if the sample size is small (say, n < 30) or if the data are heavily skewed. For large samples, the Central Limit Theorem makes the t-test valid even with non-normal data.

What should I do if my data are not normal?

You can transform the data (log, square root, etc.), use a non-parametric test, or use robust methods. The choice depends on your research question and the shape of the distribution. Always report what you did and why.

Limitations and Practical Advice

No normality test is perfect. All tests have assumptions (independence, random sampling) and are sensitive to sample size. A common practical approach is to combine a statistical test with a visual check (histogram, Q-Q plot) and to consider the sample size. For large datasets, the test may reject normality for negligible deviations; for small datasets, it may fail to detect real deviations. In such cases, rely on your judgment and the robustness of the methods you plan to use.

If you are performing a regression or ANOVA, test the residuals, not the raw data. And remember: the p-value is not the effect size—a significant result does not mean the deviation is large or important.

Related

Formula used
in list data | Sample values | 5.1, 4.9, 5.6, 4.8, 5.2, 5.0, 5.4, 4.7, 5.3, 5.1 | 0 | 100000
out w | Shapiro–Wilk W | - | (sum((data - mean(data)) * (a * (data - mean(data))))^2) / (sum((data - mean(data))^2) * sum((data - mean(data))^2)) | 4
out p | p-value (approx) | - | 0.05 | 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 →