EVOLUTION-MANAGER
Edit File: qqmath.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Q-Q Plot with Theoretical Distribution</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for B_04_qqmath {lattice}"><tr><td>B_04_qqmath {lattice}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Q-Q Plot with Theoretical Distribution</h2> <h3>Description</h3> <p>Draw quantile-Quantile plots of a sample against a theoretical distribution, possibly conditioned on other variables. </p> <h3>Usage</h3> <pre> 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(), default.prepanel = lattice.getOption("prepanel.default.qqmath"), subscripts, subset) ## S3 method for class 'numeric' qqmath(x, data = NULL, ylab, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>The object on which method dispatch is carried out. </p> <p>For the <code>"formula"</code> method, <code>x</code> should be a formula of the form <code>~ x | g1 * g2 * ...</code>, where <code>x</code> should be a numeric variable. For the <code>"numeric"</code> method, <code>x</code> should be a numeric vector. </p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>For the <code>formula</code> method, an optional data source (usually a data frame) in which variables are to be evaluated (see <code><a href="xyplot.html">xyplot</a></code> for details). <code>data</code> should not be specified for the other methods, and is ignored with a warning if it is. </p> </td></tr> <tr valign="top"><td><code>distribution</code></td> <td> <p>A quantile function that takes a vector of probabilities as argument and produces the corresponding quantiles from a theoretical distribution. Possible values are <code><a href="../../stats/html/Normal.html">qnorm</a></code>, <code><a href="../../stats/html/Uniform.html">qunif</a></code>, etc. Distributions with other required arguments need to be provided as user-defined functions (see example with <code><a href="../../stats/html/TDist.html">qt</a></code>). </p> </td></tr> <tr valign="top"><td><code>f.value</code></td> <td> <p>An optional numeric vector of probabilities, quantiles corresponding to which should be plotted. This can also be a function of a single integer (representing sample size) that returns such a numeric vector. A typical value for this argument is the function <code>ppoints</code>, which is also the S-PLUS default. If specified, the probabilities generated by this function is used for the plotted quantiles, through the <code><a href="../../stats/html/quantile.html">quantile</a></code> function for the sample, and the function specified as the <code>distribution</code> argument for the theoretical distribution. </p> <p><code>f.value</code> defaults to <code>NULL</code>, which has the effect of using <code>ppoints</code> for the quantiles of the theoretical distribution, but the exact data values for the sample. This is similar to what happens for <code>qqnorm</code>, but different from the S-PLUS default of <code>f.value=ppoints</code>. </p> <p>For large <code>x</code>, this argument can be used to restrict the number of points plotted. See also the <code>tails.n</code> argument in <code><a href="panel.qqmath.html">panel.qqmath</a></code>. </p> </td></tr> <tr valign="top"><td><code>panel</code></td> <td> <p>A function, called once for each panel, that uses the packet (subset of panel variables) corresponding to the panel to create a display. The default panel function <code><a href="panel.qqmath.html">panel.qqmath</a></code> is documented separately, and has arguments that can be used to customize its output in various ways. Such arguments can usually be directly supplied to the high-level function. </p> </td></tr> <tr valign="top"><td><code>allow.multiple, outer</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>auto.key</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>aspect</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>prepanel</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>scales</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>strip</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>groups</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>xlab, ylab</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>xlim, ylim</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>drop.unused.levels</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>lattice.options</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>default.scales</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>subscripts</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>subset</code></td> <td> <p> See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>default.prepanel</code></td> <td> <p>Fallback prepanel function. See <code><a href="xyplot.html">xyplot</a></code>. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Further arguments. See corresponding entry in <code><a href="xyplot.html">xyplot</a></code> for non-trivial details. </p> </td></tr> </table> <h3>Details</h3> <p><code>qqmath</code> produces Q-Q plots of the given sample against a theoretical distribution. The default behaviour of <code>qqmath</code> is different from the corresponding S-PLUS function, but is similar to <code>qqnorm</code>. See the entry for <code>f.value</code> for specifics. </p> <p>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 <code>qqmath</code> itself. In fact, both the arguments <code>distribution</code> and <code>f.value</code> 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 <code><a href="panel.qqmath.html">panel.qqmath</a></code> for further details. </p> <p>This and all other high level Trellis functions have several arguments in common. These are extensively documented only in the help page for <code><a href="xyplot.html">xyplot</a></code>, which should be consulted to learn more detailed usage. </p> <h3>Value</h3> <p>An object of class <code>"trellis"</code>. The <code><a href="update.trellis.html">update</a></code> method can be used to update components of the object and the <code><a href="print.trellis.html">print</a></code> method (usually called by default) will plot it on an appropriate plotting device. </p> <h3>Author(s)</h3> <p>Deepayan Sarkar <a href="mailto:Deepayan.Sarkar@R-project.org">Deepayan.Sarkar@R-project.org</a></p> <h3>See Also</h3> <p><code><a href="xyplot.html">xyplot</a></code>, <code><a href="panel.qqmath.html">panel.qqmath</a></code>, <code><a href="panel.qqmathline.html">panel.qqmathline</a></code>, <code><a href="prepanel.functions.html">prepanel.qqmathline</a></code>, <code><a href="Lattice.html">Lattice</a></code>, <code><a href="../../stats/html/quantile.html">quantile</a></code> </p> <h3>Examples</h3> <pre> 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, ...) }) </pre> <hr /><div style="text-align: center;">[Package <em>lattice</em> version 0.20-38 <a href="00Index.html">Index</a>]</div> </body></html>