exp function

The Exponential distribution

The Exponential distribution

Raw moments for the exponential distribution.

mexp(r = 0, truncation = 0, rate = 1, lower.tail = TRUE)

Arguments

  • r: rth raw moment of the distribution, defaults to 1.
  • truncation: lower truncation parameter, defaults to 0.
  • rate: rate of the distribution with default values of 1.
  • lower.tail: logical; if TRUE (default), moments are E[xrXy]E[x^r|X \le y], otherwise, E[xrX>y]E[x^r|X > y]

Returns

Returns the truncated rth raw moment of the distribution.

Details

Probability and Cumulative Distribution Function:

f(x)=1seωs,FX(x)=1eωs f(x) = \frac{1}{s}e^{-\frac{\omega}{s}} , \qquad F_X(x) = 1-e^{-\frac{\omega}{s}}

The y-bounded r-th raw moment of the distribution equals:

sσs1Γ(σs+1,ys) s^{\sigma_s - 1} \Gamma\left(\sigma_s +1, \frac{y}{s} \right)

where Γ(,)\Gamma(,) denotes the upper incomplete gamma function.

Examples

## The zeroth truncated moment is equivalent to the probability function pexp(2, rate = 1) mexp(truncation = 2) ## The (truncated) first moment is equivalent to the mean of a (truncated) random sample, #for large enough samples. x <- rexp(1e5, rate = 1) mean(x) mexp(r = 1, lower.tail = FALSE) sum(x[x > quantile(x, 0.1)]) / length(x) mexp(r = 1, truncation = quantile(x, 0.1), lower.tail = FALSE)
  • Maintainer: Ruben Dewitte
  • License: GPL-3
  • Last published: 2020-05-25

Useful links