Learn R Programming

VGAM (version 1.1-8)

Expectiles-Exponential: Expectiles of the Exponential Distribution

Description

Density function, distribution function, and expectile function and random generation for the distribution associated with the expectiles of an exponential distribution.

Usage

deexp(x, rate = 1, log = FALSE)
peexp(q, rate = 1, lower.tail = TRUE, log.p = FALSE)
qeexp(p, rate = 1, Maxit.nr = 10, Tol.nr = 1.0e-6,
      lower.tail = TRUE, log.p = FALSE)
reexp(n, rate = 1)

Value

deexp(x) gives the density function \(g(x)\).

peexp(q) gives the distribution function \(G(q)\).

qeexp(p) gives the expectile function: the value \(y\) such that \(G(y)=p\).

reexp(n) gives \(n\) random variates from \(G\).

Arguments

x, p, q

See deunif.

n, rate, log

See rexp.

lower.tail, log.p

Same meaning as in pexp or qexp.

Maxit.nr, Tol.nr

See deunif.

Author

T. W. Yee and Kai Huang

Details

General details are given in deunif including a note regarding the terminology used. Here, exp corresponds to the distribution of interest, \(F\), and eexp corresponds to \(G\). The addition of ``e'' is for the `other' distribution associated with the parent distribution. Thus deexp is for \(g\), peexp is for \(G\), qeexp is for the inverse of \(G\), reexp generates random variates from \(g\).

For qeexp the Newton-Raphson algorithm is used to solve for \(y\) satisfying \(p = G(y)\). Numerical problems may occur when values of p are very close to 0 or 1.

See Also

deunif, denorm, dexp.

Examples

Run this code
my.p <- 0.25; y <- rexp(nn <- 1000)
(myexp <- qeexp(my.p))
sum(myexp - y[y <= myexp]) / sum(abs(myexp - y))  # Should be my.p

if (FALSE)  par(mfrow = c(2,1))
yy <- seq(-0, 4, len = nn)
plot(yy, deexp(yy),  col = "blue", ylim = 0:1, xlab = "y", ylab = "g(y)",
     type = "l", main = "g(y) for Exp(1); dotted green is f(y) = dexp(y)")
lines(yy, dexp(yy), col = "green", lty = "dotted", lwd = 2)  # 'original'

plot(yy, peexp(yy), type = "l", col = "blue", ylim = 0:1,
     xlab = "y", ylab = "G(y)", main = "G(y) for Exp(1)")
abline(v = 1, h = 0.5, col = "red", lty = "dashed")
lines(yy, pexp(yy), col = "green", lty = "dotted", lwd = 2) 

Run the code above in your browser using DataLab