Learn R Programming

invgamma (version 1.2)

invexp: The Inverse Exponential Distribution

Description

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]\); if FALSE \(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

Run this code

s <- seq(0, 10, .01)
plot(s, dinvexp(s, 2), type = 'l')

f <- function(x) dinvexp(x, 2)
q <- 3
integrate(f, 0, q)
(p <- pinvexp(q, 2))
qinvexp(p, 2) # = q
mean(rinvexp(1e5, 2) <= q)

pinvgamma(q, 1, 2)



Run the code above in your browser using DataLab