Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You want to make a quantile-quantile (QQ) plot to compare an empirical distribution to a theoretical distribution.
Use qqnorm() to compare to a
normal distribution. Give qqnorm() a vector
of numerical values, and add a theoretical distribution line with qqline() (Figure 13-25):
library(gcookbook)# For the data set# QQ plot of heightqqnorm(heightweight$heightIn)qqline(heightweight$heightIn)# QQ plot of ageqqnorm(heightweight$ageYear)qqline(heightweight$ageYear)
The points for heightIn are
close to the line, which means that the distribution is close to normal.
In contrast, the points for ageYear
veer far away from the line, especially on the left, indicating that the
distribution is skewed. A histogram may also be useful for exploring how
the data is distributed.