Theoretical Q-Q Plots |
We can also compare empirical quantiles (i.e., the sorted values of a sample) to the theoretical quantiles of a distribution such as the standard normal distribution ( N(0,1)). This is like plotting the sorted dataset against a sorted sample from a standard normal distribution, except we replace the sorted normal sample with the theoretical quantiles.
We can easily get the corresponding quantiles from the standard normal distribution using the qnorm() function:
qnorm( (1:10)/(11) )returns the quantiles for a sample of size 10 (recall that the expression 1:n means the sequence {1, 2, ..., n}). We could then use the qqplot() function to plot the observed data (sorted) against the theoretical quantiles of the standard normal. This is such a common plot, that S has it built in: qqnorm() produces the `normal probability plot' (theoretical Q-Q plot for the N(0,1) distribution).
qqnorm(A1)
As with empirical Q-Q plots, the normal plot is not reliable with small sample sizes. S has a function that adds roughly the right straight line to a qqplot. After making the qqplot, issue the qqline() command for the same dataset:
qqnorm(A1) qqline(A1)
It takes a bit of practice to develop your ability to interpret qqplots and normal plots.
|