Description Usage Arguments Value Author(s) Examples
A collection and description of distributions and
related functions which are useful in the theory of
exponential Brownian motion and Asian option valuation.
The functions compute densities and probabilities for
the log-Normal distribution, the Gamma distribution,
the Reciprocal-Gamma distribution, and the Johnson
Type-I distribution. Functions are made available for
the compution of moments including the Normal, the
log-Normal, the Reciprocal-Gamma, and the Asian-Option
Density. In addition a function is given to compute
numerically first and second derivatives of a given
function.
The functions are:
dlognorm | the log-Normal density and derivatives, |
plognorm | the log-Normal, a synonyme for R's plnorm, |
dgam | the Gamma density, a synonyme for R's dgamma, |
pgam | the Gamma probability, a synonyme for R's pgamma, |
drgam | the Reciprocal-Gamma density, |
prgam | the Reciprocal-Gamma probability, |
djohnson | the Johnson Type I density, |
pjohnson | the Johnson Type I probability, |
mnorm | the Moments of Normal density, |
mlognorm | the Moments of log-Normal density, |
mrgam | the Moments of reciprocal-Gamma density, |
masian | the Moments of Asian Option density, |
derivative | the First and second numerical derivative. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | dlognorm(x, meanlog = 0, sdlog = 1, deriv = c(0, 1, 2))
plognorm(q, meanlog = 0, sdlog = 1)
dgam(x, alpha, beta)
pgam(q, alpha, beta, lower.tail = TRUE)
drgam(x, alpha, beta, deriv = c(0, 1, 2))
prgam(q, alpha, beta, lower.tail = TRUE)
djohnson(x, a = 0, b = 1, c = 0, d = 1, deriv = c(0, 1, 2))
pjohnson(q, a = 0, b = 1, c = 0, d = 1)
mnorm(mean = 0, sd = 1)
mlognorm(meanlog = 0, sdlog = 1)
mrgam(alpha = 1/2, beta = 1)
mjohnson(a, b, c, d)
masian(Time = 1, r = 0.045, sigma = 0.30)
derivative(x, y, deriv = c(1, 2))
dEBM(u, t = 1)
pEBM(u, t = 1)
d2EBM(u, t = 1)
dasymEBM(u, t = 1)
|
a, b, c, d |
[*johnson] - |
alpha, beta |
[*gam] - |
deriv |
an integer value, the degree of differentiation, either 0, 1 or 2. |
lower.tail |
a logical, if |
mean, sd |
[*lognorm] - |
meanlog, sdlog |
[*lognorm] - |
q |
a real numeric value or vector. |
t |
... |
Time, r, sigma |
the parameters of the Asian Option distribution. |
u |
... |
x |
a real numeric value or vector. |
y |
[derivative] - |
The functions d*
and p*
return the values or
numeric vectors of the density and probability of the the
corresponding distribution.
The functions m*
return a list with three elements,
the values of the first four moments rawMoments
,
the values of the first four central moments centralMoments
,
and the skewness and kurtosis fisher
, also called Fisher
parameters.
The function derivative
returns a list of two elemtes,
$x
and $y
, where $y($x)
is either the first
or second derivative of y(x)
as selected by the argument
deriv
.
Diethelm Wuertz for the Rmetrics R-port.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## dlognorm -
# Calculate Log-Normal Density and its Derivaties:
x = exp(seq(-2.8, 1.2, length = 100))
y0 = dlognorm(x, deriv = 0)
y1 = dlognorm(x, deriv = 1)
y2 = dlognorm(x, deriv = 2)
## derivative -
# Compare with Numerical Differentiation:
par(mfrow = c(2, 2))
xa = exp(seq(-2.5, 1.5, length = 20))
plot(x, y0, type = "l", main = "Log-Normal Density")
plot(x, y1, type = "l", main = "1st Derivative")
z = derivative(xa, dlognorm(xa, deriv = 0), deriv = 1)
points(z$x, z$y, col = "steelblue")
plot(x, y2, type = "l", main = "2nd Derivative")
z = derivative(xa, dlognorm(xa, deriv = 0), deriv = 2)
points(z$x, z$y, col = "steelblue")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.