EVOLUTION-MANAGER
Edit File: Uniform.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: The Uniform 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 Uniform {stats}"><tr><td>Uniform {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>The Uniform Distribution</h2> <h3>Description</h3> <p>These functions provide information about the uniform distribution on the interval from <code>min</code> to <code>max</code>. <code>dunif</code> gives the density, <code>punif</code> gives the distribution function <code>qunif</code> gives the quantile function and <code>runif</code> generates random deviates. </p> <h3>Usage</h3> <pre> dunif(x, min = 0, max = 1, log = FALSE) punif(q, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE) qunif(p, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE) runif(n, min = 0, max = 1) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, q</code></td> <td> <p>vector of quantiles.</p> </td></tr> <tr valign="top"><td><code>p</code></td> <td> <p>vector of probabilities.</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>number of observations. If <code>length(n) > 1</code>, the length is taken to be the number required.</p> </td></tr> <tr valign="top"><td><code>min, max</code></td> <td> <p>lower and upper limits of the distribution. Must be finite.</p> </td></tr> <tr valign="top"><td><code>log, log.p</code></td> <td> <p>logical; if TRUE, probabilities p are given as log(p).</p> </td></tr> <tr valign="top"><td><code>lower.tail</code></td> <td> <p>logical; if TRUE (default), probabilities are <i>P[X ≤ x]</i>, otherwise, <i>P[X > x]</i>.</p> </td></tr> </table> <h3>Details</h3> <p>If <code>min</code> or <code>max</code> are not specified they assume the default values of <code>0</code> and <code>1</code> respectively. </p> <p>The uniform distribution has density </p> <p style="text-align: center;"><i>f(x) = 1/(max-min)</i></p> <p>for <i>min ≤ x ≤ max</i>. </p> <p>For the case of <i>u := min == max</i>, the limit case of <i>X == u</i> is assumed, although there is no density in that case and <code>dunif</code> will return <code>NaN</code> (the error condition). </p> <p><code>runif</code> will not generate either of the extreme values unless <code>max = min</code> or <code>max-min</code> is small compared to <code>min</code>, and in particular not for the default arguments. </p> <h3>Value</h3> <p><code>dunif</code> gives the density, <code>punif</code> gives the distribution function, <code>qunif</code> gives the quantile function, and <code>runif</code> generates random deviates. </p> <p>The length of the result is determined by <code>n</code> for <code>runif</code>, and is the maximum of the lengths of the numerical arguments for the other functions. </p> <p>The numerical arguments other than <code>n</code> are recycled to the length of the result. Only the first elements of the logical arguments are used. </p> <h3>Note</h3> <p>The characteristics of output from pseudo-random number generators (such as precision and periodicity) vary widely. See <code><a href="../../base/html/Random.html">.Random.seed</a></code> for more information on <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>'s random number generation algorithms. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="../../base/html/Random.html">RNG</a></code> about random number generation in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>. </p> <p><a href="Distributions.html">Distributions</a> for other standard distributions. </p> <h3>Examples</h3> <pre> u <- runif(20) ## The following relations always hold : punif(u) == u dunif(u) == 1 var(runif(10000)) #- ~ = 1/12 = .08333 </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>