ReIns (version 1.0.10)

tExp: The truncated exponential distribution

Description

Density, distribution function, quantile function and random generation for the truncated exponential distribution.

Usage

dtexp(x, rate = 1, endpoint = Inf, log = FALSE)
ptexp(x, rate = 1, endpoint = Inf, lower.tail = TRUE, log.p = FALSE)
qtexp(p, rate = 1, endpoint = Inf, lower.tail = TRUE, log.p = FALSE)
rtexp(n, rate = 1, endpoint = Inf)

Value

dtexp gives the density function evaluated in \(x\), ptexp the CDF evaluated in \(x\) and qtexp the quantile function evaluated in \(p\). The length of the result is equal to the length of \(x\) or \(p\).

rtexp returns a random sample of length \(n\).

Arguments

x

Vector of quantiles.

p

Vector of probabilities.

n

Number of observations.

rate

The rate parameter for the exponential distribution, default is 1.

endpoint

Endpoint of the truncated exponential distribution. The default value is Inf for which the truncated exponential distribution corresponds to the ordinary exponential distribution.

log

Logical indicating if the densities are given as \(\log(f)\), default is FALSE.

lower.tail

Logical indicating if the probabilities are of the form \(P(X\le x)\) (TRUE) or \(P(X>x)\) (FALSE). Default is TRUE.

log.p

Logical indicating if the probabilities are given as \(\log(p)\), default is FALSE.

Author

Tom Reynkens.

Details

The Cumulative Distribution Function (CDF) of the truncated exponential distribution is equal to \(F_T(x) = F(x) / F(T)\) for \(x \le T\) where \(F\) is the CDF of the ordinary exponential distribution and \(T\) is the endpoint (truncation point) of the truncated exponential distribution.

See Also

Examples

Run this code
# Plot of the PDF
x <- seq(0, 10, 0.01)
plot(x, dtexp(x, rate = 2, endpoint=5), xlab="x", ylab="PDF", type="l")

# Plot of the CDF
x <- seq(0, 10, 0.01)
plot(x, ptexp(x, rate = 2, endpoint=5), xlab="x", ylab="CDF", type="l")

Run the code above in your browser using DataLab