# testing if data is from a normal distribution

I have some maximum temperature data. Here is the histogram and qqplot:

Visually they look pretty good and I would reasonably say they are from a normal distribution but the Shapiro-Wilk Normality Test (shapiro.test in R) is saying that it is not from a normal distribution.

I found this post which basically says: don't bother testing for normality it will get it wrong. However I used this test in the past (on a generated dataset for a class), and it worked well. It is also the most robust of the statistical tests out there.

Is it better to visually examine the data or use a test for normality to make sure my assumptions are valid? How robust is the Shapiro-Wilk Normality Test?

*I am curious if anyone else has had this issue with actual data as apposed to generated data.

The key quote from the SO post you link is the following, especially the second half:

When the sample size is small, even big departures from normality are not detected, and when your sample size is large, even the smallest deviation from normality will lead to a rejected null.

With normality tests (or any other test), there is always a continuum. If your data generating process is even slightly non-normal, then normality will be rejected if your $n$ is large enough. Look at that SO post again: even a $t$ distribution with 200 degrees of freedom will be rejected as non-normal given enough data - and that is about as normal as you can ever get, unless you are explicitly generating normal data.

Of course, it is no surprise that normality tests perform as expected if you have explicitly generated normally distributed data. Unfortunately, that doesn't tell you much about what happens with real data.

You seem to have more than 1500 data points. I'd say that you are well and truly beyond the threshold at which small deviations from non-normality are picked up.

The question isn't whether data are normally distributed. They never are. (Simply measuring accuracy means that real measured data are in the end always discrete, so they cannot be normal.) The question, if at all, is whether they are sufficiently normal for whatever you need normality for. And I'd argue that they typically are. For instance, ANOVA F tests are surprisingly robust against non-normally distributed residuals, since what is relevant is actually the normal distribution of the parameter estimates, which is certainly given once you have enough data that your normality tests start rejecting residuals.

Bottom line: think about why you need normality. And whether at all.

Stephan covers the direct issue very well. I just thought I'd address a couple of side issues:

The common notion that it's better to test normality and choose between a t-test and a nonparametric alternative (a signed rank test or a Wilcoxon-Mann-Whitney depending on whether it's a one-sample/paired vs a two-sample situation) appears to be somewhat mistaken; that process impacts the properties (significance level and power) of both the subsequent possible tests.

Unless you know to expect no-heavier-than-normal tails$^\dagger$, you may be better to simply not consider making the normality assumption in the first place (the power loss is never very large but the power advantage can be great, particularly with small effects and large samples).

$\dagger$ The t-test tends to perform slightly better than the usual nonparametric alternative at the normal ... but it has a bigger advantage when the tail is lighter. (Other choices would have bigger advantages still, but they're not usually in consideration in these sorts of questions)