Package 'VaRES'

Title: Computes Value at Risk and Expected Shortfall for over 100 Parametric Distributions
Description: Computes Value at risk and expected shortfall, two most popular measures of financial risk, for over one hundred parametric distributions, including all commonly known distributions. Also computed are the corresponding probability density function and cumulative distribution function. See Chan, Nadarajah and Afuecheta (2015) <doi:10.1080/03610918.2014.944658> for more details.
Authors: Leo Belzile [cre] , Saralees Nadarajah [aut], Stephen Chan [aut], Emmanuel Afuecheta [aut]
Maintainer: Leo Belzile <[email protected]>
License: GPL (>= 2)
Version: 1.0.2
Built: 2024-12-12 02:53:59 UTC
Source: https://github.com/lbelzile/vares

Help Index


Computes value at risk and expected shortfall for over 100 parametric distributions

Description

Computes Value at risk and expected shortfall, two most popular measures of financial risk, for over one hundred parametric distributions, including all commonly known distributions. Also computed are the corresponding probability density function and cumulative distribution function.

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658


Asymmetric exponential power distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the asymmetric exponential power distribution due to Zhu and Zinde-Walsh (2009) given by

f(x)={ααK(q1)exp[1q1x2αq1],if x0,1α1αK(q2)exp[1q2x22αq2],if x>0,F(x)={αQ(1q1(x2α)q1,1q1),if x0,1(1α)Q(1q2(x22α)q2,1q2),if x>0,VaRp(X)={2α[q1Q1(pα,1q1)]1q1,if pα,2(1α)[q2Q1(1p1α,1q2)]1q2,if p>α,ESp(X)={2αp0p[q1Q1(vα,1q1)]1q1dv,if pα,2αp0α[q1Q1(vα,1q1)]1q1dv +2(1α)pαp[q2Q1(1v1α,1q2)]1q2dv,if p>α\begin{array}{ll} &\displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle \frac {\alpha}{\alpha^{*}} K \left( q_1 \right) \exp \left[ -\frac {1}{q_1} \left | \frac {x}{2 \alpha^{*}} \right |^{q_1} \right], & \mbox{if $x \leq 0$,} \\ \\ \displaystyle \frac {1 - \alpha}{1 - \alpha^{*}} K \left( q_2 \right) \exp \left[ -\frac {1}{q_2} \left | \frac {x}{2 - 2 \alpha^{*}} \right |^{q_2} \right], & \mbox{if $x > 0$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \alpha Q \left( \frac {1}{q_1} \left( \frac {\mid x \mid}{2 \alpha^{*}} \right)^{q_1}, \frac {1}{q_1} \right), & \mbox{if $x \leq 0$,} \\ \\ \displaystyle 1 - (1 - \alpha) Q \left( \frac {1}{q_2} \left( \frac {\mid x \mid}{2 - 2 \alpha^{*}} \right)^{q_2}, \frac {1}{q_2} \right), & \mbox{if $x > 0$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle -2 \alpha^{*} \left[ q_1 Q^{-1} \left( \frac {p}{\alpha}, \frac {1}{q_1} \right) \right]^{\frac {1}{q_1}}, & \mbox{if $p \leq \alpha$,} \\ \\ \displaystyle 2 \left(1 - \alpha^{*}\right) \left[ q_2 Q^{-1} \left( \frac {1 - p}{1 - \alpha}, \frac {1}{q_2} \right) \right]^{\frac {1}{q_2}}, & \mbox{if $p > \alpha$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle -\frac {2 \alpha^{*}}{p} \int_0^p \left[ q_1 Q^{-1} \left( \frac {v}{\alpha}, \frac {1}{q_1} \right) \right]^{\frac {1}{q_1}} dv, & \mbox{if $p \leq \alpha$,} \\ \\ \displaystyle -\frac {2 \alpha^{*}}{p} \int_0^\alpha \left[ q_1 Q^{-1} \left( \frac {v}{\alpha}, \frac {1}{q_1} \right) \right]^{\frac {1}{q_1}} dv & \ \\ \quad \displaystyle +\frac {2 \left(1 - \alpha^{*}\right)}{p} \int_\alpha^p \left[ q_2 Q^{-1} \left( \frac {1 - v}{1 - \alpha}, \frac {1}{q_2} \right) \right]^{\frac {1}{q_2}} dv, & \mbox{if $p > \alpha$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, 0<α<10 < \alpha < 1, the scale parameter, q1>0q_1 > 0, the first shape parameter, and q2>0q_2 > 0, the second shape parameter, where α=αK(q1)/{αK(q1)+(1α)K(q2)}\alpha^{*} = \alpha K \left( q_1 \right) / \left\{ \alpha K \left( q_1 \right) + (1 - \alpha) K \left( q_2 \right) \right\}, K(q)=12q1/qΓ(1+1/q)K (q) = \frac {1}{2 q^{1/q} \Gamma (1 + 1/q)}, Q(a,x)=xta1exp(t)dt/Γ(a)Q (a, x) = \int_x^\infty t^{a - 1} \exp \left( -t \right) dt / \Gamma (a) denotes the regularized complementary incomplete gamma function, Γ(a)=0ta1exp(t)dt\Gamma (a) = \int_0^\infty t^{a - 1} \exp \left( -t \right) dt denotes the gamma function, and Q1(a,x)Q^{-1} (a, x) denotes the inverse of Q(a,x)Q (a, x).

Usage

daep(x, q1=1, q2=1, alpha=0.5, log=FALSE)
paep(x, q1=1, q2=1, alpha=0.5, log.p=FALSE, lower.tail=TRUE)
varaep(p, q1=1, q2=1, alpha=0.5, log.p=FALSE, lower.tail=TRUE)
esaep(p, q1=1, q2=1, alpha=0.5)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

alpha

the value of the scale parameter, must be in the unit interval, the default is 0.5

q1

the value of the first shape parameter, must be positive, the default is 1

q2

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
daep(x)
paep(x)
varaep(x)
esaep(x)

Arcsine distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the arcsine distribution given by

f(x)=1π(xa)(bx),F(x)=2πarcsin(xaba),VaRp(X)=a+(ba)sin2(πp2),ESp(X)=a+bap0psin2(πv2)dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\pi \sqrt{(x - a) (b - x)}}, \\ &\displaystyle F (x) = \frac {2}{\pi} \arcsin \left( \sqrt{\frac {x - a}{b - a}} \right), \\ &\displaystyle {\rm VaR}_p (X) = a + (b - a) \sin^2 \left( \frac {\pi p}{2} \right), \\ &\displaystyle {\rm ES}_p (X) = a + \frac {b - a}{p} \int_0^p \sin^2 \left( \frac {\pi v}{2} \right) dv \end{array}

for axba \leq x \leq b, 0<p<10 < p < 1, <a<-\infty < a < \infty, the first location parameter, and <a<b<-\infty < a < b < \infty, the second location parameter.

Usage

darcsine(x, a=0, b=1, log=FALSE)
parcsine(x, a=0, b=1, log.p=FALSE, lower.tail=TRUE)
vararcsine(p, a=0, b=1, log.p=FALSE, lower.tail=TRUE)
esarcsine(p, a=0, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first location parameter, can take any real value, the default is zero

b

the value of the second location parameter, can take any real value but must be greater than a, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
darcsine(x)
parcsine(x)
vararcsine(x)
esarcsine(x)

Generalized asymmetric Student's t distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized asymmetric Student's tt distribution due to Zhu and Galbraith (2010) given by

f(x)={ααK(ν1)[1+1ν1(x2α)2]ν1+12,if x0,1α1αK(ν2)[1+1ν2(x2(1α))2]ν2+12,if x>0,F(x)=2αFν1(min(x,0)2α)1+α+2(1α)Fν2(max(x,0)22α),VaRp(X)=2αFν11(min(p,α)2α)+2(1α)Fν21(max(p,α)+12α22α),ESp(X)=2αp0pFν11(min(v,α)2α)dv+2(1α)p0pFν21(max(v,α)+12α22α)dv\begin{array}{ll} &\displaystyle \displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle \frac {\alpha}{\alpha^{*}} K \left( \nu_1 \right) \left[ 1 + \frac {1}{\nu_1} \left( \frac {x}{2 \alpha^{*}} \right)^2 \right]^{-\frac {\nu_1 + 1}{2}}, & \mbox{if $x \leq 0$,} \\ \\ \displaystyle \frac {1 - \alpha}{1 - \alpha^{*}} K \left( \nu_2 \right) \left[ 1 + \frac {1}{\nu_2} \left( \frac {x}{2 \left( 1 - \alpha^{*} \right)} \right)^2 \right]^{-\frac {\nu_2 + 1}{2}}, & \mbox{if $x > 0$,} \end{array} \right. \\ &\displaystyle \displaystyle F (x) = 2 \alpha F_{\nu_1} \left( \frac {\min (x, 0)}{2 \alpha^{*}} \right) -1 + \alpha + 2 (1 - \alpha) F_{\nu_2} \left( \frac {\max (x, 0)}{2 - 2 \alpha^{*}} \right), \\ &\displaystyle \displaystyle {\rm VaR}_p (X) = 2 \alpha^{*} F_{\nu_1}^{-1} \left( \frac {\min (p, \alpha)}{2 \alpha} \right) + 2 \left( 1 - \alpha^{*} \right) F_{\nu_2}^{-1} \left( \frac {\max (p, \alpha) + 1 - 2 \alpha}{2 - 2 \alpha} \right), \\ &\displaystyle \displaystyle {\rm ES}_p (X) = \frac {2 \alpha^{*}}{p} \int_0^p F_{\nu_1}^{-1} \left( \frac {\min (v, \alpha)}{2 \alpha} \right) dv + \frac {2 \left( 1 - \alpha^{*} \right)}{p} \int_0^p F_{\nu_2}^{-1} \left( \frac {\max (v, \alpha) + 1 - 2 \alpha}{2 - 2 \alpha} \right) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, 0<α<10 < \alpha < 1, the scale parameter, ν1>0\nu_1 > 0, the first degree of freedom parameter, and ν2>0\nu_2 > 0, the second degree of freedom parameter, where α=αK(ν1)/{αK(ν1)+(1α)K(ν2)}\alpha^{*} = \alpha K \left( \nu_1 \right) / \left\{ \alpha K \left( \nu_1 \right) + (1 - \alpha) K \left( \nu_2 \right) \right\}, K(ν)=Γ((ν+1)/2)/[πνΓ(ν/2)]K (\nu) = \Gamma \left( (\nu + 1)/2 \right) / \left[ \sqrt{\pi \nu} \Gamma (\nu/2) \right], Fν()F_\nu(\cdot) denotes the cdf of a Student's tt random variable with ν\nu degrees of freedom, and Fν1()F_\nu^{-1} (\cdot) denotes the inverse of Fν()F_\nu(\cdot).

Usage

dast(x, nu1=1, nu2=1, alpha=0.5, log=FALSE)
past(x, nu1=1, nu2=1, alpha=0.5, log.p=FALSE, lower.tail=TRUE)
varast(p, nu1=1, nu2=1, alpha=0.5, log.p=FALSE, lower.tail=TRUE)
esast(p, nu1=1, nu2=1, alpha=0.5)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

alpha

the value of the scale parameter, must be in the unit interval, the default is 0.5

nu1

the value of the first degree of freedom parameter, must be positive, the default is 1

nu2

the value of the second degree of freedom parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dast(x)
past(x)
varast(x)
esast(x)

Asymmetric Laplace distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the asymmetric Laplace distribution due to Kotz et al. (2001) given by

f(x)={κ2τ(1+κ2)exp(κ2τxθ),if xθ,κ2τ(1+κ2)exp(2κτxθ),if x<θ,F(x)={111+κ2exp(κ2(θx)τ),if xθ,κ21+κ2exp(2(xθ)κτ),if x<θ,VaRp(X)={θτ2κlog[(1p)(1+κ2)],if pκ21+κ2,θ+κτ2log[p(1+κ2)],if p<κ21+κ2,ESp(X)={θp+θτ2κlog(1+κ2)+2τ(1+2κ2)2κ(1+κ2)plog(1+κ2)2τκlogκ(1+κ2)pθκ2(1+κ2)p+τ(1κ4)2κ(1+κ2)pτ(1p)2κp+τ(1p)2κplog(1p),if pκ21+κ2,θ+κτ2log(1+κ2)+κτ2(logp1),if p<κ21+κ2\begin{array}{ll} &\displaystyle \displaystyle f(x) = \left\{ \begin{array}{ll} \displaystyle \frac {\kappa \sqrt{2}}{\tau \left( 1 + \kappa^2 \right)} \exp \left( -\frac {\kappa \sqrt{2}}{\tau} \left | x - \theta \right | \right), & \mbox{if $x \geq \theta$,} \\ \\ \displaystyle \frac {\kappa \sqrt{2}}{\tau \left( 1 + \kappa^2 \right)} \exp \left( -\frac {\sqrt{2}}{\kappa \tau} \left | x - \theta \right | \right), & \mbox{if $x < \theta$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle 1 - \frac {1}{1 + \kappa^2} \exp \left( \frac {\kappa \sqrt{2} (\theta - x)}{\tau} \right), & \mbox{if $x \geq \theta$,} \\ \\ \displaystyle \frac {\kappa^2}{1 + \kappa^2} \exp \left( \frac {\sqrt{2} (x - \theta)}{\kappa \tau} \right), & \mbox{if $x < \theta$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \frac {\tau}{\sqrt{2} \kappa} \log \left[ (1 - p) \left( 1 + \kappa^2 \right) \right], & \mbox{if $p \geq \frac {\kappa^2}{1 + \kappa^2}$,} \\ \\ \displaystyle \theta + \frac {\kappa \tau}{\sqrt{2}} \log \left[ p \left( 1 + \kappa^{-2} \right) \right], & \mbox{if $p < \frac {\kappa^2}{1 + \kappa^2}$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \frac {\theta}{p} + \theta - \frac {\tau}{\sqrt{2} \kappa} \log \left( 1 + \kappa^2 \right) + \frac {\sqrt{2} \tau \left( 1 + 2 \kappa^2 \right)}{2 \kappa \left( 1 + \kappa^2 \right) p} \log \left( 1 + \kappa^2 \right) \\ \displaystyle \quad -\frac {\sqrt{2} \tau \kappa \log \kappa}{\left( 1 + \kappa^2 \right) p} - \frac {\theta \kappa^2}{\left( 1 + \kappa^2 \right) p} + \frac {\tau \left( 1 - \kappa^4 \right)}{\sqrt{2} \kappa \left( 1 + \kappa^2 \right) p} \\ \displaystyle \quad -\frac {\tau (1 - p)}{\sqrt{2} \kappa p} + \frac {\tau (1 - p)}{\sqrt{2} \kappa p} \log (1 - p), & \mbox{if $p \geq \frac {\kappa^2}{1 + \kappa^2}$,} \\ \\ \displaystyle \theta + \frac {\kappa \tau}{\sqrt{2}} \log \left( 1 + \kappa^{-2} \right) + \frac {\kappa \tau}{\sqrt{2}} (\log p - 1), & \mbox{if $p < \frac {\kappa^2}{1 + \kappa^2}$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <θ<-\infty < \theta < \infty, the location parameter, κ>0\kappa > 0, the first scale parameter, and τ>0\tau > 0, the second scale parameter.

Usage

dasylaplace(x, tau=1, kappa=1, theta=0, log=FALSE)
pasylaplace(x, tau=1, kappa=1, theta=0, log.p=FALSE, lower.tail=TRUE)
varasylaplace(p, tau=1, kappa=1, theta=0, log.p=FALSE, lower.tail=TRUE)
esasylaplace(p, tau=1, kappa=1, theta=0)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, can take any real value, the default is zero

kappa

the value of the first scale parameter, must be positive, the default is 1

tau

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dasylaplace(x)
pasylaplace(x)
varasylaplace(x)
esasylaplace(x)

Asymmetric power distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the asymmetric power distribution due to Komunjer (2007) given by

f(x)={δ1/λΓ(1+1/λ)exp[δaλxλ],if x0,δ1/λΓ(1+1/λ)exp[δ(1a)λxλ],if x>0,F(x)={aaI(δaλλxλ,1/λ),if x0,a(1a)I(δ(1a)λλxλ,1/λ),if x>0,VaRp(X)={[aλδλ]1/λ[I1(1pa,1λ)]1/λ,if pa,[(1a)λδλ]1/λ[I1(11p1a,1λ)]1/λ,if p>a,ESp(X)={1p[aλδλ]1/λ0p[I1(1va,1λ)]1/λdv,if pa,1p[aλδλ]1/λ0a[I1(1va,1λ)]1/λdv1p[(1a)λδλ]1/λap[I1(11v1a,1λ)]1/λdv,if p>a\begin{array}{ll} &\displaystyle f(x) = \left\{ \begin{array}{ll} \displaystyle \frac {\displaystyle \delta^{1 / \lambda}}{\displaystyle \Gamma (1 + 1 / \lambda)} \exp \left[ -\frac {\delta}{a^\lambda} |x|^\lambda \right], & \mbox{if $x \leq 0$}, \\ \\ \displaystyle \frac {\displaystyle \delta^{1 / \lambda}}{\displaystyle \Gamma (1 + 1 / \lambda)} \exp \left[ -\frac {\delta}{(1 - a)^\lambda} |x|^\lambda \right], & \mbox{if $x > 0$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle a - a {\cal I} \left( \frac {\delta}{a^\lambda} \sqrt{\lambda} |x|^\lambda, 1 / \lambda \right), & \mbox{if $x \leq 0$,} \\ \\ \displaystyle a - (1 - a) {\cal I} \left( \frac {\delta}{(1 - a)^\lambda} \sqrt{\lambda} |x|^\lambda, 1 / \lambda \right), & \mbox{if $x > 0$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle -\left[ \frac {a^\lambda}{\delta \sqrt{\lambda}} \right]^{1 / \lambda} \left[ {\cal I}^{-1} \left( 1 - \frac {p}{a}, \frac {1}{\lambda} \right) \right]^{1 / \lambda}, & \mbox{if $p \leq a$,} \\ \\ \displaystyle -\left[ \frac {(1 - a)^\lambda}{\delta \sqrt{\lambda}} \right]^{1 / \lambda} \left[ {\cal I}^{-1} \left( 1 - \frac {1 - p}{1 - a}, \frac {1}{\lambda} \right) \right]^{1 / \lambda}, & \mbox{if $p > a$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle -\frac {1}{p} \left[ \frac {a^\lambda}{\delta \sqrt{\lambda}} \right]^{1 / \lambda} \int_0^p \left[ {\cal I}^{-1} \left( 1 - \frac {v}{a}, \frac {1}{\lambda} \right) \right]^{1 / \lambda} dv, & \mbox{if $p \leq a$,} \\ \\ \displaystyle -\frac {1}{p} \left[ \frac {a^\lambda}{\delta \sqrt{\lambda}} \right]^{1 / \lambda} \int_0^a \left[ {\cal I}^{-1} \left( 1 - \frac {v}{a}, \frac {1}{\lambda} \right) \right]^{1 / \lambda} dv \\ \quad \displaystyle -\frac {1}{p} \left[ \frac {(1 - a)^\lambda}{\delta \sqrt{\lambda}} \right]^{1 / \lambda} \int_a^p \left[ {\cal I}^{-1} \left( 1 - \frac {1 - v}{1 - a}, \frac {1}{\lambda} \right) \right]^{1 / \lambda} dv, & \mbox{if $p > a$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, 0<a<10 < a < 1, the first scale parameter, δ>0\delta > 0, the second scale parameter, and λ>0\lambda > 0, the shape parameter, where I(x,γ)=1Γ(γ)0xγtγ1exp(t)dt{\cal I} (x, \gamma) = \frac {1}{\Gamma (\gamma)} \int_0^{x \sqrt{\gamma}} t^{\gamma - 1} \exp (-t) dt.

Usage

dasypower(x, a=0.5, lambda=1, delta=1, log=FALSE)
pasypower(x, a=0.5, lambda=1, delta=1, log.p=FALSE, lower.tail=TRUE)
varasypower(p, a=0.5, lambda=1, delta=1, log.p=FALSE, lower.tail=TRUE)
esasypower(p, a=0.5, lambda=1, delta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be in the unit interval, the default is 0.5

delta

the value of the second scale parameter, must be positive, the default is 1

lambda

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dasypower(x)
pasypower(x)
varasypower(x)
esasypower(x)

Beard distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Beard distribution due to Beard (1959) given by

f(x)=aexp(bx)[1+aρ]ρ1/b[1+aρexp(bx)]1+ρ1/b,F(x)=1[1+aρ]ρ1/b[1+aρexp(bx)]ρ1/b,VaRp(X)=1blog[1+aρaρ(1p)ρ1/b1aρ],ESp(X)=1pb0plog[1aρ+1+aρaρ(1v)ρ1/b]dv\begin{array}{ll} &\displaystyle f(x) = \frac {\displaystyle a \exp (b x) \left[ 1 + a \rho \right]^{\rho^{-1/b}}} {\displaystyle \left[ 1 + a \rho \exp (b x) \right]^{1 + \rho^{-1/b}}}, \\ &\displaystyle F (x) = 1 - \frac {\displaystyle \left[ 1 + a \rho \right]^{\rho^{-1/b}}} {\displaystyle \left[ 1 + a \rho \exp (b x) \right]^{\rho^{-1/b}}}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{b} \log \left[ \frac {1 + a \rho}{a \rho (1 - p)^{\rho^{1 / b}}} - \frac {1}{a \rho} \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p b} \int_0^p \log \left[ -\frac {1}{a \rho} + \frac {1 + a \rho}{a \rho (1 - v)^{\rho^{1 / b}}} \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first scale parameter, b>0b > 0, the second scale parameter, and ρ>0\rho > 0, the shape parameter.

Usage

dbeard(x, a=1, b=1, rho=1, log=FALSE)
pbeard(x, a=1, b=1, rho=1, log.p=FALSE, lower.tail=TRUE)
varbeard(p, a=1, b=1, rho=1, log.p=FALSE, lower.tail=TRUE)
esbeard(p, a=1, b=1, rho=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

b

the value of the second scale parameter, must be positive, the default is 1

rho

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbeard(x)
pbeard(x)
varbeard(x)
esbeard(x)

Beta Burr distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Burr distribution due to Parana\'iba et al. (2011) given by

f(x)=babdB(c,d)xbd+1[1+(x/a)b]cd,F(x)=I11+(x/a)b(c,d),VaRp(X)=a[Ip1(c,d)]1/b[1Ip1(c,d)]1/b,ESp(X)=ap0p[Iv1(c,d)]1/b[1Iv1(c,d)]1/bdv\begin{array}{ll} &\displaystyle f (x) = \frac {b a^{bd}}{B (c, d)x^{bd + 1}} \left[ 1 + \left( x / a \right)^{-b} \right]^{-c - d}, \\ &\displaystyle F (x) = I_{\frac {1}{1 + \left( x / a \right)^{-b}}} (c, d), \\ &\displaystyle {\rm VaR}_p (X) = a \left[ I_p^{-1} (c, d) \right]^{1 / b} \left[ 1 - I_p^{-1} (c, d) \right]^{-1 / b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {a}{p} \int_0^p \left[ I_v^{-1} (c, d) \right]^{1 / b} \left[ 1 - I_v^{-1} (c, d) \right]^{-1 / b} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the scale parameter, b>0b > 0, the first shape parameter, c>0c > 0, the second shape parameter, and d>0d > 0, the third shape parameter, where Ix(a,b)=0xta1(1t)b1dt/B(a,b)I_x (a, b) = \int_0^x t^{a - 1} (1 - t)^{b - 1} dt / B (a, b) denotes the incomplete beta function ratio, B(a,b)=01ta1(1t)b1dtB (a, b) = \int_0^1 t^{a - 1} (1 - t)^{b - 1} dt denotes the beta function, and Ix1(a,b)I_x^{-1} (a, b) denotes the inverse function of Ix(a,b)I_x (a, b).

Usage

dbetaburr(x, a=1, b=1, c=1, d=1, log=FALSE)
pbetaburr(x, a=1, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
varbetaburr(p, a=1, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
esbetaburr(p, a=1, b=1, c=1, d=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the scale parameter, must be positive, the default is 1

b

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

d

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetaburr(x)
pbetaburr(x)
varbetaburr(x)
esbetaburr(x)

Beta Burr XII distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Burr XII distribution given by

f(x)=kcxc1B(a,b)[1(1+xc)k]a1(1+xc)bk1,F(x)=I1(1+xc)k(a,b),VaRp(X)={[1Ip1(a,b)]1/k1}1/c,ESp(X)=1p0p{[1Iv1(a,b)]1/k1}1/cdv\begin{array}{ll} &\displaystyle f (x) = \frac {k c x^{c - 1}}{B (a, b)} \left[ 1 - \left( 1 + x^c \right)^{-k} \right]^{a - 1} \left( 1 + x^c \right)^{-b k - 1}, \\ &\displaystyle F (x) = I_{1 - \left( 1 + x^c \right)^{-k}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \left[ 1 - I_p^{-1} (a, b) \right]^{-1 / k} - 1 \right\}^{1/c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left\{ \left[ 1 - I_v^{-1} (a, b) \right]^{-1 / k} - 1 \right\}^{1/c} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, c>0c > 0, the third shape parameter, and k>0k > 0, the fourth shape parameter.

Usage

dbetaburr7(x, a=1, b=1, c=1, k=1, log=FALSE)
pbetaburr7(x, a=1, b=1, c=1, k=1, log.p=FALSE, lower.tail=TRUE)
varbetaburr7(p, a=1, b=1, c=1, k=1, log.p=FALSE, lower.tail=TRUE)
esbetaburr7(p, a=1, b=1, c=1, k=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

c

the value of the third shape parameter, must be positive, the default is 1

k

the value of the fourth shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetaburr7(x)
pbetaburr7(x)
varbetaburr7(x)
esbetaburr7(x)

Beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta distribution given by

f(x)=xa1(1x)b1B(a,b),F(x)=Ix(a,b),VaRp(X)=Ip1(a,b),ESp(X)=1p0pIv1(a,b)dv\begin{array}{ll} &\displaystyle f (x) = \frac {x^{a - 1} (1 - x)^{b - 1}}{B (a, b)}, \\ &\displaystyle F (x) = I_x (a, b), \\ &\displaystyle {\rm VaR}_p (X) = I_p^{-1} (a, b), \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p I_v^{-1} (a, b) dv \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, a>0a > 0, the first parameter, and b>0b > 0, the second shape parameter.

Usage

dbetadist(x, a=1, b=1, log=FALSE)
pbetadist(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varbetadist(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esbetadist(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

b

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetadist(x)
pbetadist(x)
varbetadist(x)
esbetadist(x)

Beta exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta exponential distribution due to Nadarajah and Kotz (2006) given by

f(x)=λexp(bλx)B(a,b)[1exp(λx)]a1,F(x)=I1exp(λx)(a,b),VaRp(X)=1λlog[1Ip1(a,b)],ESp(X)=1pλ0plog[1Iv1(a,b)]dv\begin{array}{ll} &\displaystyle f (x) = \frac {\lambda \exp (-b \lambda x)}{B (a, b)} \left[ 1 - \exp (-\lambda x) \right]^{a - 1}, \\ &\displaystyle F (x) = I_{1 - \exp (-\lambda x)} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{\lambda} \log \left[ 1 - I_p^{-1} (a, b) \right], \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{p \lambda} \int_0^p \log \left[ 1 - I_v^{-1} (a, b) \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, and λ>0\lambda > 0, the scale parameter, where Ix(a,b)=0xta1(1t)b1dt/B(a,b)I_x (a, b) = \int_0^x t^{a - 1} (1 - t)^{b - 1} dt / B (a, b) denotes the incomplete beta function ratio, B(a,b)=01ta1(1t)b1dtB (a, b) = \int_0^1 t^{a - 1} (1 - t)^{b - 1} dt denotes the beta function, and Ix1(a,b)I_x^{-1} (a, b) denotes the inverse function of Ix(a,b)I_x (a, b).

Usage

dbetaexp(x, lambda=1, a=1, b=1, log=FALSE)
pbetaexp(x, lambda=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varbetaexp(p, lambda=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esbetaexp(p, lambda=1, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetaexp(x)
pbetaexp(x)
varbetaexp(x)
esbetaexp(x)

Beta Frechet distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Fr\'echet distribution due to Barreto-Souza et al. (2011) given by

f(x)=ασαxα+1B(a,b)exp{a(σx)α}[1exp{(σx)α}]b1,F(x)=Iexp{(σx)α}(a,b),VaRp(X)=σ[logIp1(a,b)]1/α,ESp(X)=σp0p[logIv1(a,b)]1/αdv\begin{array}{ll} &\displaystyle f (x) = \frac {\alpha \sigma^\alpha}{x^{\alpha + 1} B (a, b)} \exp \left\{ -a \left( \frac {\sigma}{x} \right)^{\alpha} \right\} \left[ 1 - \exp \left\{ -\left( \frac {\sigma}{x} \right)^{\alpha} \right\} \right]^{b - 1}, \\ &\displaystyle F (x) = I_{\exp \left\{ -\left( \frac {\sigma}{x} \right)^{\alpha} \right\}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \sigma \left[ -\log I_p^{-1} (a, b) \right]^{-1 / \alpha}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \left[ -\log I_v^{-1} (a, b) \right]^{-1 / \alpha} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, σ>0\sigma > 0, the scale parameter, b>0b > 0, the second shape parameter, and α>0\alpha > 0, the third shape parameter.

Usage

dbetafrechet(x, a=1, b=1, alpha=1, sigma=1, log=FALSE)
pbetafrechet(x, a=1, b=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varbetafrechet(p, a=1, b=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
esbetafrechet(p, a=1, b=1, alpha=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

alpha

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetafrechet(x)
pbetafrechet(x)
varbetafrechet(x)
esbetafrechet(x)

Beta Gompertz distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Gompertz distribution due to Cordeiro et al. (2012b) given by

f(x)=bηexp(bx)B(c,d)exp(dη)exp[dηexp(bx)]{1exp[ηηexp(bx)]}c1,F(x)=I1exp[ηηexp(bx)](c,d),VaRp(X)=1blog{11ηlog[1Ip1(c,d)]},ESp(X)=1pb0plog{11ηlog[1Iv1(c,d)]}dv\begin{array}{ll} &\displaystyle f(x) = \frac {b \eta \exp (bx)}{B (c, d)} \exp \left( d \eta \right) \exp \left[ -d \eta \exp (bx) \right] \left\{ 1 - \exp \left[ \eta - \eta \exp (bx) \right] \right\}^{c - 1}, \\ &\displaystyle F(x) = I_{1 - \exp \left[ \eta - \eta \exp (bx) \right]} (c, d), \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{b} \log \left\{ 1 - \frac {1}{\eta} \log \left[ 1 - I_p^{-1} (c, d) \right] \right\}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p b} \int_0^p \log \left\{ 1 - \frac {1}{\eta} \log \left[ 1 - I_v^{-1} (c, d) \right] \right\} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, b>0b > 0, the first scale parameter, η>0\eta > 0, the second scale parameter, c>0c > 0, the first shape parameter, and d>0d > 0, the second shape parameter.

Usage

dbetagompertz(x, b=1, c=1, d=1, eta=1, log=FALSE)
pbetagompertz(x, b=1, c=1, d=1, eta=1, log.p=FALSE, lower.tail=TRUE)
varbetagompertz(p, b=1, c=1, d=1, eta=1, log.p=FALSE, lower.tail=TRUE)
esbetagompertz(p, b=1, c=1, d=1, eta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the first scale parameter, must be positive, the default is 1

eta

the value of the second scale parameter, must be positive, the default is 1

c

the value of the first shape parameter, must be positive, the default is 1

d

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetagompertz(x)
pbetagompertz(x)
varbetagompertz(x)
esbetagompertz(x)

Beta Gumbel distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Gumbel distribution due to Nadarajah and Kotz (2004) given by

f(x)=1σB(a,b)exp(μxσ)exp[aexpμxσ]{1exp[expμxσ]}b1,F(x)=Iexp[expμxσ](a,b),VaRp(X)=μσlog[logIp1(a,b)],ESp(X)=μσp0plog[logIv1(a,b)]dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma B (a, b)} \exp \left( \frac {\mu - x}{\sigma} \right) \exp \left[ -a \exp \frac {\mu - x}{\sigma} \right] \left\{ 1 - \exp \left[ -\exp \frac {\mu - x}{\sigma} \right] \right\}^{b - 1}, \\ &\displaystyle F (x) = I_{\exp \left[ -\exp \frac {\mu - x}{\sigma} \right]} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \mu - \sigma \log \left[ -\log I_p^{-1} (a, b) \right], \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{p} \int_0^p \log \left[ -\log I_v^{-1} (a, b) \right] dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dbetagumbel(x, a=1, b=1, mu=0, sigma=1, log=FALSE)
pbetagumbel(x, a=1, b=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varbetagumbel(p, a=1, b=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esbetagumbel(p, a=1, b=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetagumbel(x)
pbetagumbel(x)
varbetagumbel(x)
esbetagumbel(x)

Beta Gumbel 2 distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Gumbel II distribution given by

f(x)=abxa1B(c,d)exp(bdxa)[1exp(bxa)]c1,F(x)=I1exp(bxa)(c,d),VaRp(X)=b1/a{log[1Ip1(c,d)]}1/a,ESp(X)=b1/ap0p{log[1Iv1(c,d)]}1/adv\begin{array}{ll} &\displaystyle f (x) = \frac {a b x^{-a - 1}}{B (c, d)} \exp \left( -b d x^{-a} \right) \left[ 1 - \exp \left( -b x^{-a} \right) \right]^{c - 1}, \\ &\displaystyle F (x) = I_{1 - \exp \left( -b x^{-a} \right)} (c, d), \\ &\displaystyle {\rm VaR}_p (X) = b^{1 / a} \left\{ -\log \left[ 1 - I_p^{-1} (c, d) \right] \right\}^{-1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {b^{1 / a}}{p} \int_0^p \left\{ -\log \left[ 1 - I_v^{-1} (c, d) \right] \right\}^{-1 / a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the scale parameter, c>0c > 0, the second shape parameter, and d>0d > 0, the third shape parameter.

Usage

dbetagumbel2(x, a=1, b=1, c=1, d=1, log=FALSE)
pbetagumbel2(x, a=1, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
varbetagumbel2(p, a=1, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
esbetagumbel2(p, a=1, b=1, c=1, d=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

d

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetagumbel2(x)
pbetagumbel2(x)
varbetagumbel2(x)
esbetagumbel2(x, a = 2)

Beta lognormal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta lognormal distribution due to Castellares et al. (2013) given by

f(x)=1σxB(a,b)ϕ(logxμσ)Φa1(logxμσ)Φb1(μlogxσ),F(x)=IΦ(logxμσ)(a,b),VaRp(X)=exp[μ+σΦ1(Ip1(a,b))],ESp(X)=exp(μ)p0pexp[σΦ1(Iv1(a,b))]dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma x B (a, b)} \phi \left( \frac {\log x - \mu}{\sigma} \right) \Phi^{a - 1} \left( \frac {\log x - \mu}{\sigma} \right) \Phi^{b - 1} \left( \frac {\mu - \log x}{\sigma} \right), \\ &\displaystyle F (x) = I_{\Phi \left( \frac {\log x - \mu}{\sigma} \right)} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \exp \left[ \mu + \sigma \Phi^{-1} \left( I_p^{-1} (a, b) \right) \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {\exp (\mu)}{p} \int_0^p \exp \left[ \sigma \Phi^{-1} \left( I_v^{-1} (a, b) \right) \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter, where ϕ()\phi (\cdot) denotes the pdf of a standard normal random variable, and Φ()\Phi (\cdot) denotes the cdf of a standard normal random variable.

Usage

dbetalognorm(x, a=1, b=1, mu=0, sigma=1, log=FALSE)
pbetalognorm(x, a=1, b=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varbetalognorm(p, a=1, b=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esbetalognorm(p, a=1, b=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetalognorm(x)
pbetalognorm(x)
varbetalognorm(x)
esbetalognorm(x)

Beta Lomax distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Lomax distribution due to Lemonte and Cordeiro (2013) given by

f(x)=αλB(a,b)(1+xλ)bα1[1(1+xλ)α]a1,F(x)=I1(1+xλ)α(a,b),VaRp(X)=λ[1Ip1(a,b)]1/αλ,ESp(X)=λp0p[1Iv1(a,b)]1/αdvλ\begin{array}{ll} &\displaystyle f (x) = \frac {\alpha}{\lambda B (a, b)} \left( 1 + \frac {x}{\lambda} \right)^{-b \alpha - 1} \left[ 1 - \left( 1 + \frac {x}{\lambda} \right)^{-\alpha} \right]^{a - 1}, \\ &\displaystyle F (x) = I_{1 - \left( 1 + \frac {x}{\lambda} \right)^{-\alpha}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \lambda \left[ 1 - I_p^{-1} (a, b) \right]^{-1 / \alpha} - \lambda, \\ &\displaystyle {\rm ES}_p (X) = \frac {\lambda}{p} \int_0^p \left[ 1 - I_v^{-1} (a, b) \right]^{-1 / \alpha} dv - \lambda \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, α>0\alpha > 0, the third shape parameter, and λ>0\lambda > 0, the scale parameter.

Usage

dbetalomax(x, a=1, b=1, alpha=1, lambda=1, log=FALSE)
pbetalomax(x, a=1, b=1, alpha=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varbetalomax(p, a=1, b=1, alpha=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
esbetalomax(p, a=1, b=1, alpha=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the first scale parameter, must be positive, the default is 1

b

the value of the second scale parameter, must be positive, the default is 1

alpha

the value of the third scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetalomax(x)
pbetalomax(x)
varbetalomax(x)
esbetalomax(x)

Beta normal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta normal distribution due to Eugene et al. (2002) given by

f(x)=1σB(a,b)ϕ(xμσ)Φa1(xμσ)Φb1(μxσ),F(x)=IΦ(xμσ)(a,b),VaRp(X)=μ+σΦ1(Ip1(a,b)),ESp(X)=μ+σp0pΦ1(Iv1(a,b))dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma B (a, b)} \phi \left( \frac {x - \mu}{\sigma} \right) \Phi^{a - 1} \left( \frac {x - \mu}{\sigma} \right) \Phi^{b - 1} \left( \frac {\mu - x}{\sigma} \right), \\ &\displaystyle F (x) = I_{\Phi \left( \frac {x - \mu}{\sigma} \right)} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \mu + \sigma \Phi^{-1} \left( I_p^{-1} (a, b) \right), \\ &\displaystyle {\rm ES}_p (X) = \mu + \frac {\sigma}{p} \int_0^p \Phi^{-1} \left( I_v^{-1} (a, b) \right) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dbetanorm(x, mu=0, sigma=1, a=1, b=1, log=FALSE)
pbetanorm(x, mu=0, sigma=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varbetanorm(p, mu=0, sigma=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esbetanorm(p, mu=0, sigma=1, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetanorm(x)
pbetanorm(x)
varbetanorm(x)
esbetanorm(x)

Beta Pareto distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Pareto distribution due to Akinsete et al. (2008) given by

f(x)=aKadxad1B(c,d)[1(Kx)a]c1,F(x)=I1(Kx)a(c,d),VaRp(X)=K[1Ip1(c,d)]1/a,ESp(X)=Kp0p[1Iv1(c,d)]1/adv\begin{array}{ll} &\displaystyle f (x) = \frac {a K^{ad} x^{-ad - 1}}{B (c, d)} \left[ 1 - \left( \frac {K}{x} \right)^a \right]^{c - 1}, \\ &\displaystyle F (x) = I_{1 - \left( \frac {K}{x} \right)^a} (c, d), \\ &\displaystyle {\rm VaR}_p (X) = K \left[ 1 - I_p^{-1} (c, d) \right]^{-1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {K}{p} \int_0^p \left[ 1 - I_v^{-1} (c, d) \right]^{-1 / a} dv \end{array}

for xKx \geq K, 0<p<10 < p < 1, K>0K > 0, the scale parameter, a>0a > 0, the first shape parameter, c>0c > 0, the second shape parameter, and d>0d > 0, the third shape parameter.

Usage

dbetapareto(x, K=1, a=1, c=1, d=1, log=FALSE)
pbetapareto(x, K=1, a=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
varbetapareto(p, K=1, a=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
esbetapareto(p, K=1, a=1, c=1, d=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

K

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

d

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetapareto(x)
pbetapareto(x)
varbetapareto(x)
esbetapareto(x)

Beta Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the beta Weibull distribution due to Cordeiro et al. (2012b) given by

f(x)=αxα1σαB(a,b)exp{b(xσ)α}[1exp{(xσ)α}]a1,F(x)=I1exp{(xσ)α}(a,b),VaRp(X)=σ{log[1Ip1(a,b)]}1/α,ESp(X)=σp0p{log[1Iv1(a,b)]}1/αdv\begin{array}{ll} &\displaystyle f(x) = \frac {\alpha x^{\alpha - 1}}{\sigma^\alpha B (a, b)} \exp \left\{ -b \left( \frac {x}{\sigma} \right)^{\alpha} \right\} \left[ 1 - \exp \left\{ -\left( \frac {x}{\sigma} \right)^{\alpha} \right\} \right]^{a - 1}, \\ &\displaystyle F(x) = I_{1 - \exp \left\{ -\left( \frac {x}{\sigma} \right)^{\alpha} \right\}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \sigma \left\{ -\log \left[ 1 - I_p^{-1} (a, b) \right] \right\}^{1 / \alpha}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \left\{ -\log \left[ 1 - I_v^{-1} (a, b) \right] \right\}^{1 / \alpha} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, α>0\alpha > 0, the third shape parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dbetaweibull(x, a=1, b=1, alpha=1, sigma=1, log=FALSE)
pbetaweibull(x, a=1, b=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varbetaweibull(p, a=1, b=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
esbetaweibull(p, a=1, b=1, alpha=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

alpha

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dbetaweibull(x)
pbetaweibull(x)
varbetaweibull(x)
esbetaweibull(x)

Birnbaum-Saunders distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Birnbaum-Saunders distribution due to Birnbaum and Saunders (1969a, 1969b) given by

f(x)=x1/2+x1/22γxϕ(x1/2x1/2γ),F(x)=Φ(x1/2x1/2γ),VaRp(X)=14{γΦ1(p)+4+γ2[Φ1(p)]2}2,ESp(X)=14p0p{γΦ1(v)+4+γ2[Φ1(v)]2}2dv\begin{array}{ll} &\displaystyle f(x) = \frac {x^{1/2} + x^{-1/2}}{2 \gamma x} \phi \left( \frac {x^{1/2} - x^{-1/2}}{\gamma} \right), \\ &\displaystyle F (x) = \Phi \left( \frac {x^{1/2} - x^{-1/2}}{\gamma} \right), \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{4} \left\{ \gamma \Phi^{-1} (p) + \sqrt{4 + \gamma^2 \left[ \Phi^{-1} (p) \right]^2} \right\}^2, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{4 p} \int_0^p \left\{ \gamma \Phi^{-1} (v) + \sqrt{4 + \gamma^2 \left[ \Phi^{-1} (v) \right]^2} \right\}^2 dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, and γ>0\gamma > 0, the scale parameter.

Usage

dBS(x, gamma=1, log=FALSE)
pBS(x, gamma=1, log.p=FALSE, lower.tail=TRUE)
varBS(p, gamma=1, log.p=FALSE, lower.tail=TRUE)
esBS(p, gamma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

gamma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dBS(x)
pBS(x)
varBS(x)
esBS(x)

Burr distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Burr distribution due to Burr (1942) given by

f(x)=babxb+1[1+(x/a)b]2,F(x)=11+(x/a)b,VaRp(X)=ap1/b(1p)1/b,ESp(X)=apBp(1/b+1,11/b)\begin{array}{ll} &\displaystyle f (x) = \frac {b a^b}{x^{b + 1}} \left[ 1 + \left( x / a \right)^{-b} \right]^{-2}, \\ &\displaystyle F (x) = \frac {1}{1 + \left( x / a \right)^{-b}}, \\ &\displaystyle {\rm VaR}_p (X) = a p^{1 / b} (1 - p)^{-1 / b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {a}{p} B_p \left( 1 / b + 1, 1 - 1 / b \right) \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the scale parameter, and b>0b > 0, the shape parameter, where Bx(a,b)=0xta1(1t)b1dtB_x (a, b) = \int_0^x t^{a - 1} (1 - t)^{b - 1} dt denotes the incomplete beta function.

Usage

dburr(x, a=1, b=1, log=FALSE)
pburr(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varburr(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esburr(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the scale parameter, must be positive, the default is 1

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dburr(x)
pburr(x)
varburr(x)
esburr(x)

Burr XII distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Burr XII distribution due to Burr (1942) given by

f(x)=kcxc1(1+xc)k+1,F(x)=1(1+xc)k,VaRp(X)=[(1p)1/k1]1/c,ESp(X)=1p0p[(1v)1/k1]1/cdv\begin{array}{ll} &\displaystyle f (x) = \frac {k c x^{c - 1}}{\left( 1 + x^c \right)^{k + 1}}, \\ &\displaystyle F (x) = 1 - \left( 1 + x^c \right)^{-k}, \\ &\displaystyle {\rm VaR}_p (X) = \left[ (1 - p)^{-1 / k} - 1 \right]^{1/c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left[ (1 - v)^{-1 / k} - 1 \right]^{1/c} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, c>0c > 0, the first shape parameter, and k>0k > 0, the second shape parameter.

Usage

dburr7(x, k=1, c=1, log=FALSE)
pburr7(x, k=1, c=1, log.p=FALSE, lower.tail=TRUE)
varburr7(p, k=1, c=1, log.p=FALSE, lower.tail=TRUE)
esburr7(p, k=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

k

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dburr7(x)
pburr7(x)
varburr7(x)
esburr7(x)

Cauchy distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Cauchy distribution given by

f(x)=1πσ(xμ)2+σ2,F(x)=12+1πarctan(xμσ),VaRp(X)=μ+σtan(π(p12)),ESp(X)=μ+σp0ptan(π(v12))dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\pi} \frac {\sigma}{(x - \mu)^2 + \sigma^2}, \\ &\displaystyle F (x) = \frac {1}{2} + \frac {1}{\pi} \arctan \left( \frac {x - \mu}{\sigma} \right), \\ &\displaystyle {\rm VaR}_p (X) = \mu + \sigma \tan \left( \pi \left( p - \frac {1}{2} \right) \right), \\ &\displaystyle {\rm ES}_p (X) = \mu + \frac {\sigma}{p} \int_0^p \tan \left( \pi \left( v - \frac {1}{2} \right) \right) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dCauchy(x, mu=0, sigma=1, log=FALSE)
pCauchy(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varCauchy(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esCauchy(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dCauchy(x)
pCauchy(x)
varCauchy(x)
esCauchy(x)

Chen distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Chen distribution due to Chen (2000) given by

f(x)=λbxb1exp(xb)exp[λλexp(xb)],F(x)=1exp[λλexp(xb)],VaRp(X)={log[1log(1p)λ]}1/b,ESp(X)=1p0p{log[1log(1v)λ]}1/bdv\begin{array}{ll} &\displaystyle f(x) = \lambda b x^{b - 1} \exp \left( x^b \right) \exp \left[ \lambda - \lambda \exp \left( x^b \right) \right], \\ &\displaystyle F (x) = 1 - \exp \left[ \lambda - \lambda \exp \left( x^b \right) \right], \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \log \left[ 1 - \frac {\log (1 - p)}{\lambda} \right] \right\}^{1 / b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left\{ \log \left[ 1 - \frac {\log (1 - v)}{\lambda} \right] \right\}^{1 / b} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, b>0b > 0, the shape parameter, and λ>0\lambda > 0, the scale parameter.

Usage

dchen(x, b=1, lambda=1, log=FALSE)
pchen(x, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varchen(p, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
eschen(p, b=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dchen(x)
pchen(x)
varchen(x)
eschen(x)

Compound Laplace gamma distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the compound Laplace gamma distribution given by

f(x)=ab2{1+bxθ}(a+1),F(x)={12{1+bxθ}a,if xθ,112{1+bxθ}a,if x>θ,VaRp(X)={θ1b(2p)1/ab,if p1/2,θ1b+(2(1p))1/ab,if p>1/2,ESp(X)={θ1b(2p)1/ab(11/a),if p1/2,θ1b[2(1p)]11/a2pb(11/a),if p>1/2\begin{array}{ll} &\displaystyle f (x) = \frac {a b}{2} \left\{ 1 + b \left | x - \theta \right | \right\}^{-\left( a + 1 \right)}, \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2} \left\{ 1 + b \left | x - \theta \right | \right\}^{-a}, & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle 1 - \frac {1}{2} \left\{ 1 + b \left | x - \theta \right | \right\}^{-a}, & \mbox{if $x > \theta$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \frac {1}{b} - \frac {(2 p)^{-1/a}}{b}, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \theta - \frac {1}{b} + \frac {(2 (1 - p))^{-1/a}}{b}, & \mbox{if $p > 1/2$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \frac {1}{b} - \frac {(2 p)^{-1/a}}{b (1 - 1/a)}, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \theta - \frac {1}{b} - \frac {\left[ 2 (1 - p) \right]^{1 - 1/a}}{2 p b (1 - 1/a)}, & \mbox{if $p > 1/2$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <θ<-\infty < \theta < \infty, the location parameter, b>0b > 0, the scale parameter, and a>0a > 0, the shape parameter.

Usage

dclg(x, a=1, b=1, theta=0, log=FALSE)
pclg(x, a=1, b=1, theta=0, log.p=FALSE, lower.tail=TRUE)
varclg(p, a=1, b=1, theta=0, log.p=FALSE, lower.tail=TRUE)
esclg(p, a=1, b=1, theta=0)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, can take any real value, the default is zero

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dclg(x)
pclg(x)
varclg(x)
esclg(x)

Complementary beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the complementary beta distribution due to Jones (2002) given by

f(x)=B(a,b){Ix1(a,b)}1a{1Ix1(a,b)}1b,F(x)=Ix1(a,b),VaRp(X)=Ip(a,b),ESp(X)=1p0pIv(a,b)dv\begin{array}{ll} &\displaystyle f (x) = B (a, b) \left\{ I_x^{-1} (a, b) \right\}^{1 - a} \left\{ 1 - I_x^{-1} (a, b) \right\}^{1 - b}, \\ &\displaystyle F (x) = I_x^{-1} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = I_p (a, b), \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p I_v (a, b) dv \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dcompbeta(x, a=1, b=1, log=FALSE)
pcompbeta(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varcompbeta(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
escompbeta(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dcompbeta(x)
pcompbeta(x)
varcompbeta(x)
escompbeta(x)

Dagum distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Dagum distribution due to Dagum (1975, 1977, 1980) given by

f(x)=acbaxac1[xa+ba]c+1,F(x)=[1+(bx)a]c,VaRp(X)=b(1p1/c)1/a,ESp(X)=bp0p(1v1/c)1/adv\begin{array}{ll} &\displaystyle f (x) = \frac {a c b^a x^{a c - 1}}{\left[ x^a + b^a \right]^{c + 1}}, \\ &\displaystyle F (x) = \left[ 1 + \left( \frac {b}{x} \right)^a \right]^{-c}, \\ &\displaystyle {\rm VaR}_p (X) = b \left( 1- p^{-1 / c} \right)^{-1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {b}{p} \int_0^p \left( 1 - v^{-1 / c} \right)^{-1 / a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the scale parameter, and c>0c > 0, the second shape parameter.

Usage

ddagum(x, a=1, b=1, c=1, log=FALSE)
pdagum(x, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
vardagum(p, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
esdagum(p, a=1, b=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
ddagum(x)
pdagum(x)
vardagum(x)
esdagum(x)

Double Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the double Weibull distribution due to Balakrishnan and Kocherlakota (1985) given by

f(x)=c2σxμσc1exp{xμσc},F(x)={12exp{(μxσ)c},if xμ,112exp{(xμσ)c},if x>μ,VaRp(X)={μσ[log(2p)]1/c,if p1/2,μ+σ[log(2(1p))]1/c,if p>1/2,ESp(X)={μσp0p[log2logv]1/cdv,if p1/2,μσp01/2[log2logv]1/cdv+σp1/2p[log2log(1v)]1/cdv,if p>1/2\begin{array}{ll} &\displaystyle f(x) = \frac {c}{\displaystyle 2 \sigma} \left | \frac {x - \mu}{\sigma} \right |^{c - 1} \exp \left\{ -\left | \frac {x - \mu}{\sigma} \right |^c \right\}, \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2} \exp \left\{ -\left( \frac {\mu - x}{\sigma} \right)^c \right\}, & \mbox{if $x \leq \mu$,} \\ \\ \displaystyle 1 - \frac {1}{2} \exp \left\{ -\left( \frac {x - \mu}{\sigma} \right)^c \right\}, & \mbox{if $x > \mu$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \mu - \sigma \left[ -\log \left( 2 p \right) \right]^{1 / c}, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \mu + \sigma \left[ -\log \left( 2 (1 - p) \right) \right]^{1 / c}, & \mbox{if $p > 1/2$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \mu - \frac {\sigma}{p} \int_0^p \left[ -\log 2 - \log v \right]^{1 / c} dv, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \mu - \frac {\sigma}{p} \int_0^{1/2} \left[ -\log 2 - \log v \right]^{1 / c} dv \\ \quad \displaystyle + \frac {\sigma}{p} \int_{1/2}^p \left[ -\log 2 - \log (1 - v) \right]^{1 / c} dv, & \mbox{if $p > 1/2$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, and c>0c > 0, the shape parameter.

Usage

ddweibull(x, c=1, mu=0, sigma=1, log=FALSE)
pdweibull(x, c=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
vardweibull(p, c=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esdweibull(p, c=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

c

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
ddweibull(x)
pdweibull(x)
vardweibull(x)
esdweibull(x)

Exponentiated exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponentiated exponential distribution due to Gupta and Kundu (1999, 2001) given by

f(x)=aλexp(λx)[1exp(λx)]a1,F(x)=[1exp(λx)]a,VaRp(X)=1λlog(1p1/a),ESp(X)=1pλ0plog(1v1/a)dv\begin{array}{ll} &\displaystyle f (x) = a \lambda \exp (-\lambda x) \left[ 1 - \exp (-\lambda x) \right]^{a - 1}, \\ &\displaystyle F (x) = \left[ 1 - \exp (-\lambda x) \right]^{a}, \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{\lambda} \log \left( 1 - p^{1 / a} \right), \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{p \lambda} \int_0^p \log \left( 1 - v^{1 / a} \right) dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter and λ>0\lambda > 0, the scale parameter.

Usage

dexpexp(x, lambda=1, a=1, log=FALSE)
pexpexp(x, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
varexpexp(p, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
esexpexp(p, lambda=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexpexp(x)
pexpexp(x)
varexpexp(x)
esexpexp(x)

Exponential extension distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponential extension distribution due to Nadarajah and Haghighi (2011) given by

f(x)=aλ(1+λx)a1exp[1(1+λx)a],F(x)=1exp[1(1+λx)a],VaRp(X)=[1log(1p)]1/a1λ,ESp(X)=1λ+1λp0p[1log(1v)]1/adv\begin{array}{ll} &\displaystyle f (x) = a \lambda (1 + \lambda x)^{a - 1} \exp \left[ 1 - (1 + \lambda x)^a \right], \\ &\displaystyle F (x) = 1 - \exp \left[ 1 - (1 + \lambda x)^a \right], \\ &\displaystyle {\rm VaR}_p (X) = \frac {\left[ 1 - \log (1 - p) \right]^{1 / a} - 1}{\lambda}, \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{\lambda} + \frac {1}{\lambda p} \int_0^p \left[ 1 - \log (1 - v) \right]^{1 / a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter and λ>0\lambda > 0, the scale parameter.

Usage

dexpext(x, lambda=1, a=1, log=FALSE)
pexpext(x, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
varexpext(p, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
esexpext(p, lambda=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexpext(x)
pexpext(x)
varexpext(x)
esexpext(x)

Exponential geometric distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponential geometric distribution due to Adamidis and Loukas (1998) given by

f(x)=λθexp(λx)[1(1θ)exp(λx)]2,F(x)=θexp(λx)1(1θ)exp(λx),VaRp(X)=1λlogpθ+(1θ)p,ESp(X)=logpλθlogθλp(1θ)+θ+(1θ)pλp(1θ)log[θ+(1θ)p]\begin{array}{ll} &\displaystyle f(x) = \frac {\lambda \theta \exp (-\lambda x)}{\left[ 1 - (1 - \theta) \exp (-\lambda x) \right]^2}, \\ &\displaystyle F (x) = \frac {\theta \exp (-\lambda x)}{1 - (1 - \theta) \exp (-\lambda x)}, \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{\lambda} \log \frac {p}{\theta + (1 - \theta) p}, \\ &\displaystyle {\rm ES}_p (X) = -\frac {\log p}{\lambda} - \frac {\theta \log \theta}{\lambda p (1 - \theta)} + \frac {\theta + (1 - \theta) p}{\lambda p (1 - \theta)} \log \left[ \theta + (1 - \theta) p \right] \end{array}

for x>0x > 0, 0<p<10 < p < 1, 0<θ<10 < \theta < 1, the first scale parameter, and λ>0\lambda > 0, the second scale parameter.

Usage

dexpgeo(x, theta=0.5, lambda=1, log=FALSE)
pexpgeo(x, theta=0.5, lambda=1, log.p=FALSE, lower.tail=TRUE)
varexpgeo(p, theta=0.5, lambda=1, log.p=FALSE, lower.tail=TRUE)
esexpgeo(p, theta=0.5, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the first scale parameter, must be in the unit interval, the default is 0.5

lambda

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexpgeo(x)
pexpgeo(x)
varexpgeo(x)
esexpgeo(x)

Exponential logarithmic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponential logarithmic distribution due to Tahmasbi and Rezaei (2008) given by

f(x)=b(1a)exp(bx)loga[1(1a)exp(bx)],F(x)=1log[1(1a)exp(bx)]loga,VaRp(X)=1blog[1a1p1a],ESp(X)=1bp0plog[1a1v1a]dv\begin{array}{ll} &\displaystyle f(x) = -\frac {b (1 - a) \exp (-b x)}{\log a \left[ 1 - (1 - a) \exp (-b x) \right]}, \\ &\displaystyle F (x) = 1 - \frac {\log \left[ 1 - (1 - a) \exp (-b x) \right]}{\log a}, \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{b} \log \left[ \frac {1 - a^{1 - p}}{1 - a} \right], \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{b p} \int_0^p \log \left[ \frac {1 - a^{1 - v}}{1 - a} \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, 0<a<10 < a < 1, the first scale parameter, and b>0b > 0, the second scale parameter.

Usage

dexplog(x, a=0.5, b=1, log=FALSE)
pexplog(x, a=0.5, b=1, log.p=FALSE, lower.tail=TRUE)
varexplog(p, a=0.5, b=1, log.p=FALSE, lower.tail=TRUE)
esexplog(p, a=0.5, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be in the unit interval, the default is 0.5

b

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexplog(x)
pexplog(x)
varexplog(x)
esexplog(x)

Exponentiated logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponentiated logistic distribution given by

f(x)=(a/b)exp(x/b)[1+exp(x/b)]a1,F(x)=[1+exp(x/b)]a,VaRp(X)=blog[p1/a1],ESp(X)=bp0plog[v1/a1]dv\begin{array}{ll} &\displaystyle f (x) = (a/b) \exp (-x/b) \left[ 1 + \exp (-x/b) \right]^{-a - 1}, \\ &\displaystyle F (x) = \left[ 1 + \exp (-x/b) \right]^{-a}, \\ &\displaystyle {\rm VaR}_p (X) = -b \log \left[ p^{-1 / a} - 1 \right], \\ &\displaystyle {\rm ES}_p (X) = -\frac {b}{p} \int_0^p \log \left[ v^{-1 / a} - 1 \right] dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and b>0b > 0, the scale parameter.

Usage

dexplogis(x, a=1, b=1, log=FALSE)
pexplogis(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varexplogis(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esexplogis(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexplogis(x)
pexplogis(x)
varexplogis(x)
esexplogis(x)

Exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponential distribution given by

f(x)=λexp(λx),F(x)=1exp(λx),VaRp(X)=1λlog(1p),ESp(X)=1pλ{log(1p)pplog(1p)}\begin{array}{ll} &\displaystyle f(x) = \lambda \exp (-\lambda x), \\ &\displaystyle F (x) = 1 - \exp (-\lambda x), \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{\lambda} \log (1 - p), \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{p \lambda} \left\{ \log (1 - p) p - p - \log (1 - p) \right\} \end{array}

for x>0x > 0, 0<p<10 < p < 1, and λ>0\lambda > 0, the scale parameter.

Usage

dexponential(x, lambda=1, log=FALSE)
pexponential(x, lambda=1, log.p=FALSE, lower.tail=TRUE)
varexponential(p, lambda=1, log.p=FALSE, lower.tail=TRUE)
esexponential(p, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexponential(x)
pexponential(x)
varexponential(x)
esexponential(x)

Exponential Poisson distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponential Poisson distribution due to Kus (2007) given by

f(x)=bλexp[bxλ+λexp(bx)]1exp(λ),F(x)=1exp[λ+λexp(bx)]1exp(λ),VaRp(X)=1blog{1λlog[1p+pexp(λ)]+1},ESp(X)=1bp0plog{1λlog[1v+vexp(λ)]+1}dv\begin{array}{ll} &\displaystyle f(x) = \frac {b \lambda \exp \left[ -b x - \lambda + \lambda \exp (-b x) \right]}{1 - \exp (-\lambda)}, \\ &\displaystyle F (x) = \frac {1 - \exp \left[ -\lambda + \lambda \exp (-b x) \right]}{1 - \exp (-\lambda)}, \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{b} \log \left\{ \frac {1}{\lambda} \log \left[ 1 - p + p \exp (-\lambda) \right] + 1 \right\}, \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{b p} \int_0^p \log \left\{ \frac {1}{\lambda} \log \left[ 1 - v + v \exp (-\lambda) \right] + 1 \right\} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, b>0b > 0, the first scale parameter, and λ>0\lambda > 0, the second scale parameter.

Usage

dexppois(x, b=1, lambda=1, log=FALSE)
pexppois(x, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varexppois(p, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
esexppois(p, b=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the first scale parameter, must be positive, the default is 1

lambda

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexppois(x)
pexppois(x)
varexppois(x)
esexppois(x)

Exponential power distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponential power distribution due to Subbotin (1923) given by

f(x)=12a1/aσΓ(1+1/a)exp{xμaaσa},F(x)={12Q(1a,(μx)aaσa),if xμ,112Q(1a,(xμ)aaσa),if x>μ,VaRp(X)={μa1/aσ[Q1(1a,2p)]1/a,if p1/2,μ+a1/aσ[Q1(1a,2(1p))]1/a,if p>1/2,ESp(X)={μa1/aσp0p[Q1(1a,2v)]1/adv,if p1/2,μa1/aσp01/2[Q1(1a,2v)]1/adv+a1/aσp1/2p[Q1(1a,2(1v))]1/adv,if p>1/2\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\displaystyle 2 a^{1/a} \sigma \Gamma \left( 1 + 1/a \right)} \exp \left\{ -\frac {\mid x - \mu \mid^a}{a \sigma^a} \right\}, \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2} Q \left( \frac {1}{a}, \frac {(\mu - x)^a}{a \sigma^a} \right), & \mbox{if $x \leq \mu$,} \\ \\ \displaystyle 1 - \frac {1}{2} Q \left( \frac {1}{a}, \frac {(x - \mu)^a}{a \sigma^a} \right), & \mbox{if $x > \mu$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \mu - a^{1/a} \sigma \left[ Q^{-1} \left( \frac {1}{a}, 2 p \right) \right]^{1/a}, & \mbox{if $p \leq 1/2$,} \\ \\ \mu + a^{1/a} \sigma \left[ Q^{-1} \left( \frac {1}{a}, 2 (1 - p) \right) \right]^{1/a}, & \mbox{if $p > 1/2$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \mu - \frac {a^{1/a} \sigma}{p} \int_0^p \left[ Q^{-1} \left( \frac {1}{a}, 2 v \right) \right]^{1/a} dv, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \mu - \frac {a^{1/a} \sigma}{p} \int_0^{1/2} \left[ Q^{-1} \left( \frac {1}{a}, 2 v \right) \right]^{1/a} dv \\ \displaystyle \quad +\frac {a^{1/a} \sigma}{p} \int_{1/2}^p \left[ Q^{-1} \left( \frac {1}{a}, 2 (1 - v) \right) \right]^{1/a} dv, & \mbox{if $p > 1/2$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, and a>0a > 0, the shape parameter.

Usage

dexppower(x, mu=0, sigma=1, a=1, log=FALSE)
pexppower(x, mu=0, sigma=1, a=1, log.p=FALSE, lower.tail=TRUE)
varexppower(p, mu=0, sigma=1, a=1, log.p=FALSE, lower.tail=TRUE)
esexppower(p, mu=0, sigma=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexppower(x)
pexppower(x)
varexppower(x)
esexppower(x)

Exponentiated Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the exponentiated Weibull distribution due to Mudholkar and Srivastava (1993) and Mudholkar et al. (1995) given by

f(x)=aασαxα1exp[(x/σ)α]{1exp[(x/σ)α]}a1,F(x)={1exp[(x/σ)α]}a,VaRp(X)=σ[log(1p1/a)]1/α,ESp(X)=σp0p[log(1v1/a)]1/αdv\begin{array}{ll} &\displaystyle f(x) = a \alpha \sigma^{-\alpha} x^{\alpha - 1} \exp \left[ -(x / \sigma)^\alpha \right] \left\{ 1 - \exp \left[ -(x / \sigma)^\alpha \right] \right\}^{a - 1}, \\ &\displaystyle F (x) = \left\{ 1 - \exp \left[ -(x / \sigma)^\alpha \right] \right\}^a, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \left[ -\log \left( 1 - p^{1 / a} \right) \right]^{1 / \alpha}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \left[ -\log \left( 1 - v^{1 / a} \right) \right]^{1 / \alpha} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, α>0\alpha > 0, the second shape parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dexpweibull(x, a=1, alpha=1, sigma=1, log=FALSE)
pexpweibull(x, a=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varexpweibull(p, a=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
esexpweibull(p, a=1, alpha=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

alpha

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dexpweibull(x)
pexpweibull(x)
varexpweibull(x)
esexpweibull(x)

F distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the F distribution given by

f(x)=1B(d12,d22)(d1d2)d12xd121(1+d1d2x)d1+d22,F(x)=Id1xd1x+d2(d12,d22),VaRp(X)=d2d1Ip1(d12,d22)1Ip1(d12,d22),ESp(X)=d2d1p0pIv1(d12,d22)1Iv1(d12,d22)dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{B \left( \frac {d_1}{2}, \frac {d_2}{2} \right)} \left( \frac {d_1}{d_2} \right)^{\frac {d_1}{2}} x^{\frac {d_1}{2} - 1} \left( 1 + \frac {d_1}{d_2} x \right)^{-\frac {d_1 + d_2}{2}}, \\ &\displaystyle F (x) = I_{\frac {d_1 x}{d_1 x + d_2}} \left( \frac {d_1}{2}, \frac {d_2}{2} \right), \\ &\displaystyle {\rm VaR}_p (X) = \frac {d_2}{d_1} \frac {I_p^{-1} \left( \frac {d_1}{2}, \frac {d_2}{2} \right)} {1 - I_p^{-1} \left( \frac {d_1}{2}, \frac {d_2}{2} \right)}, \\ &\displaystyle {\rm ES}_p (X) = \frac {d_2}{d_1 p} \int_0^p \frac {I_v^{-1} \left( \frac {d_1}{2}, \frac {d_2}{2} \right)} {1 - I_v^{-1} \left( \frac {d_1}{2}, \frac {d_2}{2} \right)} dv \end{array}

for xKx \geq K, 0<p<10 < p < 1, d1>0d_1 > 0, the first degree of freedom parameter, and d2>0d_2 > 0, the second degree of freedom parameter.

Usage

dF(x, d1=1, d2=1, log=FALSE)
pF(x, d1=1, d2=1, log.p=FALSE, lower.tail=TRUE)
varF(p, d1=1, d2=1, log.p=FALSE, lower.tail=TRUE)
esF(p, d1=1, d2=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

d1

the value of the first degree of freedom parameter, must be positive, the default is 1

d2

the value of the second degree of freedom parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dF(x)
pF(x)
varF(x)
esF(x)

Freimer distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Freimer distribution due to Freimer et al. (1988) given by

VaRp(X)=1a[pb1b(1p)c1c],ESp(X)=1a(1c1b)+pbab(b+1)+(1p)c+11pac(c+1)\begin{array}{ll} &\displaystyle {\rm VaR}_p (X) = \frac {1}{a} \left[ \frac {p^b - 1}{b} - \frac {(1 - p)^c - 1}{c} \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{a} \left( \frac {1}{c} - \frac {1}{b} \right) + \frac {p^b}{a b (b + 1)} + \frac {(1 - p)^{c + 1} - 1}{p a c (c + 1)} \end{array}

for 0<p<10 < p < 1, a>0a > 0, the scale parameter, b>0b > 0, the first shape parameter, and c>0c > 0, the second shape parameter.

Usage

varFR(p, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
esFR(p, a=1, b=1, c=1)

Arguments

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the scale parameter, must be positive, the default is 1

b

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
varFR(x)
esFR(x)

Frechet distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Fr\'echet distribution due to Fr\'echet (1927) given by

f(x)=ασαxα+1exp{(σx)α},F(x)=exp{(σx)α},VaRp(X)=σ[logp]1/α,ESp(X)=σpΓ(11/α,logp)\begin{array}{ll} &\displaystyle f (x) = \frac {\alpha \sigma^\alpha}{x^{\alpha + 1}} \exp \left\{ -\left( \frac {\sigma}{x} \right)^{\alpha} \right\}, \\ &\displaystyle F (x) = \exp \left\{ -\left( \frac {\sigma}{x} \right)^{\alpha} \right\}, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \left[ -\log p \right]^{-1 / \alpha}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \Gamma \left( 1 - 1 / \alpha, -\log p \right) \end{array}

for x>0x > 0, 0<p<10 < p < 1, α>0\alpha > 0, the shape parameter, and σ>0\sigma > 0, the scale parameter, where Γ(a,x)=xta1exp(t)dt\Gamma (a, x) = \int_x^\infty t^{a - 1} \exp \left( -t \right) dt denotes the complementary incomplete gamma function.

Usage

dfrechet(x, alpha=1, sigma=1, log=FALSE)
pfrechet(x, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varfrechet(p, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
esfrechet(p, alpha=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

alpha

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dfrechet(x)
pfrechet(x)
varfrechet(x)
esfrechet(x)

Gamma distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the gamma distribution given by

f(x)=baxa1exp(bx)Γ(a),F(x)=γ(a,bx)Γ(a),VaRp(X)=1bQ1(a,1p),ESp(X)=1bp0pQ1(a,1v)dv\begin{array}{ll} &\displaystyle f (x) = \frac {b^a x^{a - 1} \exp (-b x)}{\Gamma (a)}, \\ &\displaystyle F (x) = \frac {\gamma (a, b x)}{\Gamma (a)}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{b} Q^{-1} (a, 1 - p), \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{b p} \int_0^p Q^{-1} (a, 1 - v) dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, b>0b > 0, the scale parameter, and a>0a > 0, the shape parameter, where γ(a,x)=0xta1exp(t)dt\gamma (a, x) = \int_0^x t^{a - 1} \exp \left( -t \right) dt denotes the incomplete gamma function, Q(a,x)=xta1exp(t)dt/Γ(a)Q (a, x) = \int_x^\infty t^{a - 1} \exp \left( -t \right) dt / \Gamma (a) denotes the regularized complementary incomplete gamma function, Γ(a)=0ta1exp(t)dt\Gamma (a) = \int_0^\infty t^{a - 1} \exp \left( -t \right) dt denotes the gamma function, and Q1(a,x)Q^{-1} (a, x) denotes the inverse of Q(a,x)Q (a, x).

Usage

dGamma(x, a=1, b=1, log=FALSE)
pGamma(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varGamma(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esGamma(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dGamma(x)
pGamma(x)
varGamma(x)
esGamma(x)

Generalized beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized beta distribution given by

f(x)=(xc)a1(dx)b1B(a,b)(dc)a+b1,F(x)=Ixcdc(a,b),VaRp(X)=c+(dc)Ip1(a,b),ESp(X)=c+dcp0pIv1(a,b)dv\begin{array}{ll} &\displaystyle f (x) = \frac {(x - c)^{a - 1} (d - x)^{b - 1}}{B (a, b) (d - c)^{a + b - 1}}, \\ &\displaystyle F (x) = I_{\frac {x - c}{d - c}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = c + (d - c) I_p^{-1} (a, b), \\ &\displaystyle {\rm ES}_p (X) = c + \frac {d - c}{p} \int_0^p I_v^{-1} (a, b) dv \end{array}

for cxdc \leq x \leq d, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, <c<-\infty < c < \infty, the first location parameter, and <c<d<-\infty < c < d < \infty, the second location parameter.

Usage

dgenbeta(x, a=1, b=1, c=0, d=1, log=FALSE)
pgenbeta(x, a=1, b=1, c=0, d=1, log.p=FALSE, lower.tail=TRUE)
vargenbeta(p, a=1, b=1, c=0, d=1, log.p=FALSE, lower.tail=TRUE)
esgenbeta(p, a=1, b=1, c=0, d=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

c

the value of the first location parameter, can take any real value, the default is zero

d

the value of the second location parameter, can take any real value but must be greater than c, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenbeta(x)
pgenbeta(x)
vargenbeta(x)
esgenbeta(x)

Generalized beta II distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized beta II distribution given by

f(x)=cxac1(1xc)b1B(a,b),F(x)=Ixc(a,b),VaRp(X)=[Ip1(a,b)]1/c,ESp(X)=1p0p[Iv1(a,b)]1/cdv\begin{array}{ll} &\displaystyle f (x) = \frac {c x^{ac - 1} \left( 1 - x^c \right)^{b - 1}}{B (a, b)}, \\ &\displaystyle F (x) = I_{x^c} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \left[ I_p^{-1} (a, b) \right]^{1 / c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left[ I_v^{-1} (a, b) \right]^{1 / c} dv \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, and c>0c > 0, the third shape parameter.

Usage

dgenbeta2(x, a=1, b=1, c=1, log=FALSE)
pgenbeta2(x, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
vargenbeta2(p, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
esgenbeta2(p, a=1, b=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

c

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenbeta2(x)
pgenbeta2(x)
vargenbeta2(x)
esgenbeta2(x)

Generalized inverse beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized inverse beta distribution given by

f(x)=axac1B(c,d)(1+xa)c+d,F(x)=Ixa1+xa(c,d),VaRp(X)=[Ip1(c,d)1Ip1(c,d)]1/a,ESp(X)=1p0p[Iv1(c,d)1Iv1(c,d)]1/adv\begin{array}{ll} &\displaystyle f (x) = \frac {a x^{ac - 1}}{B (c, d) \left( 1 + x^a \right)^{c + d}}, \\ &\displaystyle F (x) = I_{\frac {x^a}{1 + x^a}} (c, d), \\ &\displaystyle {\rm VaR}_p (X) = \left[ \frac {I_p^{-1} (c, d)}{1 - I_p^{-1} (c, d)} \right]^{1/a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left[ \frac {I_v^{-1} (c, d)}{1 - I_v^{-1} (c, d)} \right]^{1/a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, c>0c > 0, the second shape parameter, and d>0d > 0, the third shape parameter.

Usage

dgeninvbeta(x, a=1, c=1, d=1, log=FALSE)
pgeninvbeta(x, a=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
vargeninvbeta(p, a=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
esgeninvbeta(p, a=1, c=1, d=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

d

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgeninvbeta(x)
pgeninvbeta(x)
vargeninvbeta(x)
esgeninvbeta(x)

Generalized logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized logistic distribution given by

f(x)=aexp(xμσ)σ{1+exp(xμσ)}1+a,F(x)=1{1+exp(xμσ)}a,VaRp(X)=μσlog(p1/a1),ESp(X)=μσp0plog(v1/a1)dv\begin{array}{ll} &\displaystyle f (x) = \frac {a \exp \left( -\frac {x - \mu}{\sigma} \right)} {\sigma \left\{ 1 + \exp \left( -\frac {x - \mu}{\sigma} \right) \right\}^{1 + a}}, \\ &\displaystyle F (x) = \frac {1}{\left\{ 1 + \exp \left( -\frac {x - \mu}{\sigma} \right) \right\}^a}, \\ &\displaystyle {\rm VaR}_p (X) = \mu - \sigma \log \left( p^{-1 / a} - 1 \right), \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{p} \int_0^p \log \left( v^{-1 / a} - 1 \right) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, and a>0a > 0, the shape parameter.

Usage

dgenlogis(x, a=1, mu=0, sigma=1, log=FALSE)
pgenlogis(x, a=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
vargenlogis(p, a=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esgenlogis(p, a=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenlogis(x)
pgenlogis(x)
vargenlogis(x)
esgenlogis(x)

Generalized logistic III distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized logistic III distribution given by

f(x)=1σB(α,α)exp(αxμσ){1+exp(xμσ)}2α,F(x)=I11+exp(xμσ)(α,α),VaRp(X)=μσlog1Ip1(α,α)Ip1(α,α),ESp(X)=μσp0plog1Iv1(α,α)Iv1(α,α)dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma B (\alpha, \alpha)} \exp \left( \alpha \frac {x - \mu}{\sigma} \right) \left\{ 1 + \exp \left( \frac {x - \mu}{\sigma} \right) \right\}^{-2 \alpha}, \\ &\displaystyle F (x) = I_{\frac {1}{1 + \exp \left( -\frac {x - \mu}{\sigma} \right)}} (\alpha, \alpha), \\ &\displaystyle {\rm VaR}_p (X) = \mu - \sigma \log \frac {1 - I_p^{-1} (\alpha, \alpha)}{I_p^{-1} (\alpha, \alpha)}, \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{p} \int_0^p \log \frac {1 - I_v^{-1} (\alpha, \alpha)}{I_v^{-1} (\alpha, \alpha)} dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, and α>0\alpha > 0, the shape parameter.

Usage

dgenlogis3(x, alpha=1, mu=0, sigma=1, log=FALSE)
pgenlogis3(x, alpha=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
vargenlogis3(p, alpha=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esgenlogis3(p, alpha=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

alpha

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenlogis3(x)
pgenlogis3(x)
vargenlogis3(x)
esgenlogis3(x)

Generalized logistic IV distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized logistic IV distribution given by

f(x)=1σB(α,a)exp(αxμσ){1+exp(xμσ)}αa,F(x)=I11+exp(xμσ)(α,a),VaRp(X)=μσlog1Ip1(α,a)Ip1(α,a),ESp(X)=μσp0plog1Iv1(α,a)Iv1(α,a)dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma B (\alpha, a)} \exp \left( -\alpha \frac {x - \mu}{\sigma} \right) \left\{ 1 + \exp \left( -\frac {x - \mu}{\sigma} \right) \right\}^{-\alpha - a}, \\ &\displaystyle F (x) = I_{\frac {1}{1 + \exp \left( -\frac {x - \mu}{\sigma} \right)}} (\alpha, a), \\ &\displaystyle {\rm VaR}_p (X) = \mu - \sigma \log \frac {1 - I_p^{-1} (\alpha, a)}{I_p^{-1} (\alpha, a)}, \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{p} \int_0^p \log \frac {1 - I_v^{-1} (\alpha, a)}{I_v^{-1} (\alpha, a)} dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, α>0\alpha > 0, the first shape parameter, and a>0a > 0, the second shape parameter.

Usage

dgenlogis4(x, a=1, alpha=1, mu=0, sigma=1, log=FALSE)
pgenlogis4(x, a=1, alpha=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
vargenlogis4(p, a=1, alpha=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esgenlogis4(p, a=1, alpha=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

alpha

the value of the first shape parameter, must be positive, the default is 1

a

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenlogis4(x)
pgenlogis4(x)
vargenlogis4(x)
esgenlogis4(x)

Generalized Pareto distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized Pareto distribution due to Pickands (1975) given by

f(x)=1k(1cxk)1/c1,F(x)=1(1cxk)1/c,VaRp(X)=kc[1(1p)c],ESp(X)=kc+k(1p)c+1pc(c+1)kpc(c+1)\begin{array}{ll} &\displaystyle f (x) = \frac {1}{k} \left( 1 - \frac {c x}{k} \right)^{1 / c - 1}, \\ &\displaystyle F (x) = 1 - \left( 1 - \frac {c x}{k} \right)^{1 / c}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {k}{c} \left[ 1 - (1 - p)^c \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {k}{c} + \frac {k (1 - p)^{c + 1}}{p c (c + 1)} - \frac {k}{p c (c + 1)} \end{array}

for x<k/cx < k/c if c>0c > 0, x>k/cx > k/c if c<0c < 0, x>0x > 0 if c=0c = 0, 0<p<10 < p < 1, k>0k > 0, the scale parameter and <c<-\infty < c < \infty, the shape parameter.

Usage

dgenpareto(x, k=1, c=1, log=FALSE)
pgenpareto(x, k=1, c=1, log.p=FALSE, lower.tail=TRUE)
vargenpareto(p, k=1, c=1, log.p=FALSE, lower.tail=TRUE)
esgenpareto(p, k=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

k

the value of the scale parameter, must be positive, the default is 1

c

the value of the shape parameter, can take any real value, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenpareto(x)
pgenpareto(x)
vargenpareto(x)
esgenpareto(x)

Generalized power Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized power Weibull distribution due to Nikulin and Haghighi (2006) given by

f(x)=aθxa1[1+xa]θ1exp{1[1+xa]θ},F(x)=1exp{1[1+xa]θ},VaRp(X)={[1log(1p)]1/θ1}1/a,ESp(X)=1p0p{[1log(1v)]1/θ1}1/adv\begin{array}{ll} &\displaystyle f(x) = a \theta x^{a - 1} \left[ 1 + x^a \right]^{\theta - 1} \exp \left\{ 1 - \left[ 1 + x^a \right]^\theta \right\}, \\ &\displaystyle F (x) = 1 - \exp \left\{ 1 - \left[ 1 + x^a \right]^\theta \right\}, \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \left[ 1 - \log (1 - p) \right]^{1 / \theta} - 1 \right\}^{1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left\{ \left[ 1 - \log (1 - v) \right]^{1 / \theta} - 1 \right\}^{1 / a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, and θ>0\theta > 0, the second shape parameter.

Usage

dgenpowerweibull(x, a=1, theta=1, log=FALSE)
pgenpowerweibull(x, a=1, theta=1, log.p=FALSE, lower.tail=TRUE)
vargenpowerweibull(p, a=1, theta=1, log.p=FALSE, lower.tail=TRUE)
esgenpowerweibull(p, a=1, theta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

theta

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenpowerweibull(x)
pgenpowerweibull(x)
vargenpowerweibull(x)
esgenpowerweibull(x)

Generalized uniform distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized uniform distribution given by

f(x)=hkc(xa)c1[1k(xa)c]h1,F(x)=1[1k(xa)c]h,VaRp(X)=a+k1/c[1(1p)1/h]1/c,ESp(X)=a+k1/cp0p[1(1v)1/h]1/cdv\begin{array}{ll} &\displaystyle f (x) = h k c (x - a)^{c - 1} \left[ 1 - k (x - a)^c \right]^{h - 1}, \\ &\displaystyle F (x) = 1 - \left[ 1 - k (x - a)^c \right]^h, \\ &\displaystyle {\rm VaR}_p (X) = a + k^{-1/c} \left[ 1 - (1 - p)^{1/h} \right]^{1/c}, \\ &\displaystyle {\rm ES}_p (X) = a + \frac {k^{-1/c}}{p} \int_0^p \left[ 1 - (1 - v)^{1/h} \right]^{1/c} dv \end{array}

for axa+k1/ca \leq x \leq a + k^{-1/c}, 0<p<10 < p < 1, <a<-\infty < a < \infty, the location parameter, c>0c > 0, the first shape parameter, k>0k > 0, the scale parameter, and h>0h > 0, the second shape parameter.

Usage

dgenunif(x, a=0, c=1, h=1, k=1, log=FALSE)
pgenunif(x, a=0, c=1, h=1, k=1, log.p=FALSE, lower.tail=TRUE)
vargenunif(p, a=0, c=1, h=1, k=1, log.p=FALSE, lower.tail=TRUE)
esgenunif(p, a=0, c=1, h=1, k=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the location parameter, can take any real value, the default is zero

k

the value of the scale parameter, must be positive, the default is 1

c

the value of the first scale parameter, must be positive, the default is 1

h

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgenunif(x)
pgenunif(x)
vargenunif(x)
esgenunif(x)

Generalized extreme value distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the generalized extreme value distribution due to Fisher and Tippett (1928) given by

f(x)=1σ[1+ξ(xμσ)]1/ξ1exp{[1+ξ(xμσ)]1/ξ},F(x)=exp{[1+ξ(xμσ)]1/ξ},VaRp(X)=μσξ+σξ(logp)ξ,ESp(X)=μσξ+σpξ0p(logv)ξdv\begin{array}{ll} &\displaystyle f(x) = \frac {1}{\sigma} \left[ 1 + \xi \left( \frac {x - \mu}{\sigma} \right) \right]^{-1/\xi - 1} \exp \left\{ -\left[ 1 + \xi \left( \frac {x - \mu}{\sigma} \right) \right]^{-1/\xi} \right\}, \\ &\displaystyle F(x) = \exp \left\{ -\left[ 1 + \xi \left( \frac {x - \mu}{\sigma} \right) \right]^{-1/\xi} \right\}, \\ &\displaystyle {\rm VaR}_p (X) = \mu - \frac {\sigma}{\xi} + \frac {\sigma}{\xi} (-\log p)^{-\xi}, \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{\xi} + \frac {\sigma}{p \xi} \int_0^p (-\log v)^{-\xi} dv \end{array}

for xμσ/ξx \geq \mu - \sigma / \xi if ξ>0\xi > 0, xμσ/ξx \leq \mu - \sigma / \xi if ξ<0\xi < 0, <x<-\infty < x < \infty if ξ=0\xi = 0, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, and <ξ<-\infty < \xi < \infty, the shape parameter.

Usage

dgev(x, mu=0, sigma=1, xi=1, log=FALSE)
pgev(x, mu=0, sigma=1, xi=1, log.p=FALSE, lower.tail=TRUE)
vargev(p, mu=0, sigma=1, xi=1, log.p=FALSE, lower.tail=TRUE)
esgev(p, mu=0, sigma=1, xi=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

xi

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgev(x)
pgev(x)
vargev(x)
esgev(x)

Gompertz distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Gompertz distribution due to Gompertz (1825) given by

f(x)=bηexp(bx)exp[ηηexp(bx)],F(x)=1exp[ηηexp(bx)],VaRp(X)=1blog[11ηlog(1p)],ESp(X)=1pb0plog[11ηlog(1v)]dv\begin{array}{ll} &\displaystyle f(x) = b \eta \exp (bx) \exp \left[ \eta - \eta \exp (bx) \right], \\ &\displaystyle F (x) = 1 - \exp \left[ \eta - \eta \exp (bx) \right], \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{b} \log \left[ 1 - \frac {1}{\eta} \log (1 - p) \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p b} \int_0^p \log \left[ 1 - \frac {1}{\eta} \log (1 - v) \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, b>0b > 0, the first scale parameter and η>0\eta > 0, the second scale parameter.

Usage

dgompertz(x, b=1, eta=1, log=FALSE)
pgompertz(x, b=1, eta=1, log.p=FALSE, lower.tail=TRUE)
vargompertz(p, b=1, eta=1, log.p=FALSE, lower.tail=TRUE)
esgompertz(p, b=1, eta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the first scale parameter, must be positive, the default is 1

eta

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgompertz(x)
pgompertz(x)
vargompertz(x)
esgompertz(x)

Gumbel distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Gumbel distribution given by due to Gumbel (1954) given by

f(x)=1σexp(μxσ)exp[exp(μxσ)],F(x)=exp[exp(μxσ)],VaRp(X)=μσlog(logp),ESp(X)=μσp0plog(logv)dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma} \exp \left( \frac {\mu - x}{\sigma} \right) \exp \left[ -\exp \left( \frac {\mu - x}{\sigma} \right) \right], \\ &\displaystyle F (x) = \exp \left[ -\exp \left( \frac {\mu - x}{\sigma} \right) \right], \\ &\displaystyle {\rm VaR}_p (X) = \mu - \sigma \log (-\log p), \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{p} \int_0^p \log (-\log v) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dgumbel(x, mu=0, sigma=1, log=FALSE)
pgumbel(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
vargumbel(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esgumbel(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgumbel(x)
pgumbel(x)
vargumbel(x)
esgumbel(x)

Gumbel II distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Gumbel II distribution

f(x)=abxa1exp(bxa),F(x)=1exp(bxa),VaRp(X)=b1/a[log(1p)]1/a,ESp(X)=b1/ap0p[log(1v)]1/adv\begin{array}{ll} &\displaystyle f (x) = a b x^{-a - 1} \exp \left( -b x^{-a} \right), \\ &\displaystyle F (x) = 1 - \exp \left( -b x^{-a} \right), \\ &\displaystyle {\rm VaR}_p (X) = b^{1 / a} \left[ -\log (1 - p) \right]^{-1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {b^{1 / a}}{p} \int_0^p \left[ -\log (1 - v) \right]^{-1 / a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and b>0b > 0, the scale parameter.

Usage

dgumbel2(x, a=1, b=1, log=FALSE)
pgumbel2(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
vargumbel2(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esgumbel2(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the scale parameter, must be positive, the default is 1

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dgumbel2(x)
pgumbel2(x)
vargumbel2(x)
esgumbel2(x)

Half Cauchy distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the half Cauchy distribution given by

f(x)=2πσx2+σ2,F(x)=2πarctan(xσ),VaRp(X)=σtan(πp2),ESp(X)=σp0ptan(πv2)dv\begin{array}{ll} &\displaystyle f (x) = \frac {2}{\pi} \frac {\sigma}{x^2 + \sigma^2}, \\ &\displaystyle F (x) = \frac {2}{\pi} \arctan \left( \frac {x}{\sigma} \right), \\ &\displaystyle {\rm VaR}_p (X) = \sigma \tan \left( \frac {\pi p}{2} \right), \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \tan \left( \frac {\pi v}{2} \right) dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, and σ>0\sigma > 0, the scale parameter.

Usage

dhalfcauchy(x, sigma=1, log=FALSE)
phalfcauchy(x, sigma=1, log.p=FALSE, lower.tail=TRUE)
varhalfcauchy(p, sigma=1, log.p=FALSE, lower.tail=TRUE)
eshalfcauchy(p, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dhalfcauchy(x)
phalfcauchy(x)
varhalfcauchy(x)
eshalfcauchy(x)

Half logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the half logistic distribution given by

f(x)=2λexp(λx)[1+exp(λx)]2,F(x)=1exp(λx)1+exp(λx),VaRp(X)=1λlog1p1+p,ESp(X)=1λlog1p1+p+1λplog(1p2)\begin{array}{ll} &\displaystyle f (x) = \frac {2 \lambda \exp \left( -\lambda x \right)} {\left[ 1 + \exp \left( -\lambda x \right) \right]^2}, \\ &\displaystyle F (x) = \frac {1 - \exp \left( -\lambda x \right)}{1 + \exp \left( -\lambda x \right)}, \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{\lambda} \log \frac {1 - p}{1 + p}, \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{\lambda} \log \frac {1 - p}{1 + p} + \frac {1}{\lambda p} \log \left( 1 - p^2 \right) \end{array}

for x>0x > 0, 0<p<10 < p < 1, and λ>0\lambda > 0, the scale parameter.

Usage

dhalflogis(x, lambda=1, log=FALSE)
phalflogis(x, lambda=1, log.p=FALSE, lower.tail=TRUE)
varhalflogis(p, lambda=1, log.p=FALSE, lower.tail=TRUE)
eshalflogis(p, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dhalflogis(x)
phalflogis(x)
varhalflogis(x)
eshalflogis(x)

Half normal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for Half normal distribution given by

f(x)=2σϕ(xσ),F(x)=2Φ(xσ)1,VaRp(X)=σΦ1(1+p2),ESp(X)=σp0pΦ1(1+v2)dv\begin{array}{ll} &\displaystyle f (x) = \frac {2}{\sigma} \phi \left( \frac {x}{\sigma} \right), \\ &\displaystyle F (x) = 2 \Phi \left( \frac {x}{\sigma} \right) - 1, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \Phi^{-1} \left( \frac {1 + p}{2} \right), \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \Phi^{-1} \left( \frac {1 + v}{2} \right) dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, and σ>0\sigma > 0, the scale parameter.

Usage

dhalfnorm(x, sigma=1, log=FALSE)
phalfnorm(x, sigma=1, log.p=FALSE, lower.tail=TRUE)
varhalfnorm(p, sigma=1, log.p=FALSE, lower.tail=TRUE)
eshalfnorm(p, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dhalfnorm(x)
phalfnorm(x)
varhalfnorm(x)
eshalfnorm(x)

Half Student's t distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the half Student's tt distribution given by

f(x)=2Γ(n+12)nπΓ(n2)(1+x2n)n+12,F(x)=Ix2x2+n(12,n2),VaRp(X)=nIp1(12,n2)1Ip1(12,n2),ESp(X)=np0pIv1(12,n2)1Iv1(12,n2)dv\begin{array}{ll} &\displaystyle f (x) = \frac {2 \Gamma \left( \frac {n + 1}{2} \right)}{\sqrt{n \pi} \Gamma \left( \frac {n}{2} \right)} \left( 1 + \frac {x^2}{n} \right)^{-\frac {n + 1}{2}}, \\ &\displaystyle F (x) = I_{\frac {x^2}{x^2 + n}} \left( \frac {1}{2}, \frac {n}{2} \right), \\ &\displaystyle {\rm VaR}_p (X) = \sqrt{\frac {n I_p^{-1} \left( \frac {1}{2}, \frac {n}{2} \right)} {1 - I_p^{-1} \left( \frac {1}{2}, \frac {n}{2} \right)}}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sqrt{n}}{p} \int_0^p \sqrt{\frac {I_v^{-1} \left( \frac {1}{2}, \frac {n}{2} \right)} {1 - I_v^{-1} \left( \frac {1}{2}, \frac {n}{2} \right)}} dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, and n>0n > 0, the degree of freedom parameter.

Usage

dhalfT(x, n=1, log=FALSE)
phalfT(x, n=1, log.p=FALSE, lower.tail=TRUE)
varhalfT(p, n=1, log.p=FALSE, lower.tail=TRUE)
eshalfT(p, n=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

n

the value of the degree of freedom parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dhalfT(x)
phalfT(x)
varhalfT(x)
eshalfT(x)

Holla-Bhattacharya Laplace distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Holla-Bhattacharya Laplace distribution due to Holla and Bhattacharya (1968) given by

f(x)={aϕexp{ϕ(xθ)},if xθ,(1a)ϕexp{ϕ(θx)},if x>θ,F(x)={aexp(ϕxθϕ),if xθ,1(1a)exp(θϕϕx),if x>θ,VaRp(X)={θ+1ϕlog(pa),if pa,θ1ϕlog(1p1a),if p>a,ESp(X)={θ1ϕ+1ϕlogpa,if pa,1p[θ(1+pa)+p2a(1a)logaϕ+1pϕlog1p1a],if p>a\begin{array}{ll} & f (x) = \left\{ \begin{array}{ll} \displaystyle a \phi \exp \left\{ \phi \left( x - \theta \right) \right\}, & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle \left( 1 - a \right) \phi \exp \left\{ \phi \left( \theta - x \right) \right\}, & \mbox{if $x > \theta$,} \end{array} \right. \\ & F (x) = \left\{ \begin{array}{ll} \displaystyle a \exp \left( \phi x - \theta \phi \right), & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle 1 - (1 - a) \exp \left( \theta \phi - \phi x \right), & \mbox{if $x > \theta$,} \end{array} \right. \\ & {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta + \frac {1}{\phi} \log \left( \frac {p}{a} \right), & \mbox{if $p \leq a$,} \\ \\ \displaystyle \theta - \frac {1}{\phi} \log \left( \frac {1 - p}{1 - a} \right), & \mbox{if $p > a$,} \end{array} \right. \\ & {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \frac {1}{\phi} + \frac {1}{\phi} \log \frac {p}{a}, & \mbox{if $p \leq a$,} \\ \\ \displaystyle \frac {1}{p} \left[ \theta (1 + p - a) + \frac {p - 2a - (1 - a) \log a}{\phi} + \frac {1 - p}{\phi} \log \frac {1 - p}{1 - a} \right], & \mbox{if $p > a$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <θ<-\infty < \theta < \infty, the location parameter, 0<a<10 < a < 1, the first scale parameter, and ϕ>0\phi > 0, the second scale parameter.

Usage

dHBlaplace(x, a=0.5, theta=0, phi=1, log=FALSE)
pHBlaplace(x, a=0.5, theta=0, phi=1, log.p=FALSE, lower.tail=TRUE)
varHBlaplace(p, a=0.5, theta=0, phi=1, log.p=FALSE, lower.tail=TRUE)
esHBlaplace(p, a=0.5, theta=0, phi=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, can take any real value, the default is zero

a

the value of the first scale parameter, must be in the unit interval, the default is 0.5

phi

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dHBlaplace(x)
pHBlaplace(x)
varHBlaplace(x)
esHBlaplace(x)

Hankin-Lee distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Hankin-Lee distribution due to Hankin and Lee (2006) given by

VaRp(X)=cpa(1p)b,ESp(X)=cpBp(a+1,1b)\begin{array}{ll} &\displaystyle {\rm VaR}_p (X) = \frac {c p^a}{(1 - p)^b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {c}{p} B_p (a + 1, 1 - b) \end{array}

for 0<p<10 < p < 1, c>0c > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

varHL(p, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
esHL(p, a=1, b=1, c=1)

Arguments

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

c

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
varHL(x)
esHL(x)

Hosking logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Hosking logistic distribution due to Hosking (1989, 1990) given by

f(x)=(1kx)1/k1[1+(1kx)1/k]2,F(x)=11+(1kx)1/k,VaRp(X)=1k[1(1pp)k],ESp(X)=1k1kpBp(1k,1+k)\begin{array}{ll} &\displaystyle f (x) = \frac {(1 - k x)^{1 / k - 1}}{\left[ 1 + (1 - k x)^{1 / k} \right]^2}, \\ &\displaystyle F (x) = \frac {1}{1 + (1 - k x)^{1 / k}}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{k} \left[ 1 - \left( \frac {1 - p}{p} \right)^k \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{k} - \frac {1}{kp} B_p (1 - k, 1 + k) \end{array}

for x<1/kx < 1/k if k>0k > 0, x>1/kx > 1/k if k<0k < 0, <x<-\infty < x < \infty if k=0k = 0, and <k<-\infty < k < \infty, the shape parameter.

Usage

dHlogis(x, k=1, log=FALSE)
pHlogis(x, k=1, log.p=FALSE, lower.tail=TRUE)
varHlogis(p, k=1, log.p=FALSE, lower.tail=TRUE)
esHlogis(p, k=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

k

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dHlogis(x)
pHlogis(x)
varHlogis(x)
esHlogis(x)

Inverse beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the inverse beta distribution given by

f(x)=xa1B(a,b)(1+x)a+b,F(x)=Ix1+x(a,b),VaRp(X)=Ip1(a,b)1Ip1(a,b),ESp(X)=1p0pIv1(a,b)1Iv1(a,b)dv\begin{array}{ll} &\displaystyle f (x) = \frac {x^{a - 1}}{B (a, b) (1 + x)^{a + b}}, \\ &\displaystyle F (x) = I_{\frac {x}{1 + x}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \frac {I_p^{-1} (a, b)}{1 - I_p^{-1} (a, b)}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \frac {I_v^{-1} (a, b)}{1 - I_v^{-1} (a, b)} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dinvbeta(x, a=1, b=1, log=FALSE)
pinvbeta(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varinvbeta(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esinvbeta(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dinvbeta(x)
pinvbeta(x)
varinvbeta(x)
esinvbeta(x)

Inverse exponentiated exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the inverse exponentiated exponential distribution due to Ghitany et al. (2013) given by

f(x)=aλx2exp(λx)[1exp(λx)]a1,F(x)=1[1exp(λx)]a,VaRp(X)=λ{log[1(1p)1/a]}1,ESp(X)=λp0p{log[1(1v)1/a]}1dv\begin{array}{ll} &\displaystyle f (x) = a \lambda x^{-2} \exp \left(-\frac {\lambda}{x} \right) \left[ 1 - \exp \left( -\frac {\lambda}{x} \right) \right]^{a - 1}, \\ &\displaystyle F (x) = 1 - \left[ 1 - \exp \left( -\frac {\lambda}{x} \right) \right]^a, \\ &\displaystyle {\rm VaR}_p (X) = \lambda \left\{ -\log \left[ 1 - (1 - p)^{1 / a} \right] \right\}^{-1}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\lambda}{p} \int_0^p \left\{ -\log \left[ 1 - (1 - v)^{1 / a} \right] \right\}^{-1} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter and λ>0\lambda > 0, the scale parameter.

Usage

dinvexpexp(x, lambda=1, a=1, log=FALSE)
pinvexpexp(x, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
varinvexpexp(p, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
esinvexpexp(p, lambda=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dinvexpexp(x)
pinvexpexp(x)
varinvexpexp(x)
esinvexpexp(x)

Inverse gamma distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the inverse gamma distribution given by

f(x)=baexp(b/x)xa+1Γ(a),F(x)=Q(a,b/x),VaRp(X)=b[Q1(a,p)]1,ESp(X)=bp0p[Q1(a,v)]1dv\begin{array}{ll} &\displaystyle f (x) = \frac {b^a \exp (-b / x)}{x^{a + 1} \Gamma (a)}, \\ &\displaystyle F (x) = Q (a, b / x), \\ &\displaystyle {\rm VaR}_p (X) = b \left[ Q^{-1} (a, p) \right]^{-1}, \\ &\displaystyle {\rm ES}_p (X) = \frac {b}{p} \int_0^p \left[ Q^{-1} (a, v) \right]^{-1} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and b>0b > 0, the scale parameter.

Usage

dinvgamma(x, a=1, b=1, log=FALSE)
pinvgamma(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varinvgamma(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esinvgamma(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dinvgamma(x)
pinvgamma(x)
varinvgamma(x)
esinvgamma(x)

Kumaraswamy distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy distribution due to Kumaraswamy (1980) given by

f(x)=abxa1(1xa)b1,F(x)=1(1xa)b,VaRp(X)=[1(1p)1/b]1/a,ESp(X)=1p0p[1(1v)1/b]1/adv\begin{array}{ll} &\displaystyle f (x) = a b x^{a - 1} \left( 1 - x^a \right)^{b - 1}, \\ &\displaystyle F (x) = 1 - \left( 1 - x^a \right)^b, \\ &\displaystyle {\rm VaR}_p (X) = \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} dv \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dkum(x, a=1, b=1, log=FALSE)
pkum(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varkum(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
eskum(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkum(x)
pkum(x)
varkum(x)
eskum(x)

Kumaraswamy Burr XII distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy Burr XII distribution due to Parana\'iba et al. (2013) given by

f(x)=abkcxc1(1+xc)k+1[1(1+xc)k]a1{1[1(1+xc)k]a}b1,F(x)=1{1[1(1+xc)k]a}b,VaRp(X)=[{1[1(1p)1/b]1/a}1/k1]1/c,ESp(X)=1p0p[{1[1(1v)1/b]1/a}1/k1]1/cdv\begin{array}{ll} &\displaystyle f (x) = \frac {a b k c x^{c - 1}}{\left( 1 + x^c \right)^{k + 1}} \left[ 1 - \left( 1 + x^c \right)^{-k} \right]^{a - 1} \left\{ 1 - \left[ 1 - \left( 1 + x^c \right)^{-k} \right]^a \right\}^{b - 1}, \\ &\displaystyle F (x) = 1 - \left\{ 1 - \left[ 1 - \left( 1 + x^c \right)^{-k} \right]^a \right\}^b, \\ &\displaystyle {\rm VaR}_p (X) = \left[ \left\{ 1 - \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right\}^{-1 / k} - 1 \right]^{1/c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \left[ \left\{ 1 - \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right\}^{-1 / k} - 1 \right]^{1/c} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, c>0c > 0, the third shape parameter, and k>0k > 0, the fourth shape parameter.

Usage

dkumburr7(x, a=1, b=1, k=1, c=1, log=FALSE)
pkumburr7(x, a=1, b=1, k=1, c=1, log.p=FALSE, lower.tail=TRUE)
varkumburr7(p, a=1, b=1, k=1, c=1, log.p=FALSE, lower.tail=TRUE)
eskumburr7(p, a=1, b=1, k=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

c

the value of the third shape parameter, must be positive, the default is 1

k

the value of the fourth shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumburr7(x)
pkumburr7(x)
varkumburr7(x)
eskumburr7(x)

Kumaraswamy exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy exponential distribution due to Cordeiro and de Castro (2011) given by

f(x)=abλexp(λx)[1exp(λx)]a1{1[1exp(λx)]a}b1,F(x)=1{1[1exp(λx)]a}b,VaRp(X)=1λlog{1[1(1p)1/b]1/a},ESp(X)=1pλ0plog{1[1(1v)1/b]1/a}dv\begin{array}{ll} &\displaystyle f (x) = a b \lambda \exp (-\lambda x) \left[ 1 - \exp (-\lambda x) \right]^{a - 1} \left\{ 1 - \left[ 1 - \exp (-\lambda x) \right]^a \right\}^{b - 1}, \\ &\displaystyle F (x) = 1 - \left\{ 1 - \left[ 1 - \exp (-\lambda x) \right]^a \right\}^b, \\ &\displaystyle {\rm VaR}_p (X) = -\frac {1}{\lambda} \log \left\{ 1 - \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right\}, \\ &\displaystyle {\rm ES}_p (X) = -\frac {1}{p \lambda} \int_0^p \log \left\{ 1 - \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right\} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, and λ>0\lambda > 0, the scale parameter.

Usage

dkumexp(x, lambda=1, a=1, b=1, log=FALSE)
pkumexp(x, lambda=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varkumexp(p, lambda=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
eskumexp(p, lambda=1, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumexp(x)
pkumexp(x)
varkumexp(x)
eskumexp(x)

Kumaraswamy gamma distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy gamma distribution due to de Pascoa et al. (2011) given by

f(x)=cdbaxa1exp(bx)γc1(a,bx)Γc(a)[1γc(a,bx)Γc(a)]d1,F(x)=1[1γc(a,bx)Γc(a)]d,VaRp(X)=1bQ1(a,1[1(1p)1/d]1/c),ESp(X)=1bp0pQ1(a,1[1(1v)1/d]1/c)dv\begin{array}{ll} &\displaystyle f (x) = c d b^a x^{a - 1} \exp (-b x) \frac {\gamma^{c - 1} (a, b x)}{\Gamma^c (a)} \left[ 1 - \frac {\gamma^c (a, b x)}{\Gamma^c (a)} \right]^{d - 1}, \\ &\displaystyle F (x) = 1 - \left[ 1 - \frac {\gamma^c (a, b x)}{\Gamma^c (a)} \right]^d, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{b} Q^{-1} \left( a, 1 - \left[ 1 - (1 - p)^{1 / d} \right]^{1 / c} \right), \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{b p} \int_0^p Q^{-1} \left( a, 1 - \left[ 1 - (1 - v)^{1 / d} \right]^{1 / c} \right) dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the scale parameter, c>0c > 0, the second shape parameter, and d>0d > 0, the third shape parameter.

Usage

dkumgamma(x, a=1, b=1, c=1, d=1, log=FALSE)
pkumgamma(x, a=1, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
varkumgamma(p, a=1, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
eskumgamma(p, a=1, b=1, c=1, d=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

d

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumgamma(x)
pkumgamma(x)
varkumgamma(x)
eskumgamma(x)

Kumaraswamy Gumbel distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy Gumbel distribution due to Cordeiro et al. (2012a) given by

f(x)=abσexp(μxσ)exp[aexp(μxσ)]{1exp[aexp(μxσ)]}b1,F(x)=1{1exp[aexp(μxσ)]}b,VaRp(X)=μσlog{log[1(1p)1/b]1/a},ESp(X)=μσp0plog{log[1(1v)1/b]1/a}dv\begin{array}{ll} &\displaystyle f (x) = \frac {a b}{\sigma} \exp \left( \frac {\mu - x}{\sigma} \right) \exp \left[ -a \exp \left( \frac {\mu - x}{\sigma} \right) \right] \left\{ 1 - \exp \left[ -a \exp \left( \frac {\mu - x}{\sigma} \right) \right] \right\}^{b - 1}, \\ &\displaystyle F (x) = 1 - \left\{ 1 - \exp \left[ -a \exp \left( \frac {\mu - x}{\sigma} \right) \right] \right\}^b, \\ &\displaystyle {\rm VaR}_p (X) = \mu - \sigma \log \left\{ -\log \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right\}, \\ &\displaystyle {\rm ES}_p (X) = \mu - \frac {\sigma}{p} \int_0^p \log \left\{ -\log \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right\} dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dkumgumbel(x, a=1, b=1, mu=0, sigma=1, log=FALSE)
pkumgumbel(x, a=1, b=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varkumgumbel(p, a=1, b=1, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
eskumgumbel(p, a=1, b=1, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumgumbel(x)
pkumgumbel(x)
varkumgumbel(x)
eskumgumbel(x)

Kumaraswamy half normal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy half normal distribution due to Cordeiro et al. (2012c) given by

f(x)=2abσϕ(xσ)[2Φ(xσ)1]a1{1[2Φ(xσ)1]a}b1,F(x)=1{1[2Φ(xσ)1]a}b,VaRp(X)=σΦ1(12+12[1(1p)1/b]1/a),ESp(X)=σp0pΦ1(12+12[1(1v)1/b]1/a)dv\begin{array}{ll} &\displaystyle f (x) = \frac {2a b}{\sigma} \phi \left( \frac {x}{\sigma} \right) \left[ 2 \Phi \left( \frac {x}{\sigma} \right) - 1 \right]^{a - 1} \left\{ 1 - \left[ 2 \Phi \left( \frac {x}{\sigma} \right) - 1 \right]^a \right\}^{b - 1}, \\ &\displaystyle F (x) = 1 - \left\{ 1 - \left[ 2 \Phi \left( \frac {x}{\sigma} \right) - 1 \right]^a \right\}^b, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \Phi^{-1} \left( \frac {1}{2} + \frac {1}{2} \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right), \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \Phi^{-1} \left( \frac {1}{2} + \frac {1}{2} \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right) dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, σ>0\sigma > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dkumhalfnorm(x, sigma=1, a=1, b=1, log=FALSE)
pkumhalfnorm(x, sigma=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varkumhalfnorm(p, sigma=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
eskumhalfnorm(p, sigma=1, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumhalfnorm(x)
pkumhalfnorm(x)
varkumhalfnorm(x)
eskumhalfnorm(x)

Kumaraswamy log-logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy log-logistic distribution due to de Santana et al. (2012) given by

f(x)=abβαβxaβ1(αβ+xβ)a+1[1xaβ(αβ+xβ)a]b1,F(x)=[1xaβ(αβ+xβ)a]b,VaRp(X)=α{[1(1p)1/b]1/a1}1/β,ESp(X)=αp0p{[1(1v)1/b]1/a1}1/βdv\begin{array}{ll} &\displaystyle f (x) = \frac {a b \beta \alpha^\beta x^{a \beta - 1}} {\left( \alpha^\beta + x^\beta \right)^{a + 1}} \left[ 1 - \frac {x^{a \beta}}{\left( \alpha^\beta + x^\beta \right)^a} \right]^{b - 1}, \\ &\displaystyle F (x) = \left[ 1 - \frac {x^{a \beta}}{\left( \alpha^\beta + x^\beta \right)^a} \right]^b, \\ &\displaystyle {\rm VaR}_p (X) = \alpha \left\{ \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} - 1 \right\}^{-1 / \beta}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\alpha}{p} \int_0^p \left\{ \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} - 1 \right\}^{-1 / \beta} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, α>0\alpha > 0, the scale parameter, β>0\beta > 0, the first shape parameter, a>0a > 0, the second shape parameter, and b>0b > 0, the third shape parameter.

Usage

dkumloglogis(x, a=1, b=1, alpha=1, beta=1, log=FALSE)
pkumloglogis(x, a=1, b=1, alpha=1, beta=1, log.p=FALSE, lower.tail=TRUE)
varkumloglogis(p, a=1, b=1, alpha=1, beta=1, log.p=FALSE, lower.tail=TRUE)
eskumloglogis(p, a=1, b=1, alpha=1, beta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

alpha

the value of the scale parameter, must be positive, the default is 1

beta

the value of the first shape parameter, must be positive, the default is 1

a

the value of the second shape parameter, must be positive, the default is 1

b

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumloglogis(x)
pkumloglogis(x)
varkumloglogis(x)
eskumloglogis(x)

Kumaraswamy normal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for Kumaraswamy normal distribution due to Cordeiro and de Castro (2011) given by

f(x)=abσϕ(xμσ)Φa1(xμσ)[1Φa(xμσ)]b1,F(x)=1[1Φa(xμσ)]b,VaRp(X)=μ+σΦ1([1(1p)1/b]1/a),ESp(X)=μ+σp0pΦ1([1(1v)1/b]1/a)dv\begin{array}{ll} &\displaystyle f (x) = \frac {a b}{\sigma} \phi \left( \frac {x - \mu}{\sigma} \right) \Phi^{a - 1} \left( \frac {x - \mu}{\sigma} \right) \left[ 1 - \Phi^a \left( \frac {x - \mu}{\sigma} \right) \right]^{b - 1}, \\ &\displaystyle F (x) = 1 - \left[ 1 - \Phi^a \left( \frac {x - \mu}{\sigma} \right) \right]^b, \\ &\displaystyle {\rm VaR}_p (X) = \mu + \sigma \Phi^{-1} \left( \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right), \\ &\displaystyle {\rm ES}_p (X) = \mu + \frac {\sigma}{p} \int_0^p \Phi^{-1} \left( \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, σ>0\sigma > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dkumnormal(x, mu=0, sigma=1, a=1, b=1, log=FALSE)
pkumnormal(x, mu=0, sigma=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varkumnormal(p, mu=0, sigma=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
eskumnormal(p, mu=0, sigma=1, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumnormal(x)
pkumnormal(x)
varkumnormal(x)
eskumnormal(x)

Kumaraswamy Pareto distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy Pareto distribution due to Pereira et al. (2013) given by

f(x)=abcKcxc1[1(Kx)c]a1{1[1(Kx)c]a}b1,F(x)=1{1[1(Kx)c]a}b,VaRp(X)=K{1[1(1p)1/b]1/a}1/c,ESp(X)=Kp0p{1[1(1v)1/b]1/a}1/cdv\begin{array}{ll} &\displaystyle f (x) = a b c K^c x^{-c - 1} \left[ 1 - \left( \frac {K}{x} \right)^c \right]^{a - 1} \left\{ 1 - \left[ 1 - \left( \frac {K}{x} \right)^c \right]^a \right\}^{b - 1}, \\ &\displaystyle F (x) = 1 - \left\{ 1 - \left[ 1 - \left( \frac {K}{x} \right)^c \right]^a \right\}^b, \\ &\displaystyle {\rm VaR}_p (X) = K \left\{ 1 - \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right\}^{-1 / c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {K}{p} \int_0^p \left\{ 1 - \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right\}^{-1 / c} dv \end{array}

for xKx \geq K, 0<p<10 < p < 1, K>0K > 0, the scale parameter, c>0c > 0, the first shape parameter, a>0a > 0, the second shape parameter, and b>0b > 0, the third shape parameter.

Usage

dkumpareto(x, K=1, a=1, b=1, c=1, log=FALSE)
pkumpareto(x, K=1, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
varkumpareto(p, K=1, a=1, b=1, c=1, log.p=FALSE, lower.tail=TRUE)
eskumpareto(p, K=1, a=1, b=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

K

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

c

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumpareto(x)
pkumpareto(x)
varkumpareto(x)
eskumpareto(x)

Kumaraswamy Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Kumaraswamy Weibull distribution due to Cordeiro et al. (2010) given by

f(x)=abαxα1σαexp[(xσ)α]{1exp[(xσ)α]}a1[1{1exp[(xσ)α]}a]b1,F(x)=1[1{1exp[(xσ)α]}a]b,VaRp(X)=σ[log{1[1(1p)1/b]1/a}]1/α,ESp(X)=σp0p[log{1[1(1v)1/b]1/a}]1/αdv\begin{array}{ll} &\displaystyle f (x) = \frac {a b \alpha x^{\alpha - 1}}{\sigma^\alpha} \exp \left[ -\left( \frac {x}{\sigma} \right)^{\alpha} \right] \left\{ 1 - \exp \left[ -\left( \frac {x}{\sigma} \right)^{\alpha} \right] \right\}^{a - 1} \left[ 1 - \left\{ 1 - \exp \left[ -\left( \frac {x}{\sigma} \right)^{\alpha} \right] \right\}^a \right]^{b - 1}, \\ &\displaystyle F (x) = 1 - \left[ 1 - \left\{ 1 - \exp \left[ -\left( \frac {x}{\sigma} \right)^{\alpha} \right] \right\}^a \right]^b, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \left[ -\log \left\{ 1 - \left[ 1 - (1 - p)^{1 / b} \right]^{1 / a} \right\} \right]^{1 / \alpha}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \left[ -\log \left\{ 1 - \left[ 1 - (1 - v)^{1 / b} \right]^{1 / a} \right\} \right]^{1 / \alpha} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, α>0\alpha > 0, the third shape parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dkumweibull(x, a=1, b=1, alpha=1, sigma=1, log=FALSE)
pkumweibull(x, a=1, b=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varkumweibull(p, a=1, b=1, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
eskumweibull(p, a=1, b=1, alpha=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

alpha

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dkumweibull(x)
pkumweibull(x)
varkumweibull(x)
eskumweibull(x)

Laplace distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Laplace distribution due to due to Laplace (1774) given by

f(x)=12σexp(xμσ),F(x)={12exp(xμσ),if x<μ,112exp(xμσ),if xμ,VaRp(X)={μ+σlog(2p),if p<1/2,μσlog[2(1p)],if p1/2,ESp(X)={μ+σ[log(2p)1],if p<1/2,μ+σσp+σ1pplog(1p)+σ1pplog2,if p1/2\begin{array}{ll} &\displaystyle f (x) = \frac {1}{2 \sigma} \exp \left( -\frac {\mid x - \mu \mid}{\sigma} \right), \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2} \exp \left( \frac {x - \mu}{\sigma} \right), & \mbox{if $x < \mu$,} \\ \\ \displaystyle 1 - \frac {1}{2} \exp \left( -\frac {x - \mu}{\sigma} \right), & \mbox{if $x \geq \mu$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \mu + \sigma \log (2 p), & \mbox{if $p < 1/2$,} \\ \\ \displaystyle \mu - \sigma \log \left[ 2 (1 - p) \right], & \mbox{if $p \geq 1/2$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \mu + \sigma \left[ \log (2 p) - 1 \right], & \mbox{if $p < 1/2$,} \\ \\ \displaystyle \mu + \sigma - \frac {\sigma}{p} + \sigma \frac {1 - p}{p} \log (1 - p) +\sigma \frac {1 - p}{p} \log 2, & \mbox{if $p \geq 1/2$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dlaplace(x, mu=0, sigma=1, log=FALSE)
plaplace(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varlaplace(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
eslaplace(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlaplace(x)
plaplace(x)
varlaplace(x)
eslaplace(x)

Linear failure rate distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the linear failure rate distribution due to Bain (1974) given by

f(x)=(a+bx)exp(axbx2/2),F(x)=1exp(axbx2/2),VaRp(X)=a+a22blog(1p)b,ESp(X)=ab+1bp0pa22blog(1v)dv\begin{array}{ll} &\displaystyle f(x) = (a + b x) \exp \left( -a x - b x^2 / 2 \right), \\ &\displaystyle F (x) = 1 - \exp \left( -a x - b x^2 / 2 \right), \\ &\displaystyle {\rm VaR}_p (X) = \frac {-a + \sqrt{a^2 - 2 b \log (1 - p)}}{b}, \\ &\displaystyle {\rm ES}_p (X) = -\frac {a}{b} + \frac {1}{b p} \int_0^p \sqrt{a^2 - 2 b \log (1 - v)} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first scale parameter, and b>0b > 0, the second scale parameter.

Usage

dlfr(x, a=1, b=1, log=FALSE)
plfr(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varlfr(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
eslfr(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

b

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlfr(x)
plfr(x)
varlfr(x)
eslfr(x)

Libby-Novick beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Libby-Novick beta distribution due to Libby and Novick (1982) given by

f(x)=λaxa1(1x)b1B(a,b)[1(1λ)x]a+b,F(x)=Iλx1+(λ1)x(a,b),VaRp(X)=Ip1(a,b)λ(λ1)Ip1(a,b),ESp(X)=1p0pIv1(a,b)λ(λ1)Iv1(a,b)dv\begin{array}{ll} &\displaystyle f (x) = \frac {\lambda^a x^{a - 1} (1 - x)^{b - 1}} {B (a, b) \left[ 1 - (1 - \lambda) x \right]^{a + b}}, \\ &\displaystyle F (x) = I_{\frac {\lambda x}{1 + (\lambda - 1) x}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = \frac {I_p^{-1} (a, b)}{\lambda - (\lambda - 1) I_p^{-1} (a, b)}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \frac {I_v^{-1} (a, b)}{\lambda - (\lambda - 1) I_v^{-1} (a, b)} dv \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, λ>0\lambda > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dLNbeta(x, lambda=1, a=1, b=1, log=FALSE)
pLNbeta(x, lambda=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varLNbeta(p, lambda=1, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esLNbeta(p, lambda=1, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dLNbeta(x)
pLNbeta(x)
varLNbeta(x)
esLNbeta(x)

Log beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the log beta distribution given by

f(x)=(logdlogc)1abxB(a,b)(logxlogc)a1(logdlogx)b1,F(x)=Ilogxlogclogdlogc(a,b),VaRp(X)=c(dc)Ip1(a,b),ESp(X)=cp0p(dc)Iv1(a,b)dv\begin{array}{ll} &\displaystyle f (x) = \frac {(\log d - \log c)^{1 - a - b}}{x B (a, b)} (\log x - \log c)^{a - 1} (\log d - \log x)^{b - 1}, \\ &\displaystyle F (x) = I_{\frac {\log x - \log c}{\log d - \log c}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = c \left( \frac {d}{c} \right)^{I_p^{-1} (a, b)}, \\ &\displaystyle {\rm ES}_p (X) = \frac {c}{p} \int_0^p \left( \frac {d}{c} \right)^{I_v^{-1} (a, b)} dv \end{array}

for 0<cxd0 < c \leq x \leq d, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, c>0c > 0, the first location parameter, and d>0d > 0, the second location parameter.

Usage

dlogbeta(x, a=1, b=1, c=1, d=2, log=FALSE)
plogbeta(x, a=1, b=1, c=1, d=2, log.p=FALSE, lower.tail=TRUE)
varlogbeta(p, a=1, b=1, c=1, d=2, log.p=FALSE, lower.tail=TRUE)
eslogbeta(p, a=1, b=1, c=1, d=2)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

c

the value of the first location parameter, must be positive, the default is 1

d

the value of the second location parameter, must be positive and greater than c, the default is 2

a

the value of the first scale parameter, must be positive, the default is 1

b

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlogbeta(x)
plogbeta(x)
varlogbeta(x)
eslogbeta(x)

Log Cauchy distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the log Cauchy distribution given by

f(x)=1xπσ(logxμ)2+σ2,F(x)=1πarctan(logxμσ),VaRp(X)=exp[μ+σtan(πp)],ESp(X)=exp(μ)p0pexp[σtan(πv)]dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{x \pi} \frac {\sigma}{(\log x - \mu)^2 + \sigma^2}, \\ &\displaystyle F (x) = \frac {1}{\pi} \arctan \left( \frac {\log x - \mu}{\sigma} \right), \\ &\displaystyle {\rm VaR}_p (X) = \exp \left[ \mu + \sigma \tan \left( \pi p \right) \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {\exp (\mu)}{p} \int_0^p \exp \left[ \sigma \tan \left( \pi v \right) \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dlogcauchy(x, mu=0, sigma=1, log=FALSE)
plogcauchy(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varlogcauchy(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
eslogcauchy(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlogcauchy(x)
plogcauchy(x)
varlogcauchy(x)

 eslogcauchy(x)

Log gamma distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the log gamma distribution due to Consul and Jain (1971) given by

f(x)=arxa1(logx)r1Γ(r),F(x)=Q(r,alogx),VaRp(X)=exp[1aQ1(r,p)],ESp(X)=1p0pexp[1aQ1(r,v)]dv\begin{array}{ll} &\displaystyle f (x) = \frac {a^r x^{a - 1} (-\log x)^{r - 1}}{\Gamma (r)}, \\ &\displaystyle F (x) = Q (r, -a \log x), \\ &\displaystyle {\rm VaR}_p (X) = \exp \left[ -\frac {1}{a} Q^{-1} (r, p) \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p} \int_0^p \exp \left[ -\frac {1}{a} Q^{-1} (r, v) \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first shape parameter, and r>0r > 0, the second shape parameter.

Usage

dloggamma(x, a=1, r=1, log=FALSE)
ploggamma(x, a=1, r=1, log.p=FALSE, lower.tail=TRUE)
varloggamma(p, a=1, r=1, log.p=FALSE, lower.tail=TRUE)
esloggamma(p, a=1, r=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

r

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dloggamma(x)
ploggamma(x)
varloggamma(x)
esloggamma(x)

Logistic exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the logistic exponential distribution due to Lan and Leemis (2008) given by

f(x)=aλexp(λx)[exp(λx)1]a1{1+[exp(λx)1]a}2,F(x)=[exp(λx)1]a1+[exp(λx)1]a,VaRp(X)=1λlog[1+(p1p)1/a],ESp(X)=1pλ0plog[1+(v1v)1/a]dv\begin{array}{ll} &\displaystyle f (x) = \frac {\displaystyle a \lambda \exp (\lambda x) \left[ \exp (\lambda x) - 1 \right]^{a - 1}} {\displaystyle \left\{ 1 + \left[ \exp (\lambda x) - 1 \right]^a \right\}^2}, \\ &\displaystyle F (x) = \frac {\displaystyle \left[ \exp (\lambda x) - 1 \right]^a} {\displaystyle 1 + \left[ \exp (\lambda x) - 1 \right]^a}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{\lambda} \log \left[ 1 + \left( \frac {p}{1 - p} \right)^{1 / a} \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p \lambda} \int_0^p \log \left[ 1 + \left( \frac {v}{1 - v} \right)^{1 / a} \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter and λ>0\lambda > 0, the scale parameter.

Usage

dlogisexp(x, lambda=1, a=1, log=FALSE)
plogisexp(x, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
varlogisexp(p, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
eslogisexp(p, lambda=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlogisexp(x)
plogisexp(x)
varlogisexp(x)
eslogisexp(x)

Logistic Rayleigh distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the logistic Rayleigh distribution due to Lan and Leemis (2008) given by

f(x)=aλxexp(λx2/2)[exp(λx2/2)1]a1{1+[exp(λx2/2)1]a}2,F(x)=[exp(λx2/2)1]a1+[exp(λx2/2)1]a,VaRp(X)=2λlog[1+(p1p)1/a],ESp(X)=2pλ0p{log[1+(v1v)1/a]}1/2dv\begin{array}{ll} &\displaystyle f(x) = a \lambda x \exp \left( \lambda x^2 / 2 \right) \left[ \exp \left( \lambda x^2 / 2 \right) - 1 \right]^{a - 1} \left\{ 1 + \left[ \exp \left( \lambda x^2 / 2 \right) - 1 \right]^a \right\}^{-2}, \\ &\displaystyle F(x) = \frac {\left[ \exp \left( \lambda x^2 / 2 \right) - 1 \right]^a} {1 + \left[ \exp \left( \lambda x^2 / 2 \right) - 1 \right]^a}, \\ &\displaystyle {\rm VaR}_p (X) = \sqrt{\frac {2}{\lambda}} \sqrt{\log \left[ 1 + \left( \frac {p}{1 - p} \right)^{1 / a} \right]}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sqrt{2}}{p \sqrt{\lambda}} \int_0^p \left\{ \log \left[ 1 + \left( \frac {v}{1 - v} \right)^{1 / a} \right] \right\}^{1/2} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and λ>0\lambda > 0, the scale parameter.

Usage

dlogisrayleigh(x, a=1, lambda=1, log=FALSE)
plogisrayleigh(x, a=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varlogisrayleigh(p, a=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
eslogisrayleigh(p, a=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlogisrayleigh(x)
plogisrayleigh(x)
varlogisrayleigh(x)
eslogisrayleigh(x)

Logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the logistic distribution given by

f(x)=1σexp(xμσ)[1+exp(xμσ)]2,F(x)=11+exp(xμσ),VaRp(X)=μ+σlog[p(1p)],ESp(X)=μ2σ+σlogpσ1pplog(1p)\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma} \exp \left( -\frac {x - \mu}{\sigma} \right) \left[ 1 + \exp \left( -\frac {x - \mu}{\sigma} \right) \right]^{-2}, \\ &\displaystyle F (x) = \frac {1}{1 + \exp \left( -\frac {x - \mu}{\sigma} \right)}, \\ &\displaystyle {\rm VaR}_p (X) = \mu + \sigma \log \left[ p (1 - p) \right], \\ &\displaystyle {\rm ES}_p (X) = \mu - 2 \sigma + \sigma \log p - \sigma \frac {1 - p}{p} \log (1 - p) \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dlogistic(x, mu=0, sigma=1, log=FALSE)
plogistic(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varlogistic(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
eslogistic(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlogistic(x)
plogistic(x)
varlogistic(x)
eslogistic(x)

Log Laplace distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the log Laplace distribution given by

f(x)={abxb1δb(a+b),if xδ,abδaxa+1(a+b),if x>δ,F(x)={axbδb(a+b),if xδ,1bδaxa(a+b),if x>δ,VaRp(X)={δ[pa+ba]1/b,if paa+b,δ[(1p)a+ba]1/a,if p>aa+b,ESp(X)={δbb+1[pa+ba]1/b,if paa+b,aδp(1+1/b)(a+b)+a1/ab11/aδp(a+b)(11/a)δ(1p)p(11/a)[a(a+b)(1p)]1/a,if p>aa+b\begin{array}{ll} &\displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle \frac {a b x^{b - 1}}{\delta^b (a + b)}, & \mbox{if $x \leq \delta$,} \\ \\ \displaystyle \frac {a b \delta^a}{x^{a + 1} (a + b)}, & \mbox{if $x > \delta$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {a x^b}{\delta^b (a + b)}, & \mbox{if $x \leq \delta$,} \\ \\ \displaystyle 1 - \frac {b \delta^a}{x^a (a + b)}, & \mbox{if $x > \delta$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \delta \left[ p \frac {a + b}{a} \right]^{1/b}, & \mbox{if $p \leq \frac {a}{a + b}$,} \\ \\ \displaystyle \delta \left[ (1 - p) \frac {a + b}{a} \right]^{-1/a}, & \mbox{if $p > \frac {a}{a + b}$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \frac {\delta b}{b + 1} \left[ p \frac {a + b}{a} \right]^{1/b}, & \mbox{if $p \leq \frac {a}{a + b}$,} \\ \\ \displaystyle \frac {a \delta}{p (1 + 1/b) (a + b)} + \frac {a^{1/a} b^{1 - 1/a} \delta}{p (a + b) (1 - 1/a)} \\ \displaystyle \quad -\frac {\delta (1 - p)}{p (1 - 1/a)} \left[ \frac {a}{(a + b) (1 - p)} \right]^{1/a}, & \mbox{if $p > \frac {a}{a + b}$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, δ>0\delta > 0, the scale parameter, a>0a > 0, the first shape parameter, and b>0b > 0, the second shape parameter.

Usage

dloglaplace(x, a=1, b=1, delta=0, log=FALSE)
ploglaplace(x, a=1, b=1, delta=0, log.p=FALSE, lower.tail=TRUE)
varloglaplace(p, a=1, b=1, delta=0, log.p=FALSE, lower.tail=TRUE)
esloglaplace(p, a=1, b=1, delta=0)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

delta

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dloglaplace(x)
ploglaplace(x)
varloglaplace(x)
esloglaplace(x)

Loglog distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Loglog distribution due to Pham (2002) given by

f(x)=alog(λ)xa1λxaexp[1λxa],F(x)=1exp[1λxa],VaRp(X)={log[1log(1p)]logλ}1/a,ESp(X)=1p(logλ)1/a0p{log[1log(1v)]}1/adv\begin{array}{ll} &\displaystyle f(x) = a \log (\lambda) x^{a - 1} \lambda^{x^a} \exp \left[ 1 - \lambda^{x^a} \right], \\ &\displaystyle F (x) = 1 - \exp \left[ 1 - \lambda^{x^a} \right], \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \frac {\log \left[ 1 - \log (1 - p) \right]}{\log \lambda} \right\}^{1/a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{p (\log \lambda)^{1/a}} \int_0^p \left\{ \log \left[ 1 - \log (1 - v) \right] \right\}^{1/a} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and λ>1\lambda > 1, the scale parameter.

Usage

dloglog(x, a=1, lambda=2, log=FALSE)
ploglog(x, a=1, lambda=2, log.p=FALSE, lower.tail=TRUE)
varloglog(p, a=1, lambda=2, log.p=FALSE, lower.tail=TRUE)
esloglog(p, a=1, lambda=2)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be greater than 1, the default is 2

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dloglog(x)
ploglog(x)
varloglog(x)
esloglog(x)

Log-logistic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the log-logistic distribution given by

f(x)=babxb1(ab+xb)2,F(x)=xbab+xb,VaRp(X)=a(p1p)1/b,ESp(X)=apBp(1+1b,11b)\begin{array}{ll} &\displaystyle f (x) = \frac {b a^b x^{b - 1}} {\left( a^b + x^b \right)^2}, \\ &\displaystyle F (x) = \frac {x^b}{a^b + x^b}, \\ &\displaystyle {\rm VaR}_p (X) = a \left( \frac {p}{1 - p} \right)^{1 / b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {a}{p} B_p \left( 1 + \frac {1}{b}, 1 - \frac {1}{b} \right) \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the scale parameter, and b>0b > 0, the shape parameter, where Bx(a,b)=0xta1(1t)b1dtB_x (a, b) = \int_0^x t^{a - 1} (1 - t)^{b - 1} dt denotes the incomplete beta function.

Usage

dloglogis(x, a=1, b=1, log=FALSE)
ploglogis(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varloglogis(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esloglogis(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the scale parameter, must be positive, the default is 1

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dloglogis(x)
ploglogis(x)
varloglogis(x)
esloglogis(x)

Lognormal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the lognormal distribution given by

f(x)=1σxϕ(logxμσ),F(x)=Φ(logxμσ),VaRp(X)=exp[μ+σΦ1(p)],ESp(X)=exp(μ)p0pexp[σΦ1(v)]dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma x} \phi \left( \frac {\log x - \mu}{\sigma} \right), \\ &\displaystyle F (x) = \Phi \left( \frac {\log x - \mu}{\sigma} \right), \\ &\displaystyle {\rm VaR}_p (X) = \exp \left[ \mu + \sigma \Phi^{-1} (p) \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {\exp (\mu)}{p} \int_0^p \exp \left[ \sigma \Phi^{-1} (v) \right] dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dlognorm(x, mu=0, sigma=1, log=FALSE)
plognorm(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varlognorm(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
eslognorm(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlognorm(x)
plognorm(x)
varlognorm(x)
eslognorm(x)

Lomax distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Lomax distribution due to Lomax (1954) given by

f(x)=aλ(1+xλ)a1,F(x)=1(1+xλ)a,VaRp(X)=λ[(1p)1/a1],ESp(X)=λ+λλ(1p)11/app/a\begin{array}{ll} &\displaystyle f (x) = \frac {a}{\lambda} \left( 1 + \frac {x}{\lambda} \right)^{-a - 1}, \\ &\displaystyle F (x) = 1 - \left( 1 + \frac {x}{\lambda} \right)^{-a}, \\ &\displaystyle {\rm VaR}_p (X) = \lambda \left[ (1 - p)^{-1 / a} - 1 \right], \\ &\displaystyle {\rm ES}_p (X) = -\lambda + \frac {\lambda - \lambda (1 - p)^{1 - 1 / a}}{p - p / a} \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and λ>0\lambda > 0, the scale parameter.

Usage

dlomax(x, a=1, lambda=1, log=FALSE)
plomax(x, a=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varlomax(p, a=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
eslomax(p, a=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dlomax(x)
plomax(x)
varlomax(x)
eslomax(x)

McGill Laplace distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the McGill Laplace distribution due to McGill (1962) given by

f(x)={12ψexp(xθψ),if xθ,12ϕexp(θxϕ),if x>θ,F(x)={12exp(xθψ),if xθ,112exp(θxϕ),if x>θ,VaRp(X)={θ+ψlog(2p),if p1/2,θϕlog(2(1p)),if p>1/2,ESp(X)={ψ+θlog(2p)θp,if p1/2,θ+ϕ+ψϕ2θ2p+ϕplog2ϕlog2+ϕplog(1p)ϕlog(1p),if p>1/2\begin{array}{ll} &\displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2 \psi} \exp \left( \frac {x - \theta}{\psi} \right), & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle \frac {1}{2 \phi} \exp \left( \frac {\theta - x}{\phi} \right), & \mbox{if $x > \theta$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2} \exp \left( \frac {x - \theta}{\psi} \right), & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle 1 - \frac {1}{2} \exp \left( \frac {\theta - x}{\phi} \right), & \mbox{if $x > \theta$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta + \psi \log (2 p), & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \theta - \phi \log \left( 2 (1 - p) \right), & \mbox{if $p > 1/2$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \psi + \theta \log (2 p) - \theta p, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \theta + \phi + \frac {\psi - \phi - 2 \theta}{2 p} + \frac {\phi}{p} \log 2 - \phi \log 2 \\ \displaystyle \quad +\frac {\phi}{p} \log (1 - p) - \phi \log (1 - p), & \mbox{if $p > 1/2$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <θ<-\infty < \theta < \infty, the location parameter, ϕ>0\phi > 0, the first scale parameter, and ψ>0\psi > 0, the second scale parameter.

Usage

dMlaplace(x, theta=0, phi=1, psi=1, log=FALSE)
pMlaplace(x, theta=0, phi=1, psi=1, log.p=FALSE, lower.tail=TRUE)
varMlaplace(p, theta=0, phi=1, psi=1, log.p=FALSE, lower.tail=TRUE)
esMlaplace(p, theta=0, phi=1, psi=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, can take any real value, the default is zero

phi

the value of the first scale parameter, must be positive, the default is 1

psi

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dMlaplace(x)
pMlaplace(x)
varMlaplace(x)
esMlaplace(x)

Marshall-Olkin exponential distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Marshall-Olkin exponential distribution due to Marshall and Olkin (1997) given by

f(x)=λexp(λx)[exp(λx)1+a]2,F(x)=exp(λx)2+aexp(λx)1+a,VaRp(X)=1λlog2a(1a)p1p,ESp(X)=1λlog[2a(1a)p]2aλ(1a)plog2a(1a)p2a+1pλplog(1p)\begin{array}{ll} &\displaystyle f (x) = \frac {\displaystyle \lambda \exp (\lambda x)} {\displaystyle \left[ \exp (\lambda x) - 1 + a \right]^2}, \\ &\displaystyle F (x) = \frac {\displaystyle \exp (\lambda x) - 2 + a}{\displaystyle \exp (\lambda x) - 1 + a}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{\lambda} \log \frac {2 - a - (1 - a) p}{1 - p}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{\lambda} \log \left[ 2 - a - (1 - a) p \right] - \frac {2 - a}{\lambda (1 - a) p} \log \frac {2 - a - (1 - a) p}{2 - a} + \frac {1 - p}{\lambda p} \log (1 - p) \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first scale parameter and λ>0\lambda > 0, the second scale parameter.

Usage

dmoexp(x, lambda=1, a=1, log=FALSE)
pmoexp(x, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
varmoexp(p, lambda=1, a=1, log.p=FALSE, lower.tail=TRUE)
esmoexp(p, lambda=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

lambda

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dmoexp(x)
pmoexp(x)
varmoexp(x)
esmoexp(x)

Marshall-Olkin Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Marshall-Olkin Weibull distribution due to Marshall and Olkin (1997) given by

f(x)=bλbxb1exp[(λx)b]{exp[(λx)b]1+a}2,F(x)=exp[(λx)b]2+aexp[(λx)b]1+a,VaRp(X)=1λ[log(11p+1a)]1/b,ESp(X)=1λp0p[log(11v+1a)]1/bdv\begin{array}{ll} &\displaystyle f(x) = b \lambda^b x^{b - 1} \exp \left[ (\lambda x)^b \right] \left\{ \exp \left[ (\lambda x)^b \right] - 1 + a \right\}^{-2}, \\ &\displaystyle F(x) = \frac {\displaystyle \exp \left[ (\lambda x)^b \right] - 2 + a} {\displaystyle \exp \left[ (\lambda x)^b \right] - 1 + a}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{\lambda} \left[ \log \left( \frac {1}{1 - p} + 1 - a \right) \right]^{1 / b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {1}{\lambda p} \int_0^p \left[ \log \left( \frac {1}{1 - v} + 1 - a \right) \right]^{1 / b} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first scale parameter, b>0b > 0, the shape parameter, and λ>0\lambda > 0, the second scale parameter.

Usage

dmoweibull(x, a=1, b=1, lambda=1, log=FALSE)
pmoweibull(x, a=1, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varmoweibull(p, a=1, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
esmoweibull(p, a=1, b=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

lambda

the value of the second scale parameter, must be positive, the default is 1

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dmoweibull(x)
pmoweibull(x)
varmoweibull(x)
esmoweibull(x)

McDonald-Richards beta distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the McDonald-Richards beta distribution due to McDonald and Richards (1987a, 1987b) given by

f(x)=xar1(bqrxr)b1(bqr)a+b1B(a,b),F(x)=Ixrbqr(a,b),VaRp(X)=b1/rq[Ip1(a,b)]1/r,ESp(X)=b1/rqp0p[Iv1(a,b)]1/rdv\begin{array}{ll} &\displaystyle f (x) = \frac {x^{ar - 1} \left( bq^r - x^r \right)^{b - 1}} {\left( b q^r \right)^{a + b - 1} B (a, b)}, \\ &\displaystyle F (x) = I_{\frac {x^r}{b q^r}} (a, b), \\ &\displaystyle {\rm VaR}_p (X) = b^{1/r} q \left[ I_p^{-1} (a, b) \right]^{1/r}, \\ &\displaystyle {\rm ES}_p (X) = \frac {b^{1/r} q}{p} \int_0^p \left[ I_v^{-1} (a, b) \right]^{1/r} dv \end{array}

for 0xb1/rq0 \leq x \leq b^{1 / r} q, 0<p<10 < p < 1, q>0q > 0, the scale parameter, a>0a > 0, the first shape parameter, b>0b > 0, the second shape parameter, and r>0r > 0, the third shape parameter.

Usage

dMRbeta(x, a=1, b=1, r=1, q=1, log=FALSE)
pMRbeta(x, a=1, b=1, r=1, q=1, log.p=FALSE, lower.tail=TRUE)
varMRbeta(p, a=1, b=1, r=1, q=1, log.p=FALSE, lower.tail=TRUE)
esMRbeta(p, a=1, b=1, r=1, q=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

q

the value of the scale parameter, must be positive, the default is 1

a

the value of the first shape parameter, must be positive, the default is 1

b

the value of the second shape parameter, must be positive, the default is 1

r

the value of the third shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dMRbeta(x)
pMRbeta(x)
varMRbeta(x)
esMRbeta(x)

Nakagami distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Nakagami distribution due to Nakagami (1960) given by

f(x)=2mmΓ(m)amx2m1exp(mx2a),F(x)=1Q(m,mx2a),VaRp(X)=amQ1(m,1p),ESp(X)=apm0pQ1(m,1v)dv\begin{array}{ll} &\displaystyle f (x) = \frac {2 m^m}{\Gamma (m) a^m} x^{2 m - 1} \exp \left( -\frac {m x^2}{a} \right), \\ &\displaystyle F (x) = 1 - Q \left( m, \frac {m x^2}{a} \right), \\ &\displaystyle {\rm VaR}_p (X) = \sqrt{\frac {a}{m}} \sqrt{Q^{-1} (m, 1 - p)}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sqrt{a}}{p \sqrt{m}} \int_0^p \sqrt{Q^{-1} (m, 1 - v)} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the scale parameter, and m>0m > 0, the shape parameter.

Usage

dnakagami(x, m=1, a=1, log=FALSE)
pnakagami(x, m=1, a=1, log.p=FALSE, lower.tail=TRUE)
varnakagami(p, m=1, a=1, log.p=FALSE, lower.tail=TRUE)
esnakagami(p, m=1, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the scale parameter, must be positive, the default is 1

m

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dnakagami(x)
pnakagami(x)
varnakagami(x)
esnakagami(x)

Normal distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the normal distribution due to de Moivre (1738) and Gauss (1809) given by

f(x)=1σϕ(xμσ),F(x)=Φ(xμσ),VaRp(X)=μ+σΦ1(p),ESp(X)=μ+σp0pΦ1(v)dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\sigma} \phi \left( \frac {x - \mu}{\sigma} \right), \\ &\displaystyle F (x) = \Phi \left( \frac {x - \mu}{\sigma} \right), \\ &\displaystyle {\rm VaR}_p (X) = \mu + \sigma \Phi^{-1} (p), \\ &\displaystyle {\rm ES}_p (X) = \mu + \frac {\sigma}{p} \int_0^p \Phi^{-1} (v) dv \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <μ<-\infty < \mu < \infty, the location parameter, and σ>0\sigma > 0, the scale parameter, where ϕ()\phi (\cdot) denotes the pdf of a standard normal random variable, and Φ()\Phi (\cdot) denotes the cdf of a standard normal random variable.

Usage

dnormal(x, mu=0, sigma=1, log=FALSE)
pnormal(x, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
varnormal(p, mu=0, sigma=1, log.p=FALSE, lower.tail=TRUE)
esnormal(p, mu=0, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

mu

the value of the location parameter, can take any real value, the default is zero

sigma

the value of the scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dnormal(x)
pnormal(x)
varnormal(x)
esnormal(x)

Pareto distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Pareto distribution due to Pareto (1964) given by

f(x)=cKcxc1,F(x)=1(Kx)c,VaRp(X)=K(1p)1/c,ESp(X)=Kcp(1c)(1p)11/cKcp(1c)\begin{array}{ll} &\displaystyle f (x) = c K^c x^{-c - 1}, \\ &\displaystyle F (x) = 1 - \left( \frac {K}{x} \right)^c, \\ &\displaystyle {\rm VaR}_p (X) = K (1 - p)^{-1 / c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {K c}{p (1 - c)} (1 - p)^{1 - 1 / c} - \frac {K c}{p (1 - c)} \end{array}

for xKx \geq K, 0<p<10 < p < 1, K>0K > 0, the scale parameter, and c>0c > 0, the shape parameter.

Usage

dpareto(x, K=1, c=1, log=FALSE)
ppareto(x, K=1, c=1, log.p=FALSE, lower.tail=TRUE)
varpareto(p, K=1, c=1, log.p=FALSE, lower.tail=TRUE)
espareto(p, K=1, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

K

the value of the scale parameter, must be positive, the default is 1

c

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dpareto(x)
ppareto(x)
varpareto(x)
espareto(x)

Pareto positive stable distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Pareto positive stable distribution due to Sarabia and Prieto (2009) and Guillen et al. (2011) given by

f(x)=νλx[log(xσ)]ν1exp{λ[log(xσ)]ν},F(x)=1exp{λ[log(xσ)]ν},VaRp(X)=σexp{[1λlog(1p)]1/ν},ESp(X)=σp0pexp{[1λlog(1v)]1/ν}dv\begin{array}{ll} &\displaystyle f (x) = \frac {\nu \lambda}{x} \left[ \log \left( \frac {x}{\sigma} \right) \right]^{\nu - 1} \exp \left\{ -\lambda \left[ \log \left( \frac {x}{\sigma} \right) \right]^\nu \right\}, \\ &\displaystyle F (x) = 1 - \exp \left\{ -\lambda \left[ \log \left( \frac {x}{\sigma} \right) \right]^\nu \right\}, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \exp \left\{ \left[ -\frac {1}{\lambda} \log (1 - p) \right]^{1/\nu} \right\}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \int_0^p \exp \left\{ \left[ -\frac {1}{\lambda} \log (1 - v) \right]^{1/\nu} \right\} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, λ>0\lambda > 0, the first scale parameter, σ>0\sigma > 0, the second scale parameter, and ν>0\nu > 0, the shape parameter.

Usage

dparetostable(x, lambda=1, nu=1, sigma=1, log=FALSE)
pparetostable(x, lambda=1, nu=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varparetostable(p, lambda=1, nu=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
esparetostable(p, lambda=1, nu=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the first scale parameter, must be positive, the default is 1

sigma

the value of the second scale parameter, must be positive, the default is 1

nu

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dparetostable(x)
pparetostable(x)
varparetostable(x)
esparetostable(x)

Poiraud-Casanova-Thomas-Agnan Laplace distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Poiraud-Casanova-Thomas-Agnan Laplace distribution due to Poiraud-Casanova and Thomas-Agnan (2000) given by

f(x)={a(1a)exp{(1a)(xθ)},if xθ,a(1a)exp{a(θx)},if x>θ,F(x)={aexp{(1a)(xθ)},if xθ,1(1a)exp{a(θx)},if x>θ,VaRp(X)={θ+11alog(pa),if pa,θ1alog(1p1a),if p>a,ESp(X)={θloga1a+logp1(1a)p,if pa,θ1a+1pa(1a)p+1paplog(1p1a),if p>a\begin{array}{ll} &\displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle a \left( 1 - a \right) \exp \left\{ \left( 1 - a \right) \left( x - \theta \right) \right\}, & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle a \left( 1 - a \right) \exp \left\{ a \left( \theta - x \right) \right\}, & \mbox{if $x > \theta$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle a \exp \left\{ \left( 1 - a \right) \left( x - \theta \right) \right\}, & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle 1 - \left( 1 - a \right) \exp \left\{ a \left( \theta - x \right) \right\}, & \mbox{if $x > \theta$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta + \frac {1}{1 - a} \log \left( \frac {p}{a} \right), & \mbox{if $p \leq a$,} \\ \\ \displaystyle \theta - \frac {1}{a} \log \left( \frac {1 - p}{1 - a} \right), & \mbox{if $p > a$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \frac {\log a}{1 - a} + \frac {\log p - 1}{(1 - a) p}, & \mbox{if $p \leq a$,} \\ \\ \displaystyle \theta - \frac {1}{a} + \frac {1}{p} - \frac {a}{(1 - a) p} + \frac {1 - p}{a p} \log \left( \frac {1 - p}{1 - a} \right), & \mbox{if $p > a$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <θ<-\infty < \theta < \infty, the location parameter, and a>0a > 0, the scale parameter.

Usage

dPCTAlaplace(x, a=0.5, theta=0, log=FALSE)
pPCTAlaplace(x, a=0.5, theta=0, log.p=FALSE, lower.tail=TRUE)
varPCTAlaplace(p, a=0.5, theta=0, log.p=FALSE, lower.tail=TRUE)
esPCTAlaplace(p, a=0.5, theta=0)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, can take any real value, the default is zero

a

the value of the scale parameter, must be in the unit interval, the default is 0.5

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dPCTAlaplace(x)
pPCTAlaplace(x)
varPCTAlaplace(x)
esPCTAlaplace(x)

Perks distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Perks distribution due to Perks (1932) given by

f(x)=aexp(bx)[1+a][1+aexp(bx)]2,F(x)=11+a1+aexp(bx),VaRp(X)=1bloga+pa(1p),ESp(X)=(1+ap)logab+(a+p)log(a+p)bp+(1p)log(1p)bp\begin{array}{ll} &\displaystyle f(x) = \frac {\displaystyle a \exp (b x) \left[ 1 + a \right]} {\displaystyle \left[ 1 + a \exp (b x) \right]^2}, \\ &\displaystyle F (x) = 1 - \frac {\displaystyle 1 + a} {\displaystyle 1 + a \exp (b x)}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {1}{b} \log \frac {a + p}{a (1 - p)}, \\ &\displaystyle {\rm ES}_p (X) = -\left( 1 + \frac {a}{p} \right) \frac {\log a}{b} +\frac {(a + p) \log (a +p)}{b p} + \frac {(1 - p) \log (1 - p)}{b p} \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first scale parameter and b>0b > 0, the second scale parameter.

Usage

dperks(x, a=1, b=1, log=FALSE)
pperks(x, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
varperks(p, a=1, b=1, log.p=FALSE, lower.tail=TRUE)
esperks(p, a=1, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

b

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dperks(x)
pperks(x)
varperks(x)
esperks(x)

Power function I distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the power function I distribution given by

f(x)=axa1,F(x)=xa,VaRp(X)=p1/a,ESp(X)=p1/a1/a+1\begin{array}{ll} &\displaystyle f (x) = a x^{a - 1}, \\ &\displaystyle F (x) = x^a, \\ &\displaystyle {\rm VaR}_p (X) = p^{1 / a}, \\ &\displaystyle {\rm ES}_p (X) = \frac {p^{1 / a}}{1 / a + 1} \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, and a>0a > 0, the shape parameter.

Usage

dpower1(x, a=1, log=FALSE)
ppower1(x, a=1, log.p=FALSE, lower.tail=TRUE)
varpower1(p, a=1, log.p=FALSE, lower.tail=TRUE)
espower1(p, a=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dpower1(x)
ppower1(x)
varpower1(x)
espower1(x)

Power function II distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the power function II distribution given by

f(x)=b(1x)b1,F(x)=1(1x)b,VaRp(X)=1(1p)1/b,ESp(X)=1+b[(1p)1/b+11]p(b+1)\begin{array}{ll} &\displaystyle f (x) = b (1 - x)^{b - 1}, \\ &\displaystyle F (x) = 1 - (1 - x)^b, \\ &\displaystyle {\rm VaR}_p (X) = 1 - (1 - p)^{1 / b}, \\ &\displaystyle {\rm ES}_p (X) = 1 + \frac {b \left[ (1 - p)^{1 / b + 1} - 1 \right]}{p (b + 1)} \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, and b>0b > 0, the shape parameter.

Usage

dpower2(x, b=1, log=FALSE)
ppower2(x, b=1, log.p=FALSE, lower.tail=TRUE)
varpower2(p, b=1, log.p=FALSE, lower.tail=TRUE)
espower2(p, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dpower2(x)
ppower2(x)
varpower2(x)
espower2(x)

Quadratic distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the quadratic distribution given by

f(x)=α(xβ)2,F(x)=α3[(xβ)3+(βa)3],VaRp(X)=β+[3pα(βa)3]1/3,ESp(X)=β+α4p{[3pα(βa)3]4/3(βa)4}\begin{array}{ll} &\displaystyle f(x) = \alpha (x - \beta)^2, \\ &\displaystyle F(x) = \frac {\alpha}{3} \left[ (x - \beta)^3 + (\beta - a)^3 \right], \\ &\displaystyle {\rm VaR}_p (X) = \beta + \left[ \frac {3 p}{\alpha} - (\beta - a)^3 \right]^{1/3}, \\ &\displaystyle {\rm ES}_p (X) = \beta + \frac {\alpha}{4 p} \left\{ \left[ \frac {3 p}{\alpha} - (\beta - a)^3 \right]^{4/3} - (\beta - a)^4 \right\} \end{array}

for axba \leq x \leq b, 0<p<10 < p < 1, <a<-\infty < a < \infty , the first location parameter, and <a<b<-\infty < a < b < \infty, the second location parameter, where α=12(ba)3\alpha = \frac {12}{(b - a)^3} and β=a+b2\beta = \frac {a + b}{2}.

Usage

dquad(x, a=0, b=1, log=FALSE)
pquad(x, a=0, b=1, log.p=FALSE, lower.tail=TRUE)
varquad(p, a=0, b=1, log.p=FALSE, lower.tail=TRUE)
esquad(p, a=0, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first location parameter, can take any real value, the default is zero

b

the value of the second location parameter, can take any real value but must be greater than a, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dquad(x)
pquad(x)
varquad(x)
esquad(x)

Reflected gamma distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the reflected gamma distribution due to Borgi (1965) given by

f(x)=12ϕΓ(a)xθϕa1exp{xθϕ},F(x)={12Q(a,θxϕ),if xθ,112Q(a,xθϕ),if x>θ,VaRp(X)={θϕQ1(a,2p),if p1/2,θ+ϕQ1(a,2(1p)),if p>1/2,ESp(X)={θϕp0pQ1(a,2v)dv,if p1/2,θϕp01/2Q1(a,2v)dv+ϕp1/2pQ1(a,2(1v))dv,if p>1/2\begin{array}{ll} &\displaystyle f (x) = \frac {1}{\displaystyle 2 \phi \Gamma \left( a \right)} \left | \frac {x - \theta}{\phi} \right |^{a - 1} \exp \left\{ -\left | \frac {x - \theta}{\phi} \right | \right\}, \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \frac {1}{2} Q \left( a, \frac {\theta - x}{\phi} \right), & \mbox{if $x \leq \theta$,} \\ \\ \displaystyle 1 - \frac {1}{2} Q \left( a, \frac {x - \theta}{\phi} \right), & \mbox{if $x > \theta$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \phi Q^{-1} \left( a, 2 p \right), & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \theta + \phi Q^{-1} \left( a, 2 (1 - p) \right), & \mbox{if $p > 1/2$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta - \frac {\phi}{p} \int_0^p Q^{-1} \left( a, 2 v \right) dv, & \mbox{if $p \leq 1/2$,} \\ \\ \displaystyle \theta - \frac {\phi}{p} \int_0^{1/2} Q^{-1} \left( a, 2 v \right) dv +\frac {\phi}{p} \int_{1/2}^p Q^{-1} \left( a, 2 (1 - v) \right) dv, & \mbox{if $p > 1/2$} \end{array} \right. \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, <θ<-\infty < \theta < \infty, the location parameter, ϕ>0\phi > 0, the scale parameter, and a>0a > 0, the shape parameter.

Usage

drgamma(x, a=1, theta=0, phi=1, log=FALSE)
prgamma(x, a=1, theta=0, phi=1, log.p=FALSE, lower.tail=TRUE)
varrgamma(p, a=1, theta=0, phi=1, log.p=FALSE, lower.tail=TRUE)
esrgamma(p, a=1, theta=0, phi=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, can take any real value, the default is zero

phi

the value of the scale parameter, must be positive, the default is 1

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
drgamma(x)
prgamma(x)
varrgamma(x)
esrgamma(x)

Ramberg-Schmeiser distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Ramber-Schmeiser distribution due to Ramberg and Schmeiser (1974) given by

VaRp(X)=pb(1p)cd,ESp(X)=pbd(b+1)+(1p)c+11pd(c+1)\begin{array}{ll} &\displaystyle {\rm VaR}_p (X) = \frac {p^b - (1 - p)^c}{d}, \\ &\displaystyle {\rm ES}_p (X) = \frac {p^{b}}{d (b + 1)} + \frac {(1 - p)^{c + 1} - 1}{p d (c + 1)} \end{array}

for 0<p<10 < p < 1, b>0b > 0, the first shape parameter, c>0c > 0, the second shape parameter, and d>0d > 0, the scale parameter.

Usage

varRS(p, b=1, c=1, d=1, log.p=FALSE, lower.tail=TRUE)
esRS(p, b=1, c=1, d=1)

Arguments

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

d

the value of the scale parameter, must be positive, the default is 1

b

the value of the first shape parameter, must be positive, the default is 1

c

the value of the second shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
varRS(x)
esRS(x)

Schabe distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Schabe distribution due to Schabe (1994) given by

f(x)=2γ+(1γ)x/θθ(γ+x/θ)2,F(x)=(1+γ)xx+γθ,VaRp(X)=pγθ1+γp,ESp(X)=θγθγ(1+γ)plog1+γp1+γ\begin{array}{ll} &\displaystyle f(x) = \frac {\displaystyle 2 \gamma + (1 - \gamma) x / \theta}{\displaystyle \theta (\gamma + x/\theta)^2}, \\ &\displaystyle F(x) = \frac {\displaystyle (1 + \gamma) x}{\displaystyle x + \gamma \theta}, \\ &\displaystyle {\rm VaR}_p (X) = \frac {p \gamma \theta}{1 + \gamma - p}, \\ &\displaystyle {\rm ES}_p (X) = -\theta \gamma - \frac {\theta \gamma (1 + \gamma)}{p} \log \frac {1 + \gamma - p}{1 + \gamma} \end{array}

for x>0x > 0, 0<p<10 < p < 1, 0<γ<10 < \gamma < 1, the first scale parameter, and θ>0\theta > 0, the second scale parameter.

Usage

dschabe(x, gamma=0.5, theta=1, log=FALSE)
pschabe(x, gamma=0.5, theta=1, log.p=FALSE, lower.tail=TRUE)
varschabe(p, gamma=0.5, theta=1, log.p=FALSE, lower.tail=TRUE)
esschabe(p, gamma=0.5, theta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

gamma

the value of the first scale parameter, must be in the unit interval, the default is 0.5

theta

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dschabe(x)
pschabe(x)
varschabe(x)
esschabe(x)

Hyperbolic secant distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the hyperbolic secant distribution given by

f(x)=12sech(πx2),F(x)=2πarctan[exp(πx2)],VaRp(X)=2πlog[tan(πp2)],ESp(X)=2πp0plog[tan(πv2)]dv\begin{array}{ll} &\displaystyle f (x) = \frac {1}{2} {\rm sech} \left( \frac {\pi x}{2} \right), \\ &\displaystyle F (x) = \frac {2}{\pi} \arctan \left[ \exp \left( \frac {\pi x}{2} \right) \right], \\ &\displaystyle {\rm VaR}_p (X) = \frac {2}{\pi} \log \left[ \tan \left( \frac {\pi p}{2} \right) \right], \\ &\displaystyle {\rm ES}_p (X) = \frac {2}{\pi p} \int_0^p \log \left[ \tan \left( \frac {\pi v}{2} \right) \right] dv \end{array}

for <x<-\infty < x < \infty, and 0<p<10 < p < 1.

Usage

dsecant(x, log=FALSE)
psecant(x, log.p=FALSE, lower.tail=TRUE)
varsecant(p, log.p=FALSE, lower.tail=TRUE)
essecant(p)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dsecant(x)
psecant(x)
varsecant(x)
essecant(x)

Stacy distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for Stacy distribution due to Stacy (1962) given by

f(x)=cxcγ1exp[(x/θ)c]θcγΓ(γ),F(x)=1Q(γ,(xθ)c),VaRp(X)=θ[Q1(γ,1p)]1/c,ESp(X)=θp0p[Q1(γ,1v)]1/cdv\begin{array}{ll} &\displaystyle f (x) = \frac {c x^{c \gamma - 1} \exp \left[ -(x / \theta)^c \right]}{\theta^{c \gamma} \Gamma (\gamma)}, \\ &\displaystyle F (x) = 1 - Q \left( \gamma, \left( \frac {x}{\theta} \right)^c \right), \\ &\displaystyle {\rm VaR}_p (X) = \theta \left[ Q^{-1} (\gamma, 1 - p) \right]^{1 / c}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\theta}{p} \int_0^p \left[ Q^{-1} (\gamma, 1 - v) \right]^{1 / c} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, θ>0\theta > 0, the scale parameter, c>0c > 0, the first shape parameter, and γ>0\gamma > 0, the second shape parameter.

Usage

dstacygamma(x, gamma=1, c=1, theta=1, log=FALSE)
pstacygamma(x, gamma=1, c=1, theta=1, log.p=FALSE, lower.tail=TRUE)
varstacygamma(p, gamma=1, c=1, theta=1, log.p=FALSE, lower.tail=TRUE)
esstacygamma(p, gamma=1, c=1, theta=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the scale parameter, must be positive, the default is 1

c

the value of the first scale parameter, must be positive, the default is 1

gamma

the value of the second scale parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dstacygamma(x)
pstacygamma(x)
varstacygamma(x)
esstacygamma(x)

Student's t distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Student's tt distribution due to Gosset (1908) given by

f(x)=Γ(n+12)nπΓ(n2)(1+x2n)n+12,F(x)=1+sign(x)2sign(x)2Inx2+n(n2,12),VaRp(X)=nsign(p12)1Ia1(n2,12)1, where a=2p if p<1/2a=2(1p) if p1/2,ESp(X)=np0psign(v12)1Ia1(n2,12)1dv, where a=2v if v<1/2a=2(1v) if v1/2\begin{array}{ll} &\displaystyle f (x) = \frac {\Gamma \left( \frac {n + 1}{2} \right)}{\sqrt{n \pi} \Gamma \left( \frac {n}{2} \right)} \left( 1 + \frac {x^2}{n} \right)^{-\frac {n + 1}{2}}, \\ &\displaystyle F (x) = \frac {1 + {\rm sign} (x)}{2} - \frac {{\rm sign} (x)}{2} I_{\frac {n}{x^2 + n}} \left( \frac {n}{2}, \frac {1}{2} \right), \\ &\displaystyle {\rm VaR}_p (X) = \sqrt{n} {\rm sign} \left( p - \frac {1}{2} \right) \sqrt{\frac {1}{I_a^{-1} \left( \frac {n}{2}, \frac {1}{2} \right)} - 1}, \\ &\displaystyle \quad \mbox{ where $a = 2p$ if $p < 1/2$, $a = 2(1 - p)$ if $p \geq 1/2$,} \\ &\displaystyle {\rm ES}_p (X) = \frac {\sqrt{n}}{p} \int_0^p {\rm sign} \left( v - \frac {1}{2} \right) \sqrt{\frac {1}{I_a^{-1} \left( \frac {n}{2}, \frac {1}{2} \right)} - 1} dv, \\ &\displaystyle \quad \mbox{ where $a = 2v$ if $v < 1/2$, $a = 2(1 - v)$ if $v \geq 1/2$} \end{array}

for <x<-\infty < x < \infty, 0<p<10 < p < 1, and n>0n > 0, the degree of freedom parameter.

Usage

dT(x, n=1, log=FALSE)
pT(x, n=1, log.p=FALSE, lower.tail=TRUE)
varT(p, n=1, log.p=FALSE, lower.tail=TRUE)
esT(p, n=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

n

the value of the degree of freedom parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dT(x)
pT(x)
varT(x)
esT(x)

Tukey-Lambda distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Tukey-Lambda distribution due to Tukey (1962) given by

VaRp(X)=pλ(1p)λλ,ESp(X)=pλ+1+(1p)λ+11pλ(λ+1)\begin{array}{ll} &\displaystyle {\rm VaR}_p (X) = \frac {p^\lambda - (1 - p)^\lambda}{\lambda}, \\ &\displaystyle {\rm ES}_p (X) = \frac {p^{\lambda + 1} + (1 - p)^{\lambda + 1} - 1}{p \lambda (\lambda + 1)} \end{array}

for 0<p<10 < p < 1, and λ>0\lambda > 0, the shape parameter.

Usage

varTL(p, lambda=1, log.p=FALSE, lower.tail=TRUE)
esTL(p, lambda=1)

Arguments

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

lambda

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
varTL(x)
esTL(x)

Topp-Leone distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Topp-Leone distribution due to Topp and Leone (1955) given by

f(x)=2b(x(2x))b1(1x),F(x)=(x(2x))b,VaRp(X)=11p1/b,ESp(X)=1bpBp1/b(b,32)\begin{array}{ll} &\displaystyle f(x) = 2 b (x (2 - x))^{b - 1} (1 - x), \\ &\displaystyle F(x) = (x (2 - x))^b, \\ &\displaystyle {\rm VaR}_p (X) = 1 - \sqrt{1 - p^{1 / b}}, \\ &\displaystyle {\rm ES}_p (X) = 1 - \frac {b}{p} B_{p^{1 / b}} \left( b, \frac {3}{2} \right) \end{array}

for x>0x > 0, 0<p<10 < p < 1, and b>0b > 0, the shape parameter.

Usage

dTL2(x, b=1, log=FALSE)
pTL2(x, b=1, log.p=FALSE, lower.tail=TRUE)
varTL2(p, b=1, log.p=FALSE, lower.tail=TRUE)
esTL2(p, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dTL2(x)
pTL2(x)
varTL2(x)
esTL2(x)

Triangular distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the triangular distribution given by

f(x)={0,if x<a,2(xa)(ba)(ca),if axc,2(bx)(ba)(bc),if c<xb,0,if b<x,F(x)={0,if x<a,(xa)2(ba)(ca),if axc,1(bx)2(ba)(bc),if c<xb,1,if b<x,VaRp(X)={a+p(ba)(ca),if 0<p<caba,b(1p)(ba)(bc),if cabap<1,ESp(X)={a+23p(ba)(ca),if 0<p<caba,b+acp+2(2cab)3p+2(ba)(bc)(1p)3/23p,if cabap<1\begin{array}{ll} &\displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle 0, & \mbox{if $x < a$,} \\ \\ \displaystyle \frac {2 (x - a)}{(b - a) (c - a)}, & \mbox{if $a \leq x \leq c$,} \\ \\ \displaystyle \frac {2 (b - x)}{(b - a) (b - c)}, & \mbox{if $c < x \leq b$,} \\ \\ \displaystyle 0, & \mbox{if $b < x$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle 0, & \mbox{if $x < a$,} \\ \\ \displaystyle \frac {(x - a)^2}{(b - a) (c - a)}, & \mbox{if $a \leq x \leq c$,} \\ \\ \displaystyle 1 - \frac {(b - x)^2}{(b - a) (b - c)}, & \mbox{if $c < x \leq b$,} \\ \\ \displaystyle 1, & \mbox{if $b < x$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle a + \sqrt{p (b - a) (c - a)}, & \mbox{if $0 < p < \frac {c - a}{b - a}$,} \\ \\ \displaystyle b - \sqrt{(1 - p) (b - a) (b - c)}, & \mbox{if $\frac {c - a}{b - a} \leq p < 1$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle a + \frac {2}{3} \sqrt{p (b - a) (c - a)}, & \mbox{if $0 < p < \frac {c - a}{b - a}$,} \\ \\ \displaystyle b + \frac {a - c}{p} + \frac {2 (2 c - a - b)}{3 p} +2 \sqrt{(b - a) (b - c)} \frac {(1 - p)^{3/2}}{3 p}, & \mbox{if $\frac {c - a}{b - a} \leq p < 1$} \end{array} \right. \end{array}

for axba \leq x \leq b, 0<p<10 < p < 1, <a<-\infty < a < \infty, the first location parameter, <a<c<-\infty < a < c < \infty, the second location parameter, and <c<b<-\infty < c < b < \infty, the third location parameter.

Usage

dtriangular(x, a=0, b=2, c=1, log=FALSE)
ptriangular(x, a=0, b=2, c=1, log.p=FALSE, lower.tail=TRUE)
vartriangular(p, a=0, b=2, c=1, log.p=FALSE, lower.tail=TRUE)
estriangular(p, a=0, b=2, c=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first location parameter, can take any real value, the default is zero

c

the value of the second location parameter, can take any real value but must be greater than a, the default is 1

b

the value of the third location parameter, can take any real value but must be greater than c, the default is 2

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dtriangular(x)
ptriangular(x)
vartriangular(x)
estriangular(x)

Two sided power distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the two sided power distribution due to van Dorp and Kotz (2002) given by

f(x)={a(xθ)a1,if 0<xθ,a(1x1θ)a1,if θ<x<1,F(x)={θ(xθ)a,if 0<xθ,1(1θ)(1x1θ)a,if θ<x<1,VaRp(X)={θ(pθ)1/a,if 0<pθ,1(1θ)(1p1θ)1/a,if θ<p<1,ESp(X)={aθa+1(pθ)1/a,if 0<pθ,1θp+a(2θ1)(a+1)p+a(1θ)2(a+1)p(1p1θ)1+1/a,if θ<p<1\begin{array}{ll} &\displaystyle f (x) = \left\{ \begin{array}{ll} \displaystyle a \left( \frac {x}{\theta} \right)^{a - 1}, & \mbox{if $0 < x \leq \theta$,} \\ \displaystyle a \left( \frac {1 - x}{1 - \theta} \right)^{a - 1}, & \mbox{if $\theta < x < 1$,} \end{array} \right. \\ &\displaystyle F (x) = \left\{ \begin{array}{ll} \displaystyle \theta \left( \frac {x}{\theta} \right)^a, & \mbox{if $0 < x \leq \theta$,} \\ \displaystyle 1 - (1 - \theta) \left( \frac {1 - x}{1 - \theta} \right)^a, & \mbox{if $\theta < x < 1$,} \end{array} \right. \\ &\displaystyle {\rm VaR}_p (X) = \left\{ \begin{array}{ll} \displaystyle \theta \left( \frac {p}{\theta} \right)^{1 / a}, & \mbox{if $0 < p \leq \theta$,} \\ \displaystyle 1 - (1 - \theta) \left( \frac {1 - p}{1 - \theta} \right)^{1 / a}, & \mbox{if $\theta < p < 1$,} \end{array} \right. \\ &\displaystyle {\rm ES}_p (X) = \left\{ \begin{array}{ll} \displaystyle \frac {a \theta}{a + 1} \left( \frac {p}{\theta} \right)^{1 / a}, & \mbox{if $0 < p \leq \theta$,} \\ \displaystyle 1 - \frac {\theta}{p} + \frac {a (2 \theta - 1)}{(a + 1) p} + \frac {a (1 - \theta)^2}{(a + 1) p} \left( \frac {1 - p}{1 - \theta} \right)^{1 + 1 / a}, & \mbox{if $\theta < p < 1$} \end{array} \right. \end{array}

for 0<x<10 < x < 1, 0<p<10 < p < 1, a>0a > 0, the shape parameter, and <θ<-\infty < \theta < \infty, the location parameter.

Usage

dtsp(x, a=1, theta=0.5, log=FALSE)
ptsp(x, a=1, theta=0.5, log.p=FALSE, lower.tail=TRUE)
vartsp(p, a=1, theta=0.5, log.p=FALSE, lower.tail=TRUE)
estsp(p, a=1, theta=0.5)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

theta

the value of the location parameter, must take a value in the unit interval, the default is 0.5

a

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dtsp(x)
ptsp(x)
vartsp(x)
estsp(x)

Uniform distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the uniform distribution given by

f(x)=1ba,F(x)=xaba,VaRp(X)=a+p(ba),ESp(X)=a+p2(ba)\begin{array}{ll} &\displaystyle f (x) = \frac {1}{b - a}, \\ &\displaystyle F (x) = \frac {x - a}{b - a}, \\ &\displaystyle {\rm VaR}_p (X) = a + p (b - a), \\ &\displaystyle {\rm ES}_p (X) = a + \frac {p}{2} (b - a) \end{array}

for a<x<ba < x < b, 0<p<10 < p < 1, <a<-\infty < a < \infty , the first location parameter, and <a<b<-\infty < a < b < \infty , the second location parameter.

Usage

duniform(x, a=0, b=1, log=FALSE)
puniform(x, a=0, b=1, log.p=FALSE, lower.tail=TRUE)
varuniform(p, a=0, b=1, log.p=FALSE, lower.tail=TRUE)
esuniform(p, a=0, b=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first location parameter, can take any real value, the default is zero

b

the value of the second location parameter, can take any real value but must be greater than a, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
duniform(x)
puniform(x)
varuniform(x)
esuniform(x)

Weibull distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Weibull distribution due to Weibull (1951) given by

f(x)=αxα1σαexp{(xσ)α},F(x)=1exp{(xσ)α},VaRp(X)=σ[log(1p)]1/α,ESp(X)=σpγ(1+1/α,log(1p))\begin{array}{ll} &\displaystyle f (x) = \frac {\alpha x^{\alpha - 1}}{\sigma^\alpha} \exp \left\{ -\left( \frac {x}{\sigma} \right)^{\alpha} \right\}, \\ &\displaystyle F (x) = 1 - \exp \left\{ -\left( \frac {x}{\sigma} \right)^{\alpha} \right\}, \\ &\displaystyle {\rm VaR}_p (X) = \sigma \left[ -\log (1 - p) \right]^{1 / \alpha}, \\ &\displaystyle {\rm ES}_p (X) = \frac {\sigma}{p} \gamma \left( 1 + 1 / \alpha, - \log (1 - p) \right) \end{array}

for x>0x > 0, 0<p<10 < p < 1, α>0\alpha > 0, the shape parameter, and σ>0\sigma > 0, the scale parameter.

Usage

dWeibull(x, alpha=1, sigma=1, log=FALSE)
pWeibull(x, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
varWeibull(p, alpha=1, sigma=1, log.p=FALSE, lower.tail=TRUE)
esWeibull(p, alpha=1, sigma=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

sigma

the value of the scale parameter, must be positive, the default is 1

alpha

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dWeibull(x)
pWeibull(x)
varWeibull(x)
esWeibull(x)

Xie distribution

Description

Computes the pdf, cdf, value at risk and expected shortfall for the Xie distribution due to Xie et al. (2002) given by

f(x)=λb(xa)b1exp[(x/a)b]exp(λa)exp{λaexp[(x/a)b]},F(x)=1exp(λa)exp{λaexp[(x/a)b]},VaRp(X)=a{log[1log(1p)λa]}1/b,ESp(X)=ap0p{log[1log(1v)λa]}1/bdv\begin{array}{ll} &\displaystyle f(x) = \lambda b \left( \frac {x}{a} \right)^{b - 1} \exp \left[ (x/a)^b \right] \exp \left( \lambda a \right) \exp \left\{ -\lambda a \exp \left[ (x/a)^b \right] \right\}, \\ &\displaystyle F (x) = 1 - \exp \left( \lambda a \right) \exp \left\{ -\lambda a \exp \left[ (x/a)^b \right] \right\}, \\ &\displaystyle {\rm VaR}_p (X) = a \left\{ \log \left[ 1 - \frac {\log (1 - p)}{\lambda a} \right] \right\}^{1/b}, \\ &\displaystyle {\rm ES}_p (X) = \frac {a}{p} \int_0^p \left\{ \log \left[ 1 - \frac {\log (1 - v)}{\lambda a} \right] \right\}^{1/b} dv \end{array}

for x>0x > 0, 0<p<10 < p < 1, a>0a > 0, the first scale parameter, b>0b > 0, the shape parameter, and λ>0\lambda > 0, the second scale parameter.

Usage

dxie(x, a=1, b=1, lambda=1, log=FALSE)
pxie(x, a=1, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
varxie(p, a=1, b=1, lambda=1, log.p=FALSE, lower.tail=TRUE)
esxie(p, a=1, b=1, lambda=1)

Arguments

x

scaler or vector of values at which the pdf or cdf needs to be computed

p

scaler or vector of values at which the value at risk or expected shortfall needs to be computed

a

the value of the first scale parameter, must be positive, the default is 1

lambda

the value of the second scale parameter, must be positive, the default is 1

b

the value of the shape parameter, must be positive, the default is 1

log

if TRUE then log(pdf) are returned

log.p

if TRUE then log(cdf) are returned and quantiles are computed for exp(p)

lower.tail

if FALSE then 1-cdf are returned and quantiles are computed for 1-p

Value

An object of the same length as x, giving the pdf or cdf values computed at x or an object of the same length as p, giving the values at risk or expected shortfall computed at p.

Author(s)

Saralees Nadarajah

References

Stephen Chan, Saralees Nadarajah & Emmanuel Afuecheta (2016). An R Package for Value at Risk and Expected Shortfall, Communications in Statistics - Simulation and Computation, 45:9, 3416-3434, doi:10.1080/03610918.2014.944658

Examples

x=runif(10,min=0,max=1)
dxie(x)
pxie(x)
varxie(x)
esxie(x)