Density, distribution function, quantile function and random generation for the inverse exponential distribution.
Usage
dinvexp(x, rate = 1, log = FALSE)
pinvexp(q, rate = 1, lower.tail = TRUE, log.p = FALSE)
qinvexp(p, rate = 1, lower.tail = TRUE, log.p = FALSE)
rinvexp(n, rate = 1)
Arguments
- x, q
vector of quantiles.
- rate
degrees of freedom (non-negative, but can be non-integer).
- log, log.p
logical; if TRUE, probabilities p are given as log(p).
- lower.tail
logical; if
TRUE
(default), probabilities are \(P[X \leq x]\); ifFALSE
\(P[X > x]\).- p
vector of probabilities.
- n
number of observations. If length(n) > 1, the length is taken to be the number required.
Details
The functions (d/p/q/r)invexp()
simply wrap those of the standard
(d/p/q/r)exp()
R implementation, so look at, say, stats::dexp()
for
details.
See also
stats::dexp()
; these functions just wrap the (d/p/q/r)exp()
functions.
Examples
s <- seq(0, 10, .01)
plot(s, dinvexp(s, 2), type = 'l')
f <- function(x) dinvexp(x, 2)
q <- 3
integrate(f, 0, q)
#> 0.5134171 with absolute error < 6.7e-06
(p <- pinvexp(q, 2))
#> [1] 0.5134171
qinvexp(p, 2) # = q
#> [1] 3
mean(rinvexp(1e5, 2) <= q)
#> [1] 0.51292
pinvgamma(q, 1, 2)
#> [1] 0.5134171