Quantile Plot

1
1
−12−10−8−6−4−2024681012−4−3−2−101234
In order to check our statistical model it is often useful to use a quantile plot to assess how well the model fits the data. A quantile plot or Q-Q plot compares model quantiles with sample quantiles.

Define order statistics y(1)...y(n) to be the re-ordered data points y1,...,yn sorted in ascending order.

The ith th order statistic is defined to be the sample p-quantile with p=(i0.5)/n.

Now we have the sample quantiles we need the theoretical quantiles of the model. We denote the theoretical quantiles with Qi where P(YiQi)=i0.5n We can then produce a scatter plot of the theoretical quantiles against the sample quantiles.
        

R-Code

y <- rnorm(200,mean=0,sd=1) ordered_y <- sort(y) p <- ((1:200)-0.5)/200 Q <- qnorm(p,mean=0,sd=1) dat <- data.frame(Q=Q,y=ordered_y) ggplot(dat, aes(x=Q, y=y)) + geom_point() + geom_abline()