qqmath(x, data, ...)
## S3 method for class 'formula':
qqmath(x,
data,
allow.multiple = is.null(groups) || outer,
outer = !is.null(groups),
distribution = qnorm,
f.value = NULL,
auto.key = FALSE,
aspect = "fill",
panel = lattice.getOption("panel.qqmath"),
prepanel = NULL,
scales, strip, groups,
xlab, xlim, ylab, ylim,
drop.unused.levels = lattice.getOption("drop.unused.levels"),
...,
lattice.options = NULL,
default.scales = list(),
subscripts,
subset)
## S3 method for class 'numeric':
qqmath(x, data = NULL, ylab, \dots)
For the "formula"
method, a formula of the form ~ x |
g1 * g2 * ...
, where x
must be a numeric. For the
"numeric"
method, a numeric vec
formula
method, an optional data frame in which
variables in the formula (as well as groups
and
subset
, if any) are to be evaluated. Usualll ignored with a
warning in other methods.qnorm
, qunif
etc.
Distributions with other required arguments need to be passed in as
panel.qqmath
for details.xyplot
xyplot
for non-trivial details.qqmath
produces a Q-Q plot of the given sample and a
theoretical distribution. The default behaviour of qqmath
is
different from the corresponding S-PLUS function, but is similar to
qqnorm
. See the entry for f.value
for specifics. The implementation details are also different from S-PLUS. In
particular, all the important calculations are done by the panel (and
prepanel function) and not qqmath
itself. In fact, both the
arguments distribution
and f.value
are passed unchanged
to the panel and prepanel function. This allows, among other things,
display of grouped Q-Q plots, which are often useful. See the help
page for panel.qqmath
for further details.
This and all other high level Trellis functions have several
arguments in common. These are extensively documented only in the
help page for xyplot
, which should be consulted to learn more
detailed usage.
xyplot
, panel.qqmath
,
panel.qqmathline
, prepanel.qqmathline
,
Lattice
, quantile
qqmath(~ rnorm(100), distribution = function(p) qt(p, df = 10))
qqmath(~ height | voice.part, aspect = "xy", data = singer,
prepanel = prepanel.qqmathline,
panel = function(x, ...) {
panel.qqmathline(x, ...)
panel.qqmath(x, ...)
})
vp.comb <-
factor(sapply(strsplit(as.character(singer$voice.part), split = ""),
"[", 1),
levels = c("Bass", "Tenor", "Alto", "Soprano"))
vp.group <-
factor(sapply(strsplit(as.character(singer$voice.part), split = ""),
"[", 2))
qqmath(~ height | vp.comb, data = singer,
groups = vp.group, auto.key = list(space = "right"),
aspect = "xy",
prepanel = prepanel.qqmathline,
panel = function(x, ...) {
panel.qqmathline(x, ...)
panel.qqmath(x, ...)
})
Run the code above in your browser using DataLab