EVOLUTION-MANAGER
Edit File: Exponential.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 Exponential 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 Exponential {stats}"><tr><td>Exponential {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>The Exponential Distribution</h2> <h3>Description</h3> <p>Density, distribution function, quantile function and random generation for the exponential distribution with rate <code>rate</code> (i.e., mean <code>1/rate</code>). </p> <h3>Usage</h3> <pre> dexp(x, rate = 1, log = FALSE) pexp(q, rate = 1, lower.tail = TRUE, log.p = FALSE) qexp(p, rate = 1, lower.tail = TRUE, log.p = FALSE) rexp(n, rate = 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>rate</code></td> <td> <p>vector of rates.</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>rate</code> is not specified, it assumes the default value of <code>1</code>. </p> <p>The exponential distribution with rate <i>λ</i> has density </p> <p style="text-align: center;"><i>f(x) = λ {e}^{- λ x}</i></p> <p> for <i>x ≥ 0</i>. </p> <h3>Value</h3> <p><code>dexp</code> gives the density, <code>pexp</code> gives the distribution function, <code>qexp</code> gives the quantile function, and <code>rexp</code> generates random deviates. </p> <p>The length of the result is determined by <code>n</code> for <code>rexp</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 cumulative hazard <i>H(t) = - log(1 - F(t))</i> is <code>-pexp(t, r, lower = FALSE, log = TRUE)</code>. </p> <h3>Source</h3> <p><code>dexp</code>, <code>pexp</code> and <code>qexp</code> are all calculated from numerically stable versions of the definitions. </p> <p><code>rexp</code> uses </p> <p>Ahrens, J. H. and Dieter, U. (1972). Computer methods for sampling from the exponential and normal distributions. <em>Communications of the ACM</em>, <b>15</b>, 873–882. </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> <p>Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995) <em>Continuous Univariate Distributions</em>, volume 1, chapter 19. Wiley, New York. </p> <h3>See Also</h3> <p><code><a href="../../base/html/Log.html">exp</a></code> for the exponential function. </p> <p><a href="Distributions.html">Distributions</a> for other standard distributions, including <code><a href="GammaDist.html">dgamma</a></code> for the gamma distribution and <code><a href="Weibull.html">dweibull</a></code> for the Weibull distribution, both of which generalize the exponential. </p> <h3>Examples</h3> <pre> dexp(1) - exp(-1) #-> 0 ## a fast way to generate *sorted* U[0,1] random numbers: rsunif <- function(n) { n1 <- n+1 cE <- cumsum(rexp(n1)); cE[seq_len(n)]/cE[n1] } plot(rsunif(1000), ylim=0:1, pch=".") abline(0,1/(1000+1), col=adjustcolor(1, 0.5)) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>