EVOLUTION-MANAGER
Edit File: jitter.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: 'Jitter' (Add Noise) to Numbers</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 jitter {base}"><tr><td>jitter {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>‘Jitter’ (Add Noise) to Numbers</h2> <h3>Description</h3> <p>Add a small amount of noise to a numeric vector. </p> <h3>Usage</h3> <pre> jitter(x, factor = 1, amount = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>numeric vector to which <em>jitter</em> should be added.</p> </td></tr> <tr valign="top"><td><code>factor</code></td> <td> <p>numeric.</p> </td></tr> <tr valign="top"><td><code>amount</code></td> <td> <p>numeric; if positive, used as <em>amount</em> (see below), otherwise, if <code>= 0</code> the default is <code>factor * z/50</code>. </p> <p>Default (<code>NULL</code>): <code>factor * d/5</code> where <code>d</code> is about the smallest difference between <code>x</code> values.</p> </td></tr> </table> <h3>Details</h3> <p>The result, say <code>r</code>, is <code>r <- x + runif(n, -a, a)</code> where <code>n <- length(x)</code> and <code>a</code> is the <code>amount</code> argument (if specified). </p> <p>Let <code>z <- max(x) - min(x)</code> (assuming the usual case). The amount <code>a</code> to be added is either provided as <em>positive</em> argument <code>amount</code> or otherwise computed from <code>z</code>, as follows: </p> <p>If <code>amount == 0</code>, we set <code>a <- factor * z/50</code> (same as S). </p> <p>If <code>amount</code> is <code>NULL</code> (<em>default</em>), we set <code>a <- factor * d/5</code> where <em>d</em> is the smallest difference between adjacent unique (apart from fuzz) <code>x</code> values. </p> <h3>Value</h3> <p><code>jitter(x, ...)</code> returns a numeric of the same length as <code>x</code>, but with an <code>amount</code> of noise added in order to break ties. </p> <h3>Author(s)</h3> <p>Werner Stahel and Martin Maechler, ETH Zurich</p> <h3>References</h3> <p>Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P.A. (1983) <em>Graphical Methods for Data Analysis.</em> Wadsworth; figures 2.8, 4.22, 5.4. </p> <p>Chambers, J. M. and Hastie, T. J. (1992) <em>Statistical Models in S.</em> Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="../../graphics/html/rug.html">rug</a></code> which you may want to combine with <code>jitter</code>. </p> <h3>Examples</h3> <pre> round(jitter(c(rep(1, 3), rep(1.2, 4), rep(3, 3))), 3) ## These two 'fail' with S-plus 3.x: jitter(rep(0, 7)) jitter(rep(10000, 5)) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>