I am using R. I have two data sets. The first one is generated with rnorm(), the second one is created manually.

Histogram of the first set is here

enter image description here

and Shapiro-Wilk (shapiro.test()) returns p-value 0.189, which is expected.

> shapiro.test(d)

    Shapiro-Wilk normality test

data:  d
W = 0.96785, p-value = 0.189

The second data set are residuals from linear regression fitting function (got by lm()) and its histogram is here:

enter image description here

I'd expect it to be detected as a normal distribution or, at least, pretty close to it. But Shapiro-Wilk gives p-value 4.725e-05, which strictly denies the possibility of it being a normal distribution.

> shapiro.test(fit$residuals)

    Shapiro-Wilk normality test

data:  fit$residuals
W = 0.70681, p-value = 4.725e-05

Do you know, why does it behave like this?

Data 1 (d)


Data 2 (fit$residuals)



I've added additional case with just 10 observations generated by rnorm() function too.

Data doesn't look very normally distributed at first sight, but Shapiro-Wilk tells otherwise.

enter image description here

> shapiro.test(dd)

    Shapiro-Wilk normality test

data:  dd
W = 0.93428, p-value = 0.4912

Data 3 (dd)

  • $\begingroup$ R has it right. Should be Wilk (Martin B. Wilk) not Wilks (Samuel S. Wilks) here throughout. Edited accordingly. $\endgroup$
    – Nick Cox
    Commented Mar 3, 2017 at 11:26
  • $\begingroup$ @NickCox Thank you. So, is my interpretation of histogram wrong? And could you, please, write a full answer, so I could accept it? $\endgroup$
    – Eenoku
    Commented Mar 3, 2017 at 11:31
  • 2
    $\begingroup$ A normal Q-Q plot clearly reveals why the Shapiro Wilk test would reject. for "Data 2". $\endgroup$
    – Glen_b
    Commented Mar 3, 2017 at 12:33
  • $\begingroup$ @Glen_b Ok, could you, please, submit your answer with a little explanation? I'm really not experienced in this area. $\endgroup$
    – Eenoku
    Commented Mar 3, 2017 at 13:06
  • $\begingroup$ I have answered. I am in full agreement with @Glen_b. $\endgroup$
    – Nick Cox
    Commented Mar 3, 2017 at 13:19

3 Answers 3


The second dataset has two clear outliers, one high and one low. So the test result appears perfectly plausible.

Here a normal quantile plot makes the point.

enter image description here

In this question, and usually,

  1. Worrying about the Shapiro-Wilk test result is much less important than worrying about whether the regression makes sense. If possible, you should show us the data and the regression results. Perhaps the regression is about the best you can do and one outlier either side is just the way your data are. Normally distributed residuals are just an ideal condition, while life is imperfect. Or perhaps a different regression is needed. We can't tell without more information.

  2. A histogram can be a fairly poor means for judging normality or non-normality. It's better than not looking at the data at all, but the normal quantile plot (a.k.a. normal probability plot) is tailored to that purpose. The outliers aren't hidden in your histogram (they are shown in the extreme bins), but it's much harder to see them as outliers on the histogram.

What you can also do is

  • Go back to the data and check which points are outliers. Do those points make sense given other variables and what else you know?

  • Consider some other kind of regression (e.g. quantile regression) as a check on results.


Looking at a non-significant p-value for any test doesn't lend support to the null hypothesis. In this case, a non-significant SW doesn't show normality-- it just means the sample doesn't have enough information to suggest stronger incompatibility with normality which may be due to sample size or just due to the actual distribution (or some kind of bias).

Relying too much on formal tests of normality can lead you astray, as they are often very powerful to detect even the slightest variation from normality which may have zero practical importance.

I would also disagree that a significant test "flies in the face" of normality; under a standard framework you could conclude the data are not from an underlying normal distribution, but looking at the data on a q-q and histogram is more revealing as to the shape of the empirical distribution: that is what you're using as a proxy for the underlying distribution, which is unknown.

Using subject matter expertise is often useful in statistics, and this is one where blindly following a p-value is likely to lead you astray.


I think this behavior can arise because your residuals series has only 20 observations while the first dataset generated with rnorm() has 50 observations. If you generate your random dataset with only 10 observations it will be easier that the test result is significant.

  • $\begingroup$ I've added the random dataset with 10 observations generated by rnorm() too and it's still confusing... $\endgroup$
    – Eenoku
    Commented Mar 3, 2017 at 12:18
  • 1
    $\begingroup$ Clearly you need to worry when you have small sample sizes, but sample size seems a side-issue in this case. The second dataset is clearly not normal. How far that is a big problem is then the question, $\endgroup$
    – Nick Cox
    Commented Mar 3, 2017 at 13:18
  • $\begingroup$ Totally agree @NickCox $\endgroup$ Commented Mar 3, 2017 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.