doubleparetolognormal function

The Double-Pareto Lognormal distribution

The Double-Pareto Lognormal distribution

Density, distribution function, quantile function and random generation for the Double-Pareto Lognormal distribution.

ddoubleparetolognormal( x, shape1 = 1.5, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5, log = FALSE ) pdoubleparetolognormal( q, shape1 = 1.5, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5, lower.tail = TRUE, log.p = FALSE ) qdoubleparetolognormal( p, shape1 = 1.5, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5, lower.tail = TRUE, log.p = FALSE ) mdoubleparetolognormal( r = 0, truncation = 0, shape1 = 1.5, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5, lower.tail = TRUE ) rdoubleparetolognormal( n, shape1 = 1.5, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5 )

Arguments

  • x, q: vector of quantiles
  • shape1, shape2, meanlog, sdlog: Shapes, mean and variance of the Double-Pareto Lognormal distribution respectively, defaults to shape1=1.5, shape2=1.5, meanlog=-0.5, sdlog=0.5.
  • log, log.p: logical; if TRUE, probabilities p are given as log(p).
  • lower.tail: logical; if TRUE (default), probabilities (moments) are P[Xx]P[X \le x] (E[xrXy])(E[x^r|X \le y]), otherwise, P[X>x]P[X > x] (E[xrX>y])(E[x^r|X > y])
  • p: vector of probabilities
  • r: rth raw moment of the Pareto distribution
  • truncation: lower truncation parameter, defaults to xmin
  • n: number of observations

Returns

ddoubleparetolognormal returns the density, pdoubleparetolognormal the distribution function, qdoubleparetolognormal the quantile function, mdoubleparetolognormal the rth moment of the distribution and rdoubleparetolognormal generates random deviates.

The length of the result is determined by n for rdoubleparetolognormal, and is the maximum of the lengths of the numerical arguments for the other functions.

Details

Probability and Cumulative Distribution Function as provided by if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="reed2004double",package="distributionsrd",cached_env=.Rdpack.currefs) :

f(x)=shape2shape1shape2+shape1[xshape21eshape2meanlog+shape22sdlog22Φ(lnxmeanlogshape2sdlog2sdlog)+xshape11eshape1meanlog+shape12sdlog22Φc(lnxmeanlog+shape1sdlog2sdlog)],FX(x)=Φ(lnxmeanlogsdlog)1shape2+shape1[shape1xshape2eshape2meanlog+shape22sdlog22Φ(lnxmeanlogshape2sdlog2sdlog)shape2xshape1eshape1meanlog+shape12sdlog22Φc(lnxmeanlog+shape1sdlog2sdlog)]f(x) = \frac{shape2shape1}{shape2 + shape1}[ x^{-shape2-1}e^{shape2 meanlog + \frac{shape2^2sdlog^2}{2}}\Phi(\frac{lnx - meanlog - shape2 sdlog^2}{sdlog}) + x^{shape1-1}e^{-shape1 meanlog + \frac{shape1^2sdlog^2}{2}}\Phi^c(\frac{lnx - meanlog +shape1 sdlog^2}{sdlog}) ], \newline F_X(x) = \Phi(\frac{lnx - meanlog }{sdlog}) - \frac{1}{shape2 + shape1}[ shape1 x^{-shape2}e^{shape2 meanlog + \frac{shape2^2sdlog^2}{2}}\Phi(\frac{lnx - meanlog - shape2 sdlog^2}{sdlog}) - shape2 x^{shape1}e^{-shape1 meanlog + \frac{shape1^2sdlog^2}{2}}\Phi^c(\frac{lnx - meanlog +shape1 sdlog^2}{sdlog}) ]

The y-bounded r-th raw moment of the Double-Pareto Lognormal distribution equals:

meanlogyr=shape2shape1shape2+shape1eshape2meanlog+shape22sdlog22yrshape2rshape2Φ(lnymeanlogshape2sdlog2sdlog)shape2shape1shape2+shape11rshape2er2sdlog2+2meanlogr2Φc(lnyrsdlog2meanlogsdlog)shape2shape1shape2+shape1eshape1meanlog+shape12sdlog22yr+shape1r+shape1Φc(lnymeanlog+shape1sdlog2sdlog)+shape2shape1shape2+shape11r+shape1er2sdlog2+2meanlogr2Φc(lnyrsdlog2meanlogsdlog),shape2>rmeanlog^{r}_{y} = -\frac{shape2shape1}{shape2 + shape1}e^{shape2 meanlog + \frac{shape2^2sdlog^2}{2}}\frac{y^{r- shape2}}{r - shape2}\Phi(\frac{lny - meanlog - shape2 sdlog^2}{sdlog}) \newline \qquad- \frac{shape2shape1}{shape2 + shape1} \frac{1}{r-shape2} e^{\frac{ r^2sdlog^2 + 2meanlog r }{2}}\Phi^c(\frac{lny - rsdlog^2 - meanlog}{sdlog}) \newline \qquad -\frac{shape2shape1}{shape2 + shape1}e^{-shape1 meanlog + \frac{shape1^2sdlog^2}{2}}\frac{y^{r + shape1}}{r + shape1}\Phi^c(\frac{lny - meanlog + shape1 sdlog^2}{sdlog}) \newline \qquad + \frac{shape2shape1}{shape2 + shape1} \frac{1}{r+shape1} e^{\frac{ r^2sdlog^2 + 2meanlog r }{2}}\Phi^c(\frac{lny - rsdlog^2 - meanlog}{sdlog}), \qquad shape2>r

Examples

## Double-Pareto Lognormal density plot(x = seq(0, 5, length.out = 100), y = ddoubleparetolognormal(x = seq(0, 5, length.out = 100))) plot(x = seq(0, 5, length.out = 100), y = ddoubleparetolognormal(x = seq(0, 5, length.out = 100), shape2 = 1)) ## Double-Pareto Lognormal relates to the right-pareto Lognormal distribution if #shape1 goes to infinity pdoubleparetolognormal(q = 6, shape1 = 1e20, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5) prightparetolognormal(q = 6, shape2 = 1.5, meanlog = -0.5, sdlog = 0.5) ## Double-Pareto Lognormal relates to the left-pareto Lognormal distribution if # shape2 goes to infinity pdoubleparetolognormal(q = 6, shape1 = 1.5, shape2 = 1e20, meanlog = -0.5, sdlog = 0.5) pleftparetolognormal(q = 6, shape1 = 1.5, meanlog = -0.5, sdlog = 0.5) ## Double-Pareto Lognormal relates to the Lognormal if both shape parameters go to infinity pdoubleparetolognormal(q = 6, shape1 = 1e20, shape2 = 1e20, meanlog = -0.5, sdlog = 0.5) plnorm(q = 6, meanlog = -0.5, sdlog = 0.5) ## Demonstration of log functionality for probability and quantile function qdoubleparetolognormal(pdoubleparetolognormal(2, log.p = TRUE), log.p = TRUE) ## The zeroth truncated moment is equivalent to the probability function pdoubleparetolognormal(2) mdoubleparetolognormal(truncation = 2) ## The (truncated) first moment is equivalent to the mean of a (truncated) random sample, #for large enough samples. x <- rdoubleparetolognormal(1e5, shape2 = 3) mean(x) mdoubleparetolognormal(r = 1, shape2 = 3, lower.tail = FALSE) sum(x[x > quantile(x, 0.1)]) / length(x) mdoubleparetolognormal(r = 1, shape2 = 3, truncation = quantile(x, 0.1), lower.tail = FALSE)

References

if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_all_ref(.Rdpack.currefs)

  • Maintainer: Ruben Dewitte
  • License: GPL-3
  • Last published: 2020-05-25

Useful links