47
$\begingroup$

I have plotted this after I did a Shapiro-Wilk normality test. The test showed that it is likely that the population is normally distributed. However, how to see this "behaviour" on this plot? enter image description here

UPDATE

A simple histogram of the data:

enter image description here

UPDATE

The Shapiro-Wilk test says:

enter image description here

$\endgroup$
  • 6
    $\begingroup$ Re the edit: the SW test result rejects the hypothesis that these data were independently drawn from a common normal distribution: the p-value is very small. (This is apparent both in the qq plot, which exhibits a short left tail, and in the histogram, which exhibits positive skewness.) This suggests you misinterpreted the test. When you interpret the test correctly, do you still have a question to ask? $\endgroup$ – whuber Mar 16 '13 at 21:34
  • 4
    $\begingroup$ On the contrary: the software and all the plots are consistent in what they say. The qq plot and the histogram show specific ways in which the data deviate from normality; the SW test says that such data are unlikely to have come from a normal distribution. $\endgroup$ – whuber Mar 17 '13 at 15:43
  • 1
    $\begingroup$ Why does the plots say that its not normaly distributed? The qqplot creates a straight line and the histogram looks also normaly distributed? I do not get it;( $\endgroup$ – Le Max Mar 17 '13 at 16:01
  • 7
    $\begingroup$ The qq plot clearly is not straight and the histogram clearly is not symmetric (which is perhaps the most basic of the many criteria a normally distributed histogram must satisfy). Sven Hohenstein's answer explains how to read the qq plot. $\endgroup$ – whuber Mar 17 '13 at 16:33
  • 1
    $\begingroup$ You might find it helpful to generate a normal vector of the same size and create a QQ-plot with the normal data to see how it might appear when the data, in fact, comes from a normal distribution. $\endgroup$ – StatsStudent May 9 at 23:59
31
$\begingroup$

"The test showed that it is likely that the population is normally distributed."

No; it didn't show that.

Hypothesis tests don't tell you how likely the null is. In fact you can bet this null is false.

The Q-Q plot doesn't give a strong indication of non-normality (the plot is fairly straight); there's perhaps a slightly shorter left tail than you'd expect but that really won't matter much.

The histogram as-is probably doesn't say a lot either; it does also hint at a slightly shorter left tail. But see here

The population distribution your data are from isn't going to be exactly normal. However, the Q-Q plot shows that normality is probably a reasonably good approximation.

If the sample size was not too small, a lack of rejection of the Shapiro-Wilk would probably be saying much the same.

Update: your edit to include the actual Shapiro-Wilk p-value is important because in fact that would indicate you would reject the null at typical significant levels. That test indicates your data are not normally distributed and the mild skewness indicated by the plots is probably what is being picked up by the test. For typical procedures that might assume normality of the variable itself (the one-sample t-test is one that comes to mind), at what appears to be a fairly large sample size, this mild non-normality will be of almost no consequence at all -- one of the problems with goodness of fit tests is they're more likely to reject just when it doesn't matter (when the sample size is large enough to detect some modest non-normality); similarly they're more likely to fail to reject when it matters most (when the sample size is small).

$\endgroup$
  • $\begingroup$ In fact, this made me misread the OP's statement: I thought he said unlikely. Note that I slightly disagree with you: while a test normally tells you how unlikely an observation would be if the null hypothesis were true, we use this to argue that since we did get this observation, the null hypothesis is unlikely to be true. $\endgroup$ – Nick Sabbe Mar 15 '13 at 10:10
  • $\begingroup$ Thx for your answer! I am a little bit confused by all the statements which go into the other direction. To say it clearly, my excercise is it to make a statement about the normality of the sample. So what would you suggest to say as an answer to my professor? And how to show normality even the sample size is huge?;S $\endgroup$ – Le Max Mar 16 '13 at 18:43
  • 2
    $\begingroup$ About the strongest you could say would be something like - "The Q-Q plot is reasonably consistent with normality, but the left tail is a little 'short'; there's mild indication of skewness." $\endgroup$ – Glen_b Mar 17 '13 at 10:12
36
$\begingroup$

If the data is normally distributed, the points in the QQ-normal plot lie on a straight diagonal line. You can add this line to you QQ plot with the command qqline(x), where x is the vector of values.

Examples of normal and non-normal distribution:

Normal distribution

set.seed(42)
x <- rnorm(100)

The QQ-normal plot with the line:

qqnorm(x); qqline(x)

enter image description here

The deviations from the straight line are minimal. This indicates normal distribution.

The histogram:

hist(x)

enter image description here

Non-normal (Gamma) distribution

y <- rgamma(100, 1)

The QQ-normal plot:

qqnorm(y); qqline(y)

enter image description here

The points clearly follow another shape than the straight line.

The histogram confirms the non-normality. The distribution is not bell-shaped but positively skewed (i.e., most data points are in the lower half). Histograms of normal distributions show the highest frequency in the center of the distribution.

hist(y)

enter image description here

$\endgroup$
  • $\begingroup$ I find that putting the confidence intervals on the qqplot is useful. Nothing is "perfectly" normal, and sample-size can drive how far something can be inexact and still within normal. $\endgroup$ – EngrStudent Jun 12 '16 at 17:43
  • $\begingroup$ @EngrStudent Do you have code to share to include the confidence interval in the qqplot? $\endgroup$ – danno Nov 17 '17 at 16:19
  • 1
    $\begingroup$ @danno Check out the qqPlot function in the car package. $\endgroup$ – Sven Hohenstein Nov 17 '17 at 16:38
  • $\begingroup$ @danno - look at "qqPlot" in the "car" library. It has been around for a while, and I didn't make it. It adds the confidence intervals. You can also specify the base distribution for some non-normal distributions. It is in my answer below. $\endgroup$ – EngrStudent Nov 17 '17 at 16:54
  • 1
    $\begingroup$ I think it's probably better for the novice too to indicate that the points needs to lie $approximately$ on a straight line for the normality assumption to really check out. $\endgroup$ – StatsStudent May 9 at 23:57
23
$\begingroup$

Some tools for checking the validity of the assumption of normality in R

library(moments)
library(nortest)
library(e1071)

set.seed(777)
x <- rnorm(250,10,1)

# skewness and kurtosis, they should be around (0,3)
skewness(x)
kurtosis(x)

# Shapiro-Wilks test
shapiro.test(x)

# Kolmogorov-Smirnov test
ks.test(x,"pnorm",mean(x),sqrt(var(x)))

# Anderson-Darling test
ad.test(x)

# qq-plot: you should observe a good fit of the straight line
qqnorm(x)
qqline(x)

# p-plot: you should observe a good fit of the straight line
probplot(x, qdist=qnorm)

# fitted normal density
f.den <- function(t) dnorm(t,mean(x),sqrt(var(x)))
curve(f.den,xlim=c(6,14))
hist(x,prob=T,add=T)
$\endgroup$
11
$\begingroup$

While it's a good idea to check visually whether your intuition matches the result of some test, you cannot expect this to be easy every time. If the people trying to detect the Higgs Boson would only trust their results if they could visually assess them, they would need a very sharp eye.

Especially with big datasets (and thus, typically with increasing power), statistics tend to pick up the smallest of differences, even when they are hardly discernable with the naked eye.

That being said: for normality, your QQ-plot should show a straight line: I would say it does not. There are clear bends in the tails, and even near the middle there is some commotion. Visually, I still might be willing to say (depending on the goal of checking normality) this data is "reasonably" normal, though.

Note however: for most purposes where you want to check normality, you only need normality of the means instead of normality of the observations, so the central limit theorem may be enough to rescue you. In addition: while normality is often an assumption that you need to check "officially", many tests have been shown to be pretty insensitive to having this assumption not fulfilled.

$\endgroup$
2
$\begingroup$

I like the version out of the 'R' library 'car' because it provides not only the central tendency, but the confidence intervals. It gives visual guidance to help confirm whether the behavior of the data is consistent with the hypothetical distribution.

library(car)

qqPlot(lm(prestige ~ income + education + type, data=Duncan), 
       envelope=.99)

some links:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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