Erlang distribution with shape parameter $$n$$ and rate parameter $$\beta$$.

dErlang(x, shape, rate = 1/scale, scale = 1/rate)

pErlang(q, shape, rate = 1/scale, scale = 1/rate, lower.tail = TRUE)

expValErlang(shape, rate = 1/scale, scale = 1/rate)

varErlang(shape, rate = 1/scale, scale = 1/rate)

kthMomentErlang(k, shape, rate = 1/scale, scale = 1/rate)

expValLimErlang(d, shape, rate = 1/scale, scale = 1/rate)

expValTruncErlang(d, shape, rate = 1/scale, scale = 1/rate, less.than.d = TRUE)

stopLossErlang(d, shape, rate = 1/scale, scale = 1/rate)

meanExcessErlang(d, shape, rate = 1/scale, scale = 1/rate)

VatRErlang(kap, shape, rate = 1/scale, scale = 1/rate)

TVatRErlang(kap, shape, rate = 1/scale, scale = 1/rate)

mgfErlang(t, shape, rate = 1/scale, scale = 1/rate)

## Arguments

x vector of quantiles. shape parameter $$n$$, must be a positive integer. rate parameter $$\beta$$, must be positive. alternative parameterization to the rate parameter, scale = 1 / rate. vector of quantiles. logical; if TRUE (default), probabilities are $$P[X \le x]$$, otherwise, $$P[X > x]$$. kth-moment. cut-off value. logical; if TRUE (default) truncated mean for values <= d, otherwise, for values > d. probability. t.

## Value

Function :

• dErlang gives the probability density function (PDF).

• pErlang gives the cumulative density function (CDF).

• expValErlang gives the expected value.

• varErlang gives the variance.

• kthMomentErlang gives the kth moment.

• expValLimErlang gives the limited mean.

• expValTruncErlang gives the truncated mean.

• stopLossErlang gives the stop-loss.

• meanExcessErlang gives the mean excess loss.

• VatRErlang gives the Value-at-Risk.

• TVatRErlang gives the Tail Value-at-Risk.

• mgfErlang gives the moment generating function (MGF).

Invalid parameter values will return an error detailing which parameter is problematic.

## Details

The Erlang distribution with shape parameter $$n$$ and rate parameter $$\beta$$ has density: $$f\left(x\right) = \frac{\beta^{n}}{\Gamma(n)} x^{n - 1}% \mathrm{e}^{-\beta x}$$ for $$x \in \mathcal{R}^+$$, $$\beta > 0$$, $$n \in \mathcal{N}^+$$.

## Note

Function VatRErlang is a wrapper of the qgamma function from the stats package.

## Examples

dErlang(x = 2, shape = 2, scale = 4)#> [1] 0.07581633
pErlang(q = 2, shape = 2, scale = 4)#> [1] 0.09020401
expValErlang(shape = 2, scale = 4)#> [1] 8
varErlang(shape = 2, scale = 4)#> [1] 32
kthMomentErlang(k = 3, shape = 2, scale = 4)#> [1] 1536
expValLimErlang(d = 2, shape = 2, scale = 4)#> [1] 1.934693
# With rate parameter
expValTruncErlang(d = 2, shape = 2, scale = 4)#> [1] 0.1151014
# Values greater than d
expValTruncErlang(d = 2, shape = 2, scale = 4, less.than.d = FALSE)#> [1] 7.884899
stopLossErlang(d = 2, shape = 2, scale = 4)#> [1] 6.065307
meanExcessErlang(d = 3, shape = 2, scale = 4)#> [1] 6.285714
# With scale parameter
VatRErlang(kap = .2, shape = 2, scale = 4)#> [1] 3.297553
# With rate parameter
VatRErlang(kap = .2, shape = 2, rate = 0.25)#> [1] 3.297553
# With scale parameter
TVatRErlang(kap = .2, shape = 3, scale = 4)#> [1] 13.94824
# With rate parameter
TVatRErlang(kap = .2, shape = 3, rate = 0.25)#> [1] 13.94824
mgfErlang(t = 2, shape = 2, scale = .25)#> [1] 4