Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 49

Visual and Formal Normality Checks

Recommended resources

Welcome to the next lesson in our module on the foundations of statistical inference. In our previous session, we calculated descriptive statistics and learned the crucial difference between using the mean/standard deviation for symmetric data and the median/interquartile range for skewed data. That distinction raises a critical question: how do we determine if our data is symmetric enough to justify using certain statistical methods?

Today, we will answer that question directly. Many of the most common statistical tests used in clinical research, such as the t-test and ANOVA, operate under the assumption that the data is sampled from a normal distribution. This lesson will equip you with the skills to check this assumption, a fundamental step in any robust analysis. You will learn how to assess data normality using two complementary approaches: visually with Quantile-Quantile (Q-Q) plots and formally with the Shapiro-Wilk test.

Why is Assessing Normality so Important?

Statistical tests are often grouped into two families: parametric and non-parametric.

  • Parametric tests (like the t-test) are powerful tools that can detect subtle effects, but their validity rests on certain assumptions about the data. The most common assumption is that the data follows a normal distribution.
  • Non-parametric tests (like the Wilcoxon test, which we'll see later) are more flexible as they don't require the normality assumption. However, they can sometimes be less powerful, meaning they might miss a real effect that a parametric test would have caught.

Choosing the correct test is therefore a critical decision in your analysis pipeline. Checking for normality is the gatekeeping process that guides this choice, ensuring your conclusions are statistically sound.

The following resource provides a brief but clear introduction to why this check is necessary.

13.9: Checking the Normality of a Sample

This article from Statistics LibreTexts opens by explaining the context for normality testing and introduces the two methods we'll cover today.

Read the introductory paragraphs, starting from the beginning of the article. Focus on understanding why real-world data might or might not be normal and how that relates to the statistical tests you'll use later.


Visual Assessment: Histograms and Q-Q Plots

Your first step in assessing normality should always be to visualize the data. A histogram can give you a quick impression—a bell shape suggests normality—but a more precise tool is the Quantile-Quantile (Q-Q) plot.

A Q-Q plot is a scatterplot that compares the quantiles of your data (on the y-axis) against the theoretical quantiles from a perfect normal distribution (on the x-axis).

  • If your data is normally distributed, the points on the plot will fall closely along a straight diagonal line.
  • If your data is not normally distributed, the points will deviate from the line in a systematic pattern. For instance, a curved "U" or "S" shape can indicate that your data is skewed or has "heavy" or "light" tails compared to a normal distribution.

The image below provides a perfect illustration, contrasting a normally distributed sample with a non-normal (specifically, right-skewed) one. Notice how the points in the normal Q-Q plot hug the red line, while the points in the non-normal plot curve away from it.

This figure shows histograms and Q-Q plots for both normal and non-normal data. For the normal data (left), the histogram is roughly symmetrical, and the Q-Q plot points lie on the line. For the non-normal data (right), the histogram is skewed, and the Q-Q plot points deviate systematically from the line.

To build a solid intuition for how these plots are constructed and what they represent, the following video from StatQuest is exceptionally clear.

Quantile-Quantile Plots (QQ plots), Clearly Explained!!!

This StatQuest video brilliantly explains the concept of a Q-Q plot by walking through its construction step-by-step.

Watch from the beginning of the video up to the point where the first Q-Q plot against a normal distribution is complete. Pay close attention to how the data quantiles are plotted against the normal distribution quantiles and how the fit to the straight line is judged.

Creating Q-Q Plots in R

You can create Q-Q plots in R using several functions. The base R qqnorm() function is simple and effective. However, for creating publication-quality graphics that align with the Tidyverse, the ggqqplot() function from the ggpubr package is an excellent choice.

The practical guide below demonstrates how to use ggqqplot() and other visualization methods.

Statistical Analysis of Biological Data

This practical guide demonstrates a typical analysis workflow in R, including normality assessment. We will refer to it several times. For now, focus on the section showing the various plots.

In the section "Part II - How to assess normality", find the subsection that introduces the Q-Q plot. Review the code block that uses ggqqplot(df1, x="Value") to see how simple it is to generate this plot. You can ignore the other plot types for now.


Formal Testing: The Shapiro-Wilk Test

While visual inspection is essential, it can be subjective. To complement our plots, we use a formal statistical test. The Shapiro-Wilk test is one of the most common and reliable tests for normality.

Like other hypothesis tests, it has a null and an alternative hypothesis:

  • Null Hypothesis (): The data was sampled from a normal distribution.
  • Alternative Hypothesis (): The data was not sampled from a normal distribution.

The test produces a p-value, which you interpret as follows (typically using a significance level, , of 0.05):

  • If : You fail to reject the null hypothesis. There isn't enough evidence to say the data is non-normal.
  • If : You reject the null hypothesis. The data deviates significantly from a normal distribution.

This video explains the logic of normality tests and the interpretation of the p-value very clearly.

Testing For Normality - Clearly Explained

This video, "Testing For Normality - Clearly Explained," covers the logic behind formal normality tests.

Please watch the section on normality tests. It will walk you through the null/alternative hypotheses and how to make a decision based on the p-value.

Running the Shapiro-Wilk Test in R

You can run the test in R using the base function shapiro.test(). Alternatively, the rstatix package (part of the tidyr ecosystem) provides a shapiro_test() function that works nicely within a %>% pipeline.

The "Statistical Analysis of Biological Data" guide demonstrates this tidy approach.

Statistical Analysis of Biological Data

This guide shows the rstatix implementation of the Shapiro-Wilk test.

Find the subsection titled Tests for normality. The code comments clearly explain how to interpret the p-value, and the shapiro_test() function is shown in action.


A Balanced Approach: Combining Plots and Tests

It might seem that you can just rely on the p-value from the Shapiro-Wilk test, but this is a common pitfall. The performance of normality tests is heavily influenced by sample size.

  • With small samples (e.g., n < 30), tests have low "power." They might fail to detect non-normality even when it's present. In these cases, visual inspection with a Q-Q plot is arguably more important.
  • With very large samples (e.g., n > 1000), tests have high "power." They can flag tiny, trivial deviations from perfect normality as "statistically significant," even if the data is "normal enough" for a parametric test to work well (thanks to a principle called the Central Limit Theorem).

The image below beautifully illustrates this point. It shows data from a non-normal (Gamma) distribution at different sample sizes.

This grid compares data from a non-normal (Gamma, left column) and normal (right column) distribution at sample sizes of 100, 30, and 15. Notice that for the Gamma distribution with N=15, the Q-Q plot looks suspect, but the Shapiro-Wilk p-value (0.327) is not significant. With N=100, the test easily detects the non-normality (p=0.013).

This leads to the most important takeaway of this lesson: always use both visual inspection and a formal test.

Your workflow should be:

  1. Plot your data: Look at a histogram and, more importantly, a Q-Q plot.
  2. Run the test: Perform the Shapiro-Wilk test to get a p-value.
  3. Synthesize:
    • If the plot looks good and p > 0.05, you can confidently assume normality.
    • If the plot looks bad and p ≤ 0.05, you have strong evidence of non-normality.
    • If the results conflict (e.g., a "good enough" plot but p ≤ 0.05 in a very large sample, or a "bad" plot but p > 0.05 in a very small sample), you must use your judgment, but the visual plot often provides the more practical guidance.

This combined approach prevents you from being misled by the limitations of a single method and is the hallmark of a careful data analyst.


Conclusion

In this lesson, you've added a critical diagnostic tool to your analytical skill set. You now understand why assessing normality is a prerequisite for many common statistical tests and how to perform this assessment using both visual and formal methods in R.

Key Takeaways:

  • Parametric vs. Non-parametric: The assumption of normality determines whether you can use more powerful parametric tests (like t-tests) or must use more robust non-parametric alternatives.
  • Q-Q Plots: This is your primary visual tool. Data is likely normal if the points fall along the diagonal line.
  • Shapiro-Wilk Test: This is your formal statistical check. The null hypothesis is that the data is normal. A p-value ≤ 0.05 suggests the data is not normal.
  • The Balanced Approach: Never rely on a p-value alone. Always combine the objective result of the Shapiro-Wilk test with the subjective but highly informative visual evidence from a Q-Q plot, being mindful of your sample size.

Preview of the Next Lesson:
Now that we've focused on understanding the distribution of a single variable, we'll shift our attention to exploring the relationship between two variables. In the next lesson, you will learn how to compute and interpret correlation coefficients, which measure the strength and direction of a linear association between two continuous variables.