Learn R Programming

Distributacalcul (version 0.4.0)

Gamma: Gamma Distribution

Description

Gamma distribution with shape parameter \(\alpha\) and rate parameter \(\beta\).

Usage

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

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

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

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

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

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

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

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

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

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

Value

Function :

  • expValGamma gives the expected value.

  • varGamma gives the variance.

  • kthMomentGamma gives the kth moment.

  • expValLimGamma gives the limited mean.

  • expValTruncGamma gives the truncated mean.

  • stopLossGamma gives the stop-loss.

  • meanExcessGamma gives the mean excess loss.

  • VatRGamma gives the Value-at-Risk.

  • TVatRGamma gives the Tail Value-at-Risk.

  • mgfGamma gives the moment generating function (MGF).

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

Arguments

shape

shape parameter \(\alpha\), must be positive.

rate

rate parameter \(\beta\), must be positive.

scale

alternative parameterization to the rate parameter, scale = 1 / rate.

k

kth-moment.

d

cut-off value.

less.than.d

logical; if TRUE (default) truncated mean for values <= d, otherwise, for values > d.

kap

probability.

t

t.

Details

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

Examples

Run this code

# With scale parameter
expValGamma(shape = 3, scale = 4)

# With rate parameter
expValGamma(shape = 3, rate = 0.25)


# With scale parameter
varGamma(shape = 3, scale = 4)

# With rate parameter
varGamma(shape = 3, rate = 0.25)


# With scale parameter
kthMomentGamma(k = 2, shape = 3, scale = 4)

# With rate parameter
kthMomentGamma(k = 2, shape = 3, rate = 0.25)


# With scale parameter
expValLimGamma(d = 2, shape = 3, scale = 4)

# With rate parameter
expValLimGamma(d = 2, shape = 3, rate = 0.25)


# With scale parameter
expValTruncGamma(d = 2, shape = 3, scale = 4)

# With rate parameter
expValTruncGamma(d = 2, shape = 3, rate = 0.25)

# values greather than d
expValTruncGamma(d = 2, shape = 3, rate = 0.25, less.than.d = FALSE)


# With scale parameter
stopLossGamma(d = 2, shape = 3, scale = 4)

# With rate parameter
stopLossGamma(d = 2, shape = 3, rate = 0.25)


# With scale parameter
meanExcessGamma(d = 2, shape = 3, scale = 4)

# With rate parameter
meanExcessGamma(d = 2, shape = 3, rate = 0.25)


# With scale parameter
VatRGamma(kap = .2, shape = 3, scale = 4)

# With rate parameter
VatRGamma(kap = .2, shape = 3, rate = 0.25)


# With scale parameter
TVatRGamma(kap = .2, shape = 3, scale = 4)

# With rate parameter
TVatRGamma(kap = .2, shape = 3, rate = 0.25)


mgfGamma(t = 1, shape = 3, rate = 5)

Run the code above in your browser using DataLab