# QQ-plot doesn't correspond with histogram

I made a histogram and QQ-plot, using this code:

hist(ang$Pkt, , ylim=c(0,0.05), freq = F, breaks = 10) curve(dnorm(x, mean=mean(ang$Pkt),
sd=sd(ang$Pkt)), add=TRUE, col="red", lty="dotted", xaxt="n") qqnorm(ang$Pkt)
qqline(ang\$Pkt, col ="red")


I got those two images:

According to what I found it means that variables should be concentrated in the centre. But according to histogram, they are not. What can be the cause of wrong QQ plot?

• If you need help interpreting statistical plots, you should be asking for help at Cross Validated. This is not a programming specific question that's appropriate for Stack Overflow. – MrFlick Sep 15 '17 at 17:58
• I'm not asking about interpreting. This histogram doesn't correspond to the QQ plot, something is definitely wrong. The proper QQ plot according to what is depicted on histogram ishould be the mirror reflection of the current one. – Marmar Sep 15 '17 at 17:59
• I'm not convinced they don't match. You should provide a reproducible example with input data that we can look at more closely. – MrFlick Sep 15 '17 at 18:07
• A comparison of using qqnorm over a normal and a uniform distribution gives a better idea of how qqnorm works : qqnorm(rnorm(n = 10000,mean =500 ,sd = 400)) and qqnorm(runif(n = 1000, min = 1, max=1000) ) – R.S. Sep 15 '17 at 18:54
• Please do not cross post; decide which site is best & ask your question there. Asking in 2 places resulting in people taking their time to migrate your question & close the resulting duplicate, & annoys a lot of people you are asking to help you. – gung - Reinstate Monica Sep 16 '17 at 0:16

## 1 Answer

I don't think there's much discrepancy in the impression of the two at all; the bin placement is slightly distorting the impression but not by all that much; I'd suggest roughly doubling the default bin count perhaps, but it looks much as I'd have expected.

Let's begin with what a uniform distribution would look like in a Q-Q plot and then we can discuss discrepancies from that.

Here's a normal Q-Q plot for 200 uniform values in (10,50):

You can see it sort of follows the line in the middle but flattens at each end.

The uniform is not "concentrated in the center". It has very short tails, but within its range it's not concentrated at all.

So what does your data do?

In the absence of the original data I have stretched the Q-Q plot so the scales line up, allowing us to see the Q-Q plot-points falling into the histogram bins:

We can see that each point in the Q-Q plot falls into a bin in the histogram. Notice that in the upper half, your QQ plot sort of follows the normal line until the top bin where it flattens sharply. Now consider that when the Q-Q plot is nearly flat, we have a lot of points stacking up together (see the top-right):

(plot taken from this answer)

You can see in the upper part of your Q-Q plot this is happening, producing a taller bin. In the lower part the trend away from the line is much more gentle, running across more than one bin, producing slightly shorter bins.

So if I only had the Q-Q plot I'd expect it to look not too far from uniform, with a taller bin at the right end and shorter bins at the left end, which is more or less what we see.

To get the histogram to show a relative "concentration" in the center, you'd need longer tails than the normal and a steeper slope in the center, almost the exact reverse of what's going on in this QQ plot.