Skip to contents

These functions implement a custom distribution combining a trapezoidal section (0 < x < a) and an exponential tail (\(x \geq a\)). The distribution is parameterized by:

  • a: transition point between trapezoid and exponential

  • ell: rate parameter for the exponential tail

Usage

dtzexp(x, a, ell)

ptzexp(q, a, ell)

qtzexp(p, a, ell)

rtzexp(n, a, ell)

Arguments

x, q

vector of quantiles

a

location parameter for transition (must be > 0)

ell

rate parameter for exponential decay (must be > 0)

p

vector of probabilities

n

number of observations

Value

  • dtzexp gives the density

  • ptzexp gives the distribution function

  • qtzexp gives the quantile function

  • rtzexp generates random deviates

Details

Density, distribution function, quantile function and random generation for a custom trapezoid + exponential distribution.

The trapezoid+exponential distribution has the probability density function:

$$ f(x) = \begin{cases} 0 & \text{if } x \leq 0 \\ \frac{(p\ell - c)}{a} x + c & \text{if } 0 < x < a \\ p\ell e^{-\ell (x - a)} & \text{if } x \geq a \end{cases} $$

where: $$ p = \frac{\ell - \frac{a\ell}{3}}{\frac{a^2\ell^2}{6} + \frac{2a\ell}{3} + 1} $$ $$ c = \frac{2 - 2p - p\ell a}{a} $$

The trapezoid+exponential distribution has the following characteristics:

  • Support on \([0, \infty)\)

  • Continuous probability distribution

  • Linear density from 0 to a

  • Exponential decay for x > a