| Type: | Package |
| Title: | Probability Distribution Functions |
| Version: | 0.4.0 |
| Date: | 2024-01-08 |
| Description: | Calculates expected values, variance, different moments (kth moment, truncated mean), stop-loss, mean excess loss, Value-at-Risk (VaR) and Tail Value-at-Risk (TVaR) as well as some density and cumulative (survival) functions of continuous, discrete and compound distributions. This package also includes a visual 'Shiny' component to enable students to visualize distributions and understand the impact of their parameters. This package is intended to expand the 'stats' package so as to enable students to develop an intuition for probability. |
| License: | MIT + file LICENSE |
| URL: | https://alec42.github.io/Distributacalcul_Package/ |
| BugReports: | https://github.com/alec42/Distributacalcul_Package/issues |
| Encoding: | UTF-8 |
| Imports: | statmod, stats, dplyr, rlang |
| RoxygenNote: | 7.2.3 |
| Suggests: | learnr, knitr, rmarkdown, spelling, testthat |
| Language: | en-CA |
| NeedsCompilation: | no |
| Packaged: | 2024-01-09 14:54:53 UTC; alecjvanrassel |
| Author: | Alec James van Rassel [aut, cre, cph], Gabriel Crépeault-Cauchon [aut, ccp], Étienne Marceau [tch, sad], Hélène Cossette [tch, sad], Laboratoire Act & Risk [fnd, sht], École d'actuariat de l'Université Laval [fnd, his, uvp], Natural Sciences and Engineering Research Council of Canada [fnd], Marc-André Devost [ccp] |
| Maintainer: | Alec James van Rassel <alec.van-rassel.1@ulaval.ca> |
| Repository: | CRAN |
| Date/Publication: | 2024-01-10 14:03:16 UTC |
Distributacalcul: Probability Distribution Functions
Description
The Distributacalcul provides three general types of functions :
Functions related to continuous, discrete, and compound probability distributions.
Functions related to bivariate copulas.
Shiny applications for visualising these distributions and copulas.
Probability Distribution Functions
These include functions for calculating various moments, risk measures, and distribution functions.
Copula Functions
These include functions for calculating distribution functions and simulating observations from the copulas.
Author(s)
Maintainer: Alec James van Rassel alec.van-rassel.1@ulaval.ca [copyright holder]
Authors:
Gabriel Crépeault-Cauchon [conceptor]
Other contributors:
Étienne Marceau [teacher, scientific advisor]
Hélène Cossette [teacher, scientific advisor]
Laboratoire Act & Risk [funder, supporting host]
École d'actuariat de l'Université Laval [funder, host institution, university place]
Natural Sciences and Engineering Research Council of Canada [funder]
Marc-André Devost [conceptor]
See Also
Useful links:
Report bugs at https://github.com/alec42/Distributacalcul_Package/issues
Beta Distribution
Description
Beta distribution with shape parameters \alpha and \beta.
Usage
expValBeta(shape1, shape2)
varBeta(shape1, shape2)
kthMomentBeta(k, shape1, shape2)
expValLimBeta(d, shape1, shape2)
expValTruncBeta(d, shape1, shape2, less.than.d = TRUE)
stopLossBeta(d, shape1, shape2)
meanExcessBeta(d, shape1, shape2)
VatRBeta(kap, shape1, shape2)
TVatRBeta(kap, shape1, shape2)
mgfBeta(t, shape1, shape2, k0)
Arguments
shape1 |
shape parameter |
shape2 |
shape parameter |
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
k0 |
point up to which to sum the distribution for the approximation. |
Details
The Beta distribution with shape parameters \alpha and
\beta has density:
f\left(x\right) = \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) %
\Gamma(\beta)} x^{\alpha - 1} (1 - x)^(\beta - 1)
for x \in [0, 1], \alpha, \beta > 0.
Value
Function :
-
expValBetagives the expected value. -
varBetagives the variance. -
kthMomentBetagives the kth moment. -
expValLimBetagives the limited mean. -
expValTruncBetagives the truncated mean. -
stopLossBetagives the stop-loss. -
meanExcessBetagives the mean excess loss. -
VatRBetagives the Value-at-Risk. -
TVatRBetagives the Tail Value-at-Risk. -
mgfBetagives the moment generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRBeta is a wrapper for the qbeta
function from the stats package.
Examples
expValBeta(shape1 = 3, shape2 = 5)
varBeta(shape1 = 4, shape2 = 5)
kthMomentBeta(k = 3, shape1 = 4, shape2 = 5)
expValLimBeta(d = 0.3, shape1 = 4, shape2 = 5)
expValTruncBeta(d = 0.4, shape1 = 4, shape2 = 5)
# Values less than d
expValTruncBeta(d = 0.4, shape1 = 4, shape2 = 5, less.than.d = FALSE)
stopLossBeta(d = 0.3, shape1 = 4, shape2 = 5)
meanExcessBeta(d = .3, shape1 = 4, shape2 = 5)
VatRBeta(kap = .99, shape1 = 4, shape2 = 5)
TVatRBeta(kap = .99, shape1 = 4, shape2 = 5)
mgfBeta(t = 1, shape1 = 3, shape2 = 5, k0 = 1E2)
Compound Binomial Distribution
Description
Computes various risk measures (mean, variance, Value-at-Risk (VaR), and Tail Value-at-Risk (TVaR)) for the compound Binomial distribution.
Usage
pCompBinom(
x,
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
expValCompBinom(
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
distr_severity = "Gamma"
)
varCompBinom(
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
distr_severity = "Gamma"
)
VatRCompBinom(
kap,
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
TVatRCompBinom(
kap,
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
vark,
k0,
distr_severity = "Gamma"
)
Arguments
x |
vector of quantiles |
size |
Number of trials (0 or more). |
prob |
Probability of success in each trial. |
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
k0 |
point up to which to sum the distribution for the approximation. |
distr_severity |
Choice of severity distribution.
|
kap |
probability. |
vark |
Value-at-Risk (VaR) calculated at the given probability kap. |
Details
The compound binomial distribution has density ....
Value
Function :
-
pCompBinomgives the cumulative density function. -
expValCompBinomgives the expected value. -
varCompBinomgives the variance. -
TVatRCompBinomgives the Tail Value-at-Risk. -
VatRCompBinomgives the Value-at-Risk.
Returned values are approximations for the cumulative density function, TVaR, and VaR.
Examples
pCompBinom(x = 2, size = 1, prob = 0.2, shape = log(1000) - 0.405,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
expValCompBinom(size = 1, prob = 0.2, shape = log(1000) - 0.405, rate = 0.9^2,
distr_severity = "Lognormale")
varCompBinom(size = 1, prob = 0.2, shape = log(1000) - 0.405, rate = 0.9^2,
distr_severity = "Lognormale")
VatRCompBinom(kap = 0.9, size = 1, prob = 0.2, shape = log(1000) - 0.405,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
vark_calc <- VatRCompBinom(kap = 0.9, size = 1, prob = 0.2, shape = 0.59,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
TVatRCompBinom(kap = 0.9, size = 1, prob = 0.2, shape = 0.59, rate = 0.9^2,
vark = vark_calc, k0 = 1E2, distr_severity = "Gamma")
Compound Negative Binomial Distribution
Description
Computes various risk measures (mean, variance, Value-at-Risk (VatR), and Tail Value-at-Risk (TVatR)) for the compound Negative Binomial distribution.
Usage
pCompNBinom(
x,
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
expValCompNBinom(
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
distr_severity = "Gamma"
)
varCompNBinom(
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
distr_severity = "Gamma"
)
VatRCompNBinom(
kap,
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
TVatRCompNBinom(
kap,
vark,
size,
prob,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
Arguments
x |
vector of quantiles |
size |
Number of successful trials. |
prob |
Probability of success in each trial. |
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
k0 |
point up to which to sum the distribution for the approximation. |
distr_severity |
Choice of severity distribution.
|
kap |
probability. |
vark |
Value-at-Risk (VaR) calculated at the given probability kap. |
Details
The compound negative binomial distribution has density ....
Value
Function :
-
pCompNBinomgives the cumulative density function. -
expValCompNBinomgives the expected value. -
varCompNBinomgives the variance. -
TVatRCompNBinomgives the Tail Value-at-Risk. -
VatRCompNBinomgives the Value-at-Risk.
Returned values are approximations for the cumulative density function, TVatR, and VatR.
Examples
pCompNBinom(x = 2, size = 1, prob = 0.2, shape = log(1000) - 0.405,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
expValCompNBinom(size = 4, prob = 0.2, shape = 0, scale = 1,
distr_severity = "Lognormal")
varCompNBinom(size = 1, prob = 0.2, shape = log(1000) - 0.405, rate = 0.9^2,
distr_severity = "Lognormale")
VatRCompNBinom(kap = 0.9, size = 1, prob = 0.2, shape = 0.59,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
vark_calc <- VatRCompNBinom(kap = 0.9, size = 1, prob = 0.2, shape = 0.59,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
TVatRCompNBinom(kap = 0.9, size = 1, prob = 0.2, shape = 0.59, rate = 0.9^2,
vark = vark_calc, k0 = 1E2, distr_severity = "Gamma")
Compound Poisson Distribution
Description
Computes various risk measures (mean, variance, Value-at-Risk (VaR), and Tail Value-at-Risk (TVaR)) for the compound Poisson distribution.
Usage
pCompPois(
x,
lambda,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
expValCompPois(
lambda,
shape,
rate = 1/scale,
scale = 1/rate,
distr_severity = "Gamma"
)
varCompPois(
lambda,
shape,
rate = 1/scale,
scale = 1/rate,
distr_severity = "Gamma"
)
VatRCompPois(
kap,
lambda,
shape,
rate = 1/scale,
scale = 1/rate,
k0,
distr_severity = "Gamma"
)
TVatRCompPois(
kap,
lambda,
shape,
rate = 1/scale,
scale = 1/rate,
vark,
k0,
distr_severity = "Gamma"
)
Arguments
x |
vector of quantiles |
lambda |
Rate parameter |
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
k0 |
point up to which to sum the distribution for the approximation. |
distr_severity |
Choice of severity distribution.
|
kap |
probability. |
vark |
Value-at-Risk (VaR) calculated at the given probability kap. |
Details
The compound Poisson distribution with parameters ... has density ....
Value
Function :
-
pCompPoisgives the cumulative density function. -
expValCompPoisgives the expected value. -
varCompPoisgives the variance. -
TVatRCompPoisgives the Tail Value-at-Risk. -
VatRCompPoisgives the Value-at-Risk.
Returned values are approximations for the cumulative density function, TVaR, and VaR.
Examples
pCompPois(x = 2, lambda = 2, shape = log(1000) - 0.405,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
expValCompPois(lambda = 2, shape = log(1000) - 0.405, rate = 0.9^2,
distr_severity = "Lognormale")
varCompPois(lambda = 2, shape = log(1000) - 0.405, rate = 0.9^2,
distr_severity = "Lognormale")
VatRCompPois(kap = 0.9, lambda = 2, shape = log(1000) - 0.405,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
vark_calc <- VatRCompPois(kap = 0.9, lambda = 2, shape = 0.59,
rate = 0.9^2, k0 = 1E2, distr_severity = "Gamma")
TVatRCompPois(kap = 0.9, lambda = 2, shape = 0.59, rate = 0.9^2,
vark = vark_calc, k0 = 1E2, distr_severity = "Gamma")
Hypergeometric Distribution
Description
Hypergeometric distribution where we have a sample of k balls from an urn containing N, of which m are white and n are black.
Usage
expValErl(N = n + m, m, n = N - m, k)
varErl(N = n + m, m, n = N - m, k)
Arguments
N |
Total number of balls (white and black) in the urn. |
m |
Number of white balls in the urn. |
n |
Number of black balls in the urn. Can specify n instead of N. |
k |
Number of balls drawn from the urn, k = 0, 1, ..., m + n. |
Details
The Hypergeometric distribution for N total items of which
m are of one type and n of the other and from which
k items are picked has probability mass function :
Pr(X = x) = \frac{\left(\frac{m}{k}\right)\left(\frac{n}{k - x}\right)}{\left(\frac{N}{k}\right)}
for x = 0, 1, \dots, \min(k, m).
Value
Function :
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
# With total balls specified
expValErl(N = 5, m = 2, k = 2)
# With number of each colour of balls specified
expValErl(m = 2, n = 3, k = 2)
# With total balls specified
varErl(N = 5, m = 2, k = 2)
# With number of each colour of balls specified
varErl(m = 2, n = 3, k = 2)
Exponential Distribution
Description
Exponential distribution with rate parameter \beta.
Usage
expValExp(rate = 1/scale, scale = 1/rate)
varExp(rate = 1/scale, scale = 1/rate)
kthMomentExp(k, rate = 1/scale, scale = 1/rate)
expValLimExp(d, rate = 1/scale, scale = 1/rate)
expValTruncExp(d, rate = 1/scale, scale = 1/rate, less.than.d = TRUE)
stopLossExp(d, rate = 1/scale, scale = 1/rate)
meanExcessExp(d, rate = 1/scale, scale = 1/rate)
VatRExp(kap, rate = 1/scale, scale = 1/rate)
TVatRExp(kap, rate = 1/scale, scale = 1/rate)
mgfExp(t, rate = 1/scale, scale = 1/rate)
Arguments
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
Details
The Exponential distribution with rate parameter \beta has density:
f\left(x\right) = \frac{1}{\beta}\textrm{e}^{-\beta x}
for x \in \mathcal{R}^+, \beta > 0.
Value
Function :
-
expValExpgives the expected value. -
varExpgives the variance. -
kthMomentExpgives the kth moment. -
expValLimExpgives the limited mean. -
expValTruncExpgives the truncated mean. -
stopLossExpgives the stop-loss. -
meanExcessExpgives the mean excess loss. -
VatRExpgives the Value-at-Risk. -
TVatRExpgives the Tail Value-at-Risk. -
mgfExpgives the moment generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRExp is a wrapper of the qexp
function from the stats package.
Examples
# With scale parameter
expValExp(scale = 4)
# With rate parameter
expValExp(rate = 0.25)
# With scale parameter
varExp(scale = 4)
# With rate parameter
varExp(rate = 0.25)
# With scale parameter
kthMomentExp(k = 2, scale = 4)
# With rate parameter
kthMomentExp(k = 2, rate = 0.25)
# With scale parameter
expValLimExp(d = 2, scale = 4)
# With rate parameter
expValLimExp(d = 2, rate = 0.25)
# With scale parameter
expValTruncExp(d = 2, scale = 4)
# With rate parameter, values greater than d
expValTruncExp(d = 2, rate = 0.25, less.than.d = FALSE)
# With scale parameter
stopLossExp(d = 2, scale = 4)
# With rate parameter
stopLossExp(d = 2, rate = 0.25)
# With scale parameter
meanExcessExp(d = 2, scale = 4)
# With rate parameter
meanExcessExp(d = 5, rate = 0.25)
# With scale parameter
VatRExp(kap = .99, scale = 4)
# With rate parameter
VatRExp(kap = .99, rate = 0.25)
# With scale parameter
TVatRExp(kap = .99, scale = 4)
# With rate parameter
TVatRExp(kap = .99, rate = 0.25)
mgfExp(t = 1, rate = 5)
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)
Arguments
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
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.
Value
Function :
-
expValGammagives the expected value. -
varGammagives the variance. -
kthMomentGammagives the kth moment. -
expValLimGammagives the limited mean. -
expValTruncGammagives the truncated mean. -
stopLossGammagives the stop-loss. -
meanExcessGammagives the mean excess loss. -
VatRGammagives the Value-at-Risk. -
TVatRGammagives the Tail Value-at-Risk. -
mgfGammagives the moment generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRGamma is a wrapper for the qgamma
function stats package.
Examples
# 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)
Inverse Gaussian Distribution
Description
Inverse Gaussian distribution with mean \mu and shape parameter
\beta.
Usage
expValIG(mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
varIG(mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
expValLimIG(d, mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
expValTruncIG(
d,
mean,
shape = dispersion * mean^2,
dispersion = shape/mean^2,
less.than.d = TRUE
)
stopLossIG(d, mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
meanExcessIG(d, mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
VatRIG(kap, mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
TVatRIG(kap, mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
mgfIG(t, mean, shape = dispersion * mean^2, dispersion = shape/mean^2)
Arguments
mean |
mean (location) parameter |
shape |
shape parameter |
dispersion |
alternative parameterization to the shape parameter, dispersion = 1 / rate. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
Details
The Inverse Gaussian distribution with
Value
Function :
-
expValIGgives the expected value. -
varIGgives the variance. -
expValLimIGgives the limited mean. -
expValTruncIGgives the truncated mean. -
stopLossIGgives the stop-loss. -
meanExcessIGgives the mean excess loss. -
VatRIGgives the Value-at-Risk. -
TVatRIGgives the Tail Value-at-Risk. -
mgfIGgives the moment generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRIG is a wrapper for the qinvgauss
function from the statmod package.
Examples
expValIG(mean = 2, shape = 5)
varIG(mean = 2, shape = 5)
expValLimIG(d = 2, mean = 2, shape = 5)
expValTruncIG(d = 2, mean = 2, shape = 5)
stopLossIG(d = 2, mean = 2, shape = 5)
meanExcessIG(d = 2, mean = 2, shape = 5)
VatRIG(kap = 0.99, mean = 2, shape = 5)
TVatRIG(kap = 0.99, mean = 2, shape = 5)
mgfIG(t = 1, mean = 2, shape = .5)
Lognormal Distribution
Description
Lognormal distribution with mean \mu and variance \sigma.
Usage
expValLnorm(meanlog, sdlog)
varLnorm(meanlog, sdlog)
kthMomentLnorm(k, meanlog, sdlog)
expValLimLnorm(d, meanlog, sdlog)
expValTruncLnorm(d, meanlog, sdlog, less.than.d = TRUE)
stopLossLnorm(d, meanlog, sdlog)
meanExcessLnorm(d, meanlog, sdlog)
VatRLnorm(kap, meanlog, sdlog)
TVatRLnorm(kap, meanlog, sdlog)
Arguments
meanlog |
location parameter |
sdlog |
standard deviation |
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
Details
The Log-normal distribution with mean \mu and standard deviation
\sigma has density:
\frac{1}{\sqrt{2\pi}\sigma x}\textrm{e}^{-\frac{1}{2}\left(\frac{\ln(x) - \mu}{\sigma}\right)^2}
for x \in \mathcal{R}^{+}, \mu \in \mathcal{R}, \sigma > 0.
Value
Function :
-
expValLnormgives the expected value. -
varLnormgives the variance. -
kthMomentLnormgives the kth moment. -
expValLimLnormgives the limited mean. -
expValTruncLnormgives the truncated mean. -
stopLossLnormgives the stop-loss. -
meanExcessLnormgives the mean excess loss. -
VatRLnormgives the Value-at-Risk. -
TVatRLnormgives the Tail Value-at-Risk.
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRLnorm is a wrapper of the qlnorm
function from the stats package.
Examples
expValLnorm(meanlog = 3, sdlog = 5)
varLnorm(meanlog = 3, sdlog = 5)
kthMomentLnorm(k = 2, meanlog = 3, sdlog = 5)
expValLimLnorm(d = 2, meanlog = 2, sdlog = 5)
expValTruncLnorm(d = 2, meanlog = 2, sdlog = 5)
# Values greater than d
expValTruncLnorm(d = 2, meanlog = 2, sdlog = 5, less.than.d = FALSE)
stopLossLnorm(d = 2, meanlog = 2, sdlog = 5)
meanExcessLnorm(d = 2, meanlog = 2, sdlog = 5)
VatRLnorm(kap = 0.8, meanlog = 3, sdlog = 5)
TVatRLnorm(kap = 0.8, meanlog = 2, sdlog = 5)
Logarithmic Distribution
Description
Logarithmic distribution with probability parameter \gamma.
Usage
dLogarithmic(x, prob)
pLogarithmic(q, prob, lower.tail = TRUE)
expValLogarithmic(prob)
varLogarithmic(prob)
VatRLogarithmic(kap, prob)
mgfLogarithmic(t, prob)
pgfLogarithmic(t, prob)
Arguments
x, q |
vector of quantiles. |
prob |
probability parameter |
lower.tail |
logical; if TRUE (default), probabilities are
|
kap |
probability. |
t |
t. |
Details
The Logarithmic distribution with probability parameter \gamma
has probability mass function :
Pr(X = k) = \frac{-\gamma^{k}}{\ln(1 - \gamma)k}
,
for k = 0, 1, 2, \dots,
and \gamma \in (0, 1)].
Value
Function :
-
dLogarithmicgives the probability density function (PDF). -
pLogarithmicgives the cumulative density function (CDF). -
expValLogarithmicgives the expected value. -
varLogarithmicgives the variance. -
VatRLogarithmicgives the Value-at-Risk. -
mgfLogarithmicgives the moment generating function (MGF). -
pgfLogarithmicgives the probability generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
dLogarithmic(x = 3, prob = 0.2)
pLogarithmic(q = 3, prob = 0.2)
expValLogarithmic(prob = 0.50)
varLogarithmic(prob = 0.50)
VatRLogarithmic(kap = 0.99, prob = 0.2)
mgfLogarithmic(t = .2, prob = 0.50)
pgfLogarithmic(t = .2, prob = 0.50)
Negative Binomial Distribution
Description
Negative binomial distribution with parameters r (number of successful
trials) and p (probability of success).
Usage
expValNBinom(
size,
prob = (1/(1 + beta)),
beta = ((1 - prob)/prob),
nb_tries = FALSE
)
varNBinom(
size,
prob = (1/(1 + beta)),
beta = ((1 - prob)/prob),
nb_tries = FALSE
)
mgfNBinom(
t,
size,
prob = (1/(1 + beta)),
beta = ((1 - prob)/prob),
nb_tries = FALSE
)
pgfNBinom(
t,
size,
prob = (1/(1 + beta)),
beta = ((1 - prob)/prob),
nb_tries = FALSE
)
Arguments
size |
Number of successful trials. |
prob |
Probability of success in each trial. |
beta |
Alternative parameterization of the negative binomial distribution where beta = (1 - p) / p. |
nb_tries |
logical; if |
t |
t. |
Details
When k is the number of failures until the rth success,
with a probability p of a success, the negative binomial has density:
\left(\frac{r + k - 1}{k}\right) (p)^{r} (1 - p)^{k}
for k \in \{0, 1, \dots \}
When k is the number of trials until the rth success,
with a probability p of a success, the negative binomial has density:
\left(\frac{k - 1}{r - 1}\right) (p)^{r} (1 - p)^{k - r}
for k \in \{r, r + 1, r + 2, \dots \}
The alternative parameterization of the negative binomial with parameter
\beta, and k being the number of trials, has density:
\frac{\Gamma(r + k)}{\Gamma(r) k!} \left(\frac{1}{1 + \beta}\right)^{r}%
\left(\frac{\beta}{1 + \beta}\right)^{k - r}
for k \in \{0, 1, \dots \}
Value
Function :
-
expValNBinomgives the expected value. -
varNBinomgives the variance. -
mgfNBinomgives the moment generating function (MGF). -
pgfNBinomgives the probability generating function (PGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
# Where k is the number of trials for a rth success
expValNBinom(size = 2, prob = .4)
# Where k is the number of failures before a rth success
expValNBinom(size = 2, prob = .4, nb_tries = TRUE)
# With alternative parameterization where k is the number of trials
expValNBinom(size = 2, beta = 1.5)
# Where k is the number of trials for a rth success
varNBinom(size = 2, prob = .4)
# Where k is the number of failures before a rth success
varNBinom(size = 2, prob = .4, nb_tries = TRUE)
# With alternative parameterization where k is the number of trials
varNBinom(size = 2, beta = 1.5)
mgfNBinom(t = 1, size = 4, prob = 0.5)
pgfNBinom(t = 5, size = 3, prob = 0.3)
Normal Distribution
Description
Normal distribution
Usage
expValNorm(mean, sd)
varNorm(mean, sd)
expValLimNorm(d, mean = 0, sd = 1)
expValTruncNorm(d, mean = 0, sd = 1, less.than.d = TRUE)
stopLossNorm(d, mean = 0, sd = 1)
meanExcessNorm(d, mean = 0, sd = 1)
VatRNorm(kap, mean = 0, sd = 1)
TVatRNorm(kap, mean = 0, sd = 1)
mgfNorm(t, mean = 0, sd = 1)
Arguments
mean |
mean (location) parameter |
sd |
standard deviation |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
Details
The Normal distribution with mean \mu and standard deviation
\sigma has density:
\frac{1}{\sqrt{2\pi}\sigma}\textrm{e}^{-\frac{1}{2}\left(\frac{x - \mu}{\sigma}\right)^2}
for x \in \mathcal{R}, \mu \in \mathcal{R}, \sigma > 0.
Value
Function :
-
expValNormgives the expected value. -
varNormgives the variance. -
expValLimNormgives the limited mean. -
expValTruncNormgives the truncated mean. -
stopLossNormgives the stop-loss. -
meanExcessNormgives the mean excess loss. -
VatRNormgives the Value-at-Risk. -
TVatRNormgives the Tail Value-at-Risk. -
mgfNormgives the moment generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRNorm is a wrapper of the qnorm
function from the stats package.
Examples
expValNorm(mean = 3, sd = 5)
varNorm(mean = 3, sd = 5)
expValLimNorm(d = 2, mean = 2, sd = 5)
expValTruncNorm(d = 2, mean = 2, sd = 5)
stopLossNorm(d = 2, mean = 2, sd = 5)
meanExcessNorm(d = 2, mean = 2, sd = 5)
VatRNorm(kap = 0.8, mean = 3, sd = 5)
TVatRNorm(kap = 0.8, mean = 2, sd = 5)
mgfNorm(t = 1, mean = 3, sd = 5)
Pareto Distribution
Description
Pareto distribution with shape parameter \alpha and rate
parameter \lambda.
Usage
dPareto(x, shape, rate = 1/scale, scale = 1/rate)
pPareto(q, shape, rate = 1/scale, scale = 1/rate, lower.tail = TRUE)
expValPareto(shape, rate = 1/scale, scale = 1/rate)
varPareto(shape, rate = 1/scale, scale = 1/rate)
kthMomentPareto(k, shape, rate = 1/scale, scale = 1/rate)
expValLimPareto(d, shape, rate = 1/scale, scale = 1/rate)
expValTruncPareto(d, shape, rate = 1/scale, scale = 1/rate, less.than.d = TRUE)
stopLossPareto(d, shape, rate = 1/scale, scale = 1/rate)
meanExcessPareto(d, shape, rate = 1/scale, scale = 1/rate)
VatRPareto(kap, shape, rate = 1/scale, scale = 1/rate)
TVatRPareto(kap, shape, rate = 1/scale, scale = 1/rate)
Arguments
x, q |
vector of quantiles. |
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
lower.tail |
logical; if TRUE (default), probabilities are
|
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
Details
The Pareto distribution with rate parameter \lambda as well as shape
parameter \alpha has density:
f\left(x\right) = \frac{\alpha\lambda^{\alpha}}%
{(\lambda + x)^{\alpha + 1}}
for x \in \mathcal{R}^+, \alpha, \lambda > 0.
Value
Function :
-
dParetogives the probability density function (PDF). -
pParetogives the cumulative density function (CDF). -
expValParetogives the expected value. -
varParetogives the variance. -
kthMomentParetogives the kth moment. -
expValLimParetogives the limited mean. -
expValTruncParetogives the truncated mean. -
stopLossParetogives the stop-loss. -
meanExcessParetogives the mean excess loss. -
VatRParetogives the Value-at-Risk. -
TVatRParetogives the Tail Value-at-Risk.
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
# With scale parameter
dPareto(x = 2, shape = 2, scale = 5)
# With rate parameter
dPareto(x = 2, shape = 2, rate = .20)
# With scale parameter
pPareto(q = 2, shape = 2, scale = 5)
# With rate parameter
pPareto(q = 2, shape = 2, rate = 0.20)
# Survival function
pPareto(q = 2, shape = 2, rate = 0.20, lower.tail = FALSE)
# With scale parameter
expValPareto(shape = 5, scale = 0.5)
# With rate parameter
expValPareto(shape = 5, rate = 2)
# With scale parameter
varPareto(shape = 5, scale = 0.5)
# With rate parameter
varPareto(shape = 5, rate = 2)
# With scale parameter
kthMomentPareto(k = 4, shape = 5, scale = 0.5)
# With rate parameter
kthMomentPareto(k = 4, shape = 5, rate = 2)
# With scale parameter
expValLimPareto(d = 4, shape = 5, scale = 0.5)
# With rate parameter
expValLimPareto(d = 4, shape = 5, rate = 2)
# With scale parameter
expValTruncPareto(d = 4, shape = 5, scale = 0.5)
# With rate parameter
expValTruncPareto(d = 4, shape = 5, rate = 2)
# With scale parameter
stopLossPareto(d = 2, shape = 5, scale = 0.5)
# With rate parameter
stopLossPareto(d = 2, shape = 5, rate = 2)
# With scale parameter
meanExcessPareto(d = 6, shape = 5, scale = 0.5)
# With rate parameter
meanExcessPareto(d = 6, shape = 5, rate = 2)
# With scale parameter
VatRPareto(kap = .99, shape = 5, scale = 0.5)
# With rate parameter
VatRPareto(kap = .99, shape = 5, rate = 2)
# With scale parameter
TVatRPareto(kap = .99, shape = 5, scale = 0.5)
# With rate parameter
TVatRPareto(kap = .99, shape = 5, rate = 2)
Poisson Distribution
Description
Poisson distribution with rate parameter \lambda.
Usage
expValPois(lambda)
varPois(lambda)
expValTruncPois(d, lambda, k0, less.than.d = TRUE)
TVatRPois(kap, lambda, k0)
mgfPois(t, lambda)
pgfPois(t, lambda)
Arguments
lambda |
Rate parameter |
d |
cut-off value. |
k0 |
point up to which to sum the distribution for the approximation. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
Details
The Poisson distribution with rate parameter \lambda
has probability mass function :
Pr(X = k) = \frac{\lambda^k \textrm{e}^{-\lambda}}{k!}
for k = 0, 1, 2, \dots, and \lambda > 0
Value
Function :
-
expValPoisgives the expected value. -
varPoisgives the variance. -
expValTruncPoisgives the truncated mean. -
TVatRPoisgives the Tail Value-at-Risk. -
mgfPoisgives the moment generating function (MGF). -
pgfPoisgives the probability generating function (PGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
expValPois(lambda = 3)
varPois(lambda = 3)
expValTruncPois(d = 0, lambda = 2, k0 = 2E2, less.than.d = FALSE)
expValTruncPois(d = 2, lambda = 2, k0 = 2E2, less.than.d = TRUE)
TVatRPois(kap = 0.8, lambda = 3, k0 = 2E2)
mgfPois(t = 1, lambda = 3)
pgfPois(t = 1, lambda = 3)
Uniform Distribution
Description
Uniform distribution with min a and max b.
Usage
expValUnif(min = 0, max = 1)
varUnif(min = 0, max = 1)
kthMomentUnif(k, min = 0, max = 1)
expValLimUnif(d, min = 0, max = 1)
expValTruncUnif(d, min = 0, max = 1, less.than.d = TRUE)
stopLossUnif(d, min = 0, max = 1)
meanExcessUnif(d, min = 0, max = 1)
VatRUnif(kap, min = 0, max = 1)
TVatRUnif(kap, min = 0, max = 1)
mgfUnif(t, min = 0, max = 1)
Arguments
min, max |
lower and upper limits of the distribution. Must be finite. |
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
Details
The (continuous) uniform distribution with min and max parameters a
and b respectively has density:
f(x) = \frac{1}{b - a} \times \bm{1}_{\{x \in [a, b] \}}
for x \in [a, b].
Value
Function :
-
expValUnifgives the expected value. -
varUnifgives the variance. -
kthMomentUnifgives the kth moment. -
expValLimUnifgives the limited mean. -
expValTruncUnifgives the truncated mean. -
stopLossUnifgives the stop-loss. -
meanExcessUnifgives the mean excess loss. -
VatRUnifgives the Value-at-Risk. -
TVatRUnifgives the Tail Value-at-Risk.
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
expValUnif(min = 3, max = 4)
varUnif(min = 3, max = 4)
kthMomentUnif(k = 2, min = 3, max = 4)
expValLimUnif(d = 3, min = 2, max = 4)
expValTruncUnif(d = 3, min = 2, max = 4)
# Values greather than d
expValTruncUnif(d = 3, min = 2, max = 4, less.than.d = FALSE)
stopLossUnif(d = 3, min = 2, max = 4)
meanExcessUnif(d = 2, min = 2, max = 4)
VatRUnif(kap = .99, min = 3, max = 4)
TVatRUnif(kap = .99, min = 3, max = 4)
mgfUnif(t = 2, min = 0, max = 1)
Weibull Distribution
Description
Weibull distribution with shape parameter \tau and rate parameter
\beta.
Usage
expValWeibull(shape, rate = 1/scale, scale = 1/rate)
varWeibull(shape, rate = 1/scale, scale = 1/rate)
kthMomentWeibull(k, shape, rate = 1/scale, scale = 1/rate)
expValLimWeibull(d, shape, rate = 1/scale, scale = 1/rate)
expValTruncWeibull(
d,
shape,
rate = 1/scale,
scale = 1/rate,
less.than.d = TRUE
)
stopLossWeibull(d, shape, rate = 1/scale, scale = 1/rate)
meanExcessWeibull(d, shape, rate = 1/scale, scale = 1/rate)
VatRWeibull(kap, shape, rate = 1/scale, scale = 1/rate)
TVatRWeibull(kap, shape, rate = 1/scale, scale = 1/rate)
Arguments
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
Details
The Weibull distribution with shape parameter \tau and rate parameter
\beta has density:
f\left(x\right) = \beta \tau \left( \beta x \right) ^{\tau -1} %
\mathrm{e}^{-\left( \beta x\right) ^{\tau }}
for x \in \mathcal{R}^+, \beta > 0, \tau > 0
Value
Function :
-
expValWeibullgives the expected value. -
varWeibullgives the variance. -
kthMomentWeibullgives the kth moment. -
expValLimWeibullgives the limited mean. -
expValTruncWeibullgives the truncated mean. -
stopLossWeibullgives the stop-loss. -
meanExcessWeibullgives the mean excess loss. -
VatRWeibullgives the Value-at-Risk. -
TVatRWeibullgives the Tail Value-at-Risk.
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
# With scale parameter
expValWeibull(shape = 2, scale = 5)
# With rate parameter
expValWeibull(shape = 2, rate = 0.2)
# With scale parameter
varWeibull(shape = 2, scale = 5)
# With rate parameter
varWeibull(shape = 2, rate = 0.2)
# With scale parameter
kthMomentWeibull(k = 2, shape = 2, scale = 5)
# With rate parameter
kthMomentWeibull(k = 2, shape = 2, rate = 0.2)
# With scale parameter
expValLimWeibull(d = 2, shape = 2, scale = 5)
# With rate parameter
expValLimWeibull(d = 2, shape = 2, rate = 0.2)
# With scale parameter
expValTruncWeibull(d = 2, shape = 2, scale = 5)
# With rate parameter
expValTruncWeibull(d = 2, shape = 2, rate = 0.2)
# Mean of values greater than d
expValTruncWeibull(d = 2, shape = 2, rate = 0.2, less.than.d = FALSE)
# With scale parameter
stopLossWeibull(d = 2, shape = 3, scale = 4)
# With rate parameter
stopLossWeibull(d = 2, shape = 3, rate = 0.25)
# With scale parameter
meanExcessWeibull(d = 2, shape = 3, scale = 4)
# With rate parameter
meanExcessWeibull(d = 2, shape = 3, rate = 0.25)
# With scale parameter
VatRWeibull(kap = .2, shape = 3, scale = 4)
# With rate parameter
VatRWeibull(kap = .2, shape = 3, rate = 0.25)
# With scale parameter
TVatRWeibull(kap = .2, shape = 3, scale = 4)
# With rate parameter
TVatRWeibull(kap = .2, shape = 3, rate = 0.25)
Binomial Distribution
Description
Binomial distribution with size n and probability of
success p.
Usage
expValBinom(size, prob)
varBinom(size, prob)
expValTruncBinom(d, size, prob, less.than.d = TRUE)
VatRBinom(kap, size, prob)
TVatRBinom(kap, size, prob)
pgfBinom(t, size, prob)
mgfBinom(t, size, prob)
Arguments
size |
Number of trials (0 or more). |
prob |
Probability of success in each trial. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
Details
The binomial distribution with probability of success p for n trials
has probability mass function :
Pr(X = k) = \left(\frac{n}{k}\right) p^n (1 - p)^{n - k}
for k = 0, 1, 2, \dots, n, p \in [0, 1], and n > 0
Value
Function :
-
mgfBinomgives the moment generating function (MGF). -
pgfBinomgives the probability generating function (PGF). -
expValBinomgives the expected value. -
varBinomgives the variance. -
expValTruncBinomgives the truncated mean. -
TVatRBinomgives the Tail Value-at-Risk. -
VatRBinomgives the Value-at-Risk.
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRBinom is a wrapper of the qbinom
function from the stats package.
Examples
expValBinom(size = 3, prob = 0.5)
varBinom(size = 3, prob = 0.5)
expValTruncBinom(d = 2, size = 3, prob = 0.5)
expValTruncBinom(d = 0, size = 3, prob = 0.5, less.than.d = FALSE)
VatRBinom(kap = 0.8, size = 5, prob = 0.2)
TVatRBinom(kap = 0.8, size = 5, prob = 0.2)
pgfBinom(t = 1, size = 3, prob = 0.5)
mgfBinom(t = 1, size = 3, prob = 0.5)
Bivariate Ali-Mikhail-Haq Copula
Description
Computes CDF, PDF and simulations of of the bivariate Ali-Mikhail-Haq copula.
Usage
cBivariateAMH(u1, u2, dependencyParameter, ...)
cdBivariateAMH(u1, u2, dependencyParameter, ...)
crBivariateAMH(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameter. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The bivariate Ali-Mikhail-Haq copula has CDF :
Value
Function :
-
cBivariateAMHreturns the value of the copula. -
cdBivariateAMHreturns the value of the density copula. -
crBivariateAMHreturns simulated values of the copula.
Examples
cBivariateAMH(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
cdBivariateAMH(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
crBivariateAMH(numberSimulations = 10, seed = 42, dependencyParameter = 0.2)
Bivariate Cuadras-Augé Copula
Description
Computes CDF and simulations of the bivariate Cuadras-Augé copula.
Usage
cBivariateCA(u1, u2, dependencyParameter, ...)
crBivariateCA(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameter. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The bivariate Cuadras-Augé copula has CDF :
C(u_{1}, u_{2}) = u_{1}u_{2}^{1 - \alpha} \times%
\textbf{1}_{\{u_{1} \leq u_{2}\}} + u_{1}^{1 - \alpha}u_{2} \times%
\textbf{1}_{\{u_{1} \geq u_{2}\}}
for u_{1}, u_{2}, \alpha \in [0, 1].
It is the geometric mean of the independance and upper Fréchet bound copulas.
Value
Function :
-
cBivariateCAreturns the value of the copula. -
crBivariateCAreturns simulated values of the copula.
Examples
cBivariateCA(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
crBivariateCA(numberSimulations = 10, seed = 42, dependencyParameter = 0.2)
Bivariate Clayton Copula
Description
Computes CDF, PDF and simulations of the bivariate Clayton copula.
Usage
cBivariateClayton(u1, u2, dependencyParameter, ...)
cdBivariateClayton(u1, u2, dependencyParameter, ...)
crBivariateClayton(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameter. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The bivariate Clayton copula has CDF :
Value
Function :
-
cBivariateAMHreturns the value of the copula. -
cdBivariateAMHreturns the value of the density function associated to the copula.
Examples
cBivariateClayton(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
cdBivariateClayton(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
crBivariateClayton(numberSimulations = 10, seed = 42, dependencyParameter = 0.2)
Bivariate Eyraud-Farlie-Gumbel-Morgenstern (EFGM) Copula
Description
Computes CDF, PDF and simulations of the EFGM copula.
Usage
cBivariateEFGM(u1, u2, dependencyParameter)
cdBivariateEFGM(u1, u2, dependencyParameter)
crBivariateEFGM(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameter. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The EFGM copula has CDF :
Value
Function :
-
cBivariateEFGMreturns the value of the copula. -
cdBivariateEFGMreturns the value of the density function associated to the copula. -
crBivariateEFGMreturns simulated values of the copula.
Examples
cBivariateEFGM(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
cdBivariateEFGM(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
crBivariateEFGM(numberSimulations = 10, seed = 42, dependencyParameter = 0.2)
Bivariate Frank Copula
Description
Computes CDF, PDF and simulations of the bivariate Frank copula.
Usage
cBivariateFrank(u1, u2, dependencyParameter, ...)
cdBivariateFrank(u1, u2, dependencyParameter, ...)
crBivariateFrank(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameter. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The bivariate Frank copula has CDF :
Value
Function :
-
cBivariateFrankreturns the value of the copula. -
cdBivariateFrankreturns the value of the density function associated to the copula. -
crBivariateFrankreturns simulated values of the copula.
Examples
cBivariateFrank(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
cdBivariateFrank(u1 = .76, u2 = 0.4, dependencyParameter = 0.4)
crBivariateFrank(numberSimulations = 10, seed = 42, dependencyParameter = 0.2)
Bivariate Gumbel Copula
Description
Computes CDF, PDF and simulations of the bivariate Gumbel copula.
Usage
cBivariateGumbel(u1, u2, dependencyParameter, ...)
cdBivariateGumbel(u1, u2, dependencyParameter, ...)
crBivariateGumbel(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameter. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The bivariate Gumbel copula has CDF :
Value
Function :
-
cBivariateGumbelreturns the value of the copula. -
cdBivariateGumbelreturns the value of the density function associated to the copula. -
crBivariateGumbelreturns simulated values of the copula.
Examples
cBivariateGumbel(u1 = .76, u2 = 0.4, dependencyParameter = 1.4)
cdBivariateGumbel(u1 = .76, u2 = 0.4, dependencyParameter = 1.4)
crBivariateGumbel(numberSimulations = 10, seed = 42, dependencyParameter = 1.2)
Bivariate Marshall-Olkin Copula
Description
Computes CDF and simulations of the bivariate Marshall-Olkin copula.
Usage
cBivariateMO(u1, u2, dependencyParameter, ...)
crBivariateMO(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameters, must be vector of length 2. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The bivariate Marshall-Olkin copula has CDF :
C(u_{1}, u_{2}) = u_{1}u_{2}^{1 - \beta} \times%
\textbf{1}_{\{u_{1}^{\alpha} \leq u_{2}^{\beta}\}} + %
u_{1}^{1 - \alpha}u_{2} \times \textbf{1}_{\{u_{1}^{\alpha}%
\geq u_{2}^{\beta}\}}
for u_{1}, u_{2}, \alpha, \beta \in [0, 1].
It is the geometric mean of the independance and upper Fréchet bound copulas.
Value
Function :
-
cBivariateMOreturns the value of the copula. -
crBivariateMOreturns simulated values of the copula.
Examples
cBivariateMO(u1 = .76, u2 = 0.4, dependencyParameter = c(0.4, 0.3))
crBivariateMO(numberSimulations = 10, seed = 42, dependencyParameter = c(0.2, 0.5))
Erlang Distribution
Description
Erlang distribution with shape parameter n and rate parameter
\beta.
Usage
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, q |
vector of quantiles. |
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
lower.tail |
logical; if TRUE (default), probabilities are
|
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
t |
t. |
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}^+.
Value
Function :
-
dErlanggives the probability density function (PDF). -
pErlanggives the cumulative density function (CDF). -
expValErlanggives the expected value. -
varErlanggives the variance. -
kthMomentErlanggives the kth moment. -
expValLimErlanggives the limited mean. -
expValTruncErlanggives the truncated mean. -
stopLossErlanggives the stop-loss. -
meanExcessErlanggives the mean excess loss. -
VatRErlanggives the Value-at-Risk. -
TVatRErlanggives the Tail Value-at-Risk. -
mgfErlanggives the moment generating function (MGF).
Invalid parameter values will return an error detailing which parameter is problematic.
Note
Function VatRErlang is a wrapper of the qgamma
function from the stats package.
Examples
dErlang(x = 2, shape = 2, scale = 4)
pErlang(q = 2, shape = 2, scale = 4)
expValErlang(shape = 2, scale = 4)
varErlang(shape = 2, scale = 4)
kthMomentErlang(k = 3, shape = 2, scale = 4)
expValLimErlang(d = 2, shape = 2, scale = 4)
# With rate parameter
expValTruncErlang(d = 2, shape = 2, scale = 4)
# Values greater than d
expValTruncErlang(d = 2, shape = 2, scale = 4, less.than.d = FALSE)
stopLossErlang(d = 2, shape = 2, scale = 4)
meanExcessErlang(d = 3, shape = 2, scale = 4)
# With scale parameter
VatRErlang(kap = .2, shape = 2, scale = 4)
# With rate parameter
VatRErlang(kap = .2, shape = 2, rate = 0.25)
# With scale parameter
TVatRErlang(kap = .2, shape = 3, scale = 4)
# With rate parameter
TVatRErlang(kap = .2, shape = 3, rate = 0.25)
mgfErlang(t = 2, shape = 2, scale = .25)
Fréchet Copula
Description
Computes CDF and simulations of the Fréchet copula.
Usage
cFrechet(u1, u2, dependencyParameter, ...)
crFrechet(numberSimulations = 10000, seed = 42, dependencyParameter)
Arguments
u1, u2 |
points at which to evaluate the copula. |
dependencyParameter |
correlation parameters, must be vector of length 2. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The Fréchet copula has CDF :
C(u_{1}, u_{2}) = (1 - \alpha - \beta)(u_{1} \times u_{2}) + \alpha\min(u_{1}, u_{2})%
+ \beta\max(u_{1} + u_{2} - 1, 0)
for u_{1}, u_{2}, \alpha, \beta \in [0, 1]
and \alpha + \beta \leq 1.
Value
Function :
Examples
cFrechet(u1 = .76, u2 = 0.4, dependencyParameter = c(0.2, 0.3))
crFrechet(numberSimulations = 10, seed = 42, dependencyParameter = c(0.2, 0.3))
Fréchet Lower Bound Copula
Description
Computes CDF and simulations of the Fréchet lower bound copula.
Usage
cFrechetLowerBound(u1, u2, ...)
crFrechetLowerBound(numberSimulations = 10000, seed = 42)
Arguments
u1, u2 |
points at which to evaluate the copula. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The Fréchet lower bound copula has CDF :
C(u_{1}, u_{2}) = \max(u_{1} + u_{2} - 1, 0)
for u_{1}, u_{2} \in [0, 1].
Value
Function :
-
cFrechetLowerBoundreturns the value of the copula. -
crFrechetLowerBoundreturns simulated values of the copula.
Examples
cFrechetLowerBound(u1 = .76, u2 = 0.4)
crFrechetLowerBound(numberSimulations = 10, seed = 42)
Fréchet Upper Bound Copula
Description
Computes CDF and simulations of the Fréchet upper bound copula.
Usage
cFrechetUpperBound(u1, u2, ...)
crFrechetUpperBound(numberSimulations = 10000, seed = 42)
Arguments
u1, u2 |
points at which to evaluate the copula. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The Fréchet upper bound copula has CDF :
C(u_{1}, u_{2}) = \min(u_{1}, u_{2})
for u_{1}, u_{2} \in [0, 1].
Value
Function :
-
cFrechetUpperBoundreturns the value of the copula. -
crFrechetUpperBoundreturns simulated values of the copula.
Examples
cFrechetUpperBound(u1 = .56, u2 = 0.4)
crFrechetUpperBound(numberSimulations = 10, seed = 42)
Independence Copula
Description
Computes CDF and simulations of the independence copula.
Usage
cIndependent(u1, u2, ...)
crIndependent(numberSimulations = 10000, seed = 42)
Arguments
u1, u2 |
points at which to evaluate the copula. |
... |
other parameters. |
numberSimulations |
Number of simulations. |
seed |
Simulation seed, 42 by default. |
Details
The independence copula has CDF :
C(u_{1}, u_{2}) = u_{1} \times u_{2}
for u_{1}, u_{2} \in [0, 1].
Value
Function :
-
cIndependentreturns the value of the copula. -
crIndependentreturns simulated values of the copula.
Examples
cIndependent(u1 = .76, u2 = 0.4)
crIndependent(numberSimulations = 10, seed = 42)
Loglogistic Distribution
Description
Loglogistic distribution with shape parameter \tau and scale
parameter \lambda.
Usage
dLlogis(x, shape, rate = 1/scale, scale = 1/rate)
pLlogis(q, shape, rate = 1/scale, scale = 1/rate, lower.tail = TRUE)
expValLlogis(shape, rate = 1/scale, scale = 1/rate)
varLlogis(shape, rate = 1/scale, scale = 1/rate)
kthMomentLlogis(k, shape, rate = 1/scale, scale = 1/rate)
expValLimLlogis(d, shape, rate = 1/scale, scale = 1/rate)
expValTruncLlogis(d, shape, rate = 1/scale, scale = 1/rate, less.than.d = TRUE)
stopLossLlogis(d, shape, rate = 1/scale, scale = 1/rate)
meanExcessLlogis(d, shape, rate = 1/scale, scale = 1/rate)
VatRLlogis(kap, shape, rate = 1/scale, scale = 1/rate)
TVatRLlogis(kap, shape, rate = 1/scale, scale = 1/rate)
Arguments
x, q |
vector of quantiles. |
shape |
shape parameter |
rate |
rate parameter |
scale |
alternative parameterization to the rate parameter, scale = 1 / rate. |
lower.tail |
logical; if TRUE (default), probabilities are
|
k |
kth-moment. |
d |
cut-off value. |
less.than.d |
logical; if |
kap |
probability. |
Details
The loglogistic distribution with shape parameter \tau and scale parameter
\lambda has density:
\frac{\tau \lambda^\tau x^{\tau -1}}{(\lambda^{\tau }+x^{\tau })^{2}}
for x \in \mathcal{R}^+, \lambda, \tau > 0.
Value
Function :
-
dLlogisgives the probability density function (PDF). -
pLlogisgives the cumulative density function (CDF). -
expValLlogisgives the expected value. -
varLlogisgives the variance. -
kthMomentLlogisgives the kth moment. -
expValLimLlogisgives the limited mean. -
expValTruncLlogisgives the truncated mean. -
stopLossLlogisgives the stop-loss. -
meanExcessLlogisgives the mean excess loss. -
VatRLlogisgives the Value-at-Risk. -
TVatRLlogisgives the Tail Value-at-Risk.
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
dLlogis(x = 2, shape = 2, scale = 4)
# With scale parameter
pLlogis(q = 3, shape = 3, scale = 5)
# With rate parameter
pLlogis(q = 3, shape = 3, rate = 0.2)
# Survival function
pLlogis(q = 3, shape = 3, rate = 0.2, lower.tail = FALSE)
expValLlogis(shape = 2, scale = 4)
varLlogis(shape = 3, scale = 4)
kthMomentLlogis(k = 3, shape = 5, scale = 4)
expValLimLlogis(d = 2, shape = 2, scale = 4)
# With rate parameter
expValTruncLlogis(d = 2, shape = 2, scale = 4)
# Values greater than d
expValTruncLlogis(d = 2, shape = 2, scale = 4, less.than.d = FALSE)
stopLossLlogis(d = 2, shape = 2, scale = 4)
meanExcessLlogis(d = 3, shape = 2, scale = 4)
# With scale parameter
VatRLlogis(kap = .2, shape = 2, scale = 4)
# With rate parameter
VatRLlogis(kap = .2, shape = 2, rate = 0.25)
# With scale parameter
TVatRLlogis(kap = .2, shape = 3, scale = 4)
# With rate parameter
TVatRLlogis(kap = .2, shape = 3, rate = 0.25)
Discrete Uniform Distribution
Description
Discrete uniform distribution with min a and max b.
Usage
pUnifD(q, min = 0, max = 1)
dUnifD(x, min = 0, max = 1)
varUnifD(min = 0, max = 1)
expValUnifD(min = 0, max = 1)
Arguments
min, max |
lower and upper limits of the distribution. Must be finite. |
x, q |
vector of quantiles. |
Details
The (discrete) uniform distribution with min and max parameters a
and b respectively has density:
\textrm{Pr}\left(X = x \right) = \frac{1}{b - a + 1}
for x \in \{a, a + 1, \dots, b - 1, b\}.
Value
Function :
-
dUnifDgives the probability density function (PDF). -
pUnifDgives the cumulative density function (CDF). -
expValUnifDgives the expected value. -
varUnifDgives the variance.
Invalid parameter values will return an error detailing which parameter is problematic.
Examples
pUnifD(q = 0.2, min = 0, max = 1)
dUnifD(min = 0, max = 1)
varUnifD(min = 0, max = 1)
expValUnifD(min = 0, max = 1)