Q-Q Plot Using a Theoretical or Empirical Distribution

USAGE:
qqmath(formula, distribution = qnorm, f.value = ppoints, ...)

The following arguments have special meaning within this function. The common meanings for these and all other arguments are listed separately under trellis.args.

formula:
a formula in the form ~ x | g1 * g2 * ... however the given variables g1, g2, ... may be omitted. x is a numeric vector.
distribution:
a quantile function that takes a vector of probabilities as an argument and computes corresponding theoretical or empirical quantiles of the reference distribution. Possible values include, qnorm, qunif, or your own function (see the examples).
f.value:
function of a single integer, representing a sample size, that produces a vector of probabilities corresponding to which observations should be plotted. This function can be used to cut down on the number of points plotted, for example, function(n) c(.01, .05, seq(.1,.9,.1), .95, .99)

VALUE:
an object of class trellis, which is automatically plotted by print.trellis.

SEE ALSO:
panel.qqmath , prepanel.qqmathline , panel.qqmathline , trellis.args .

EXAMPLES:
# how well is a normal sample fit by a t distn on 7df?
qqmath( ~ rnorm(100), distribution = function(p) qt(p,df=7))

qqmath( ~ height | voice.part, data = singer, prepanel = prepanel.qqmathline, panel = function(x, y) { panel.grid() panel.qqmathline(y, distribution = qnorm) panel.qqmath(x, y) }, layout = c(2, 4), aspect = 1, xlab = "Unit Normal Quantile", ylab = "Height (inches)")

# residuals for each voice part plotted against distn of pooled residuals attach(singer) oneway.residuals <- oneway(height ~ voice.part, spread = 1)$residuals qqmath( ~ oneway.residuals | voice.part, distribution = function(p) quantile(oneway.residuals,p), panel = function(x, y) { panel.grid() panel.abline(0, 1) panel.qqmath(x, y) }, aspect = 1, layout = c(2, 4), xlab = "Pooled Residual Height (inches)", ylab = "Residual Height (inches)")