# Quantile-Quantile (QQ) Plots

I understand how to assess whether an exponential/normal distribution is suitable to model a piece of data when the parameters are given, i.e. finding the theoretical quantiles and plotting against the sample quantiles. However when the parameters aren't given e.g. for exponential, lambda is unknown then how would you find theoretical qunatiles, and the same for the normal distribution too?

• I believe the parameter is estimated and it's plotted against what the theoretical quantities would be given that parameter. – badatmath Feb 8 at 16:38

## 1 Answer

The short answer is that you get the theoretical quantiles from the standard normal distribution $$(\mu =0, \sigma=1)$$ or the standard exponential distribution $$(\lambda = 1).$$

The fundamental idea is that you're judging whether the Q-Q plot is essentially linear. You don't need to know the equation of the line in order to judge linearity. However, if you do know the parameter(s), then you can know the equation of the line. And by estimating parameter(s) you may be able to get a good approximation of the equation.

Default Q-Q plots in R put the theoretical quantiles on the horizontal axis and the quantiles of the data on the vertical axis. In North America, perhaps it is more common to put the quantiles of the data on the horizontal axis; in the graphical qqnorm you can use the parameter datax=T to do this. For easier comparison with a plot of the empirical CDF, I will put data on the horizontal axis in my examples.

The ECDF of a sample puts probability $$1/n$$ at each data value; if $$k$$ observations are tied at a single value, then the probability of that value is $$k/n.$$ For sufficiently large samples the ECDF of the sample closely matches the CDF of the population distribution.

Normal example. Generate a sample of size $$n = 1000$$ and make a normal Q-Q plot.

set.seed(1902)           # for reproducibility
x = rnorm(1000, 100, 15) # mean 100, SD 15
par(mfrow=c(1,2))        # enable 2 plots per panel
plot(ecdf(x))
curve(pnorm(x,100,15),add=T,col="green", lwd=3, lty="dotted")
qqnorm(x, datax=T)
abline(a=-100/15, b=1/15, col="green", lwd=3, lty="dotted")
par(mfrow=c(1,1))        # resume single-plot mode


In the ECDF plot at left, the black ECDF values nearly match the dotted green CDF values for $$\mathsf{Norm}(\mu=100,\sigma=15).$$ In the Q-Q plot at right, the vertical scale has been distorted so that the CDF becomes a straight line $$y = -\frac{\mu}{\sigma} + \frac{1}{\sigma}x.$$

Even when data are precisely from a particular distribution, you should not expect all data points at the extremes of the sample to fall really near to the straight line corresponding to that distribution.

Exponential example. R has no built-in function for making exponential Q-Q plots, but making them is not difficult. I am using a method suggested by one of the answers on our stat site. The data are from an exponential distribution with rate $$\lambda = 3$$ (thus mean $$\mu = 1/3).$$

set.seed(208)
x = rexp(1000, rate=3) # mean= 1/3, rate = 3
par(mfrow=c(1,2))        # enable 2 plots per panel
plot(ecdf(x));
curve(pexp(x, 3),add=T,col="green", lwd=3, lty="dotted")
qqplot(x, qexp(ppoints(length(x))), ylab="Theoretical Quantiles")
abline(a=0, b=3, col="green", lwd=3, lty="dotted")
par(mfrow=c(1,1))


Again here the ECDF very nearly matches the exponential CDF and the the line $$y = \lambda x$$ is a distorted version of the CDF.

Note: On request, R will make approximate lines through Q-Q plots, usually based on the first and third quartiles of the data and the first and third quartiles of the standard theoretical distribution. These are usually good enough to judge whether the points are "approximately linear". (For normal QQ plots.)