Graphics Reference
In-Depth Information
See Setting the Range of a Continuous Axis for more information about zooming in on part of a
graph.
Creating a QQ Plot
Problem
You want to make a quantile-quantile (QQ) plot to compare an empirical distribution to a theor-
etical distribution.
Solution
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 height
qqnorm(heightweight$heightIn)
qqline(heightweight$heightIn)
# QQ plot of age
qqnorm(heightweight$ageYear)
qqline(heightweight$ageYear)
Search WWH ::




Custom Search