bayesmeta (version 2.3)

dlomax: The Lomax distribution.

Description

Lomax density, distribution and quantile functions, and random number generation.

Usage

dlomax(x, scale=1, shape=1, log=FALSE)
  plomax(q, scale=1, shape=1)
  qlomax(p, scale=1, shape=1)
  rlomax(n, scale=1, shape=1)

Arguments

x,q

quantile.

p

probability.

n

number of observations.

scale

scale parameter (\(\lambda > 0\)).

shape

shape parameter (\(\alpha > 0\)).

log

logical; if TRUE, logarithmic density will be returned.

Value

dlomax()’ gives the density function, ‘plomax()’ gives the cumulative distribution function (CDF), ‘qlomax()’ gives the quantile function (inverse CDF), and ‘rlomax()’ generates random deviates.

Details

The Lomax distribution is a heavy-tailed distribution that also is a special case of a Pareto distribution of the 2nd kind. The probability density function of a Lomax distributed variable with shape \(\alpha>0\) and scale \(\lambda>0\) is given by $$p(x) = (\alpha / \lambda) (1 + x / \lambda)^{-(\alpha+1)}.$$ The density function is monotonically decreasing in \(x\). Its mean is \(\lambda / (\alpha-1)\) (for \(\alpha>1\)) and its median is \(\alpha(2^{1/\alpha}-1)\). Its variance is finite only for \(\alpha > 2\) and equals \((\lambda^2 \alpha) / ((\alpha-1)^2 (\alpha-2))\). The cumulative distribution function (CDF) is given by $$P(x) = 1-(1+ x / \lambda)^{-\alpha}.$$

The Lomax distribution also arises as a gamma-exponential mixture. Suppose that \(X\) is a draw from an exponential distribution whose rate \(\theta\) again is drawn from a gamma distribution with shape \(a\) and scale \(s\) (so that \(\mathrm{E}[\theta]=as\) and \(\mathrm{Var}(\theta)=as^2\), or \(\mathrm{E}[1/\theta]=\frac{1}{s(a+1)}\) and \(\mathrm{Var}(1/\theta)=\frac{1}{s^2(a-1)^2(a-2)}\)). Then the marginal distribution of \(X\) is Lomax with scale \(1/s\) and shape \(a\). Consequently, if the moments of \(\theta\) are given by \(\mathrm{E}[\theta]=\mu\) and \(\mathrm{Var}(\theta)=\sigma^2\), then \(X\) is Lomax distributed with shape \(\alpha=\left(\frac{\mu}{\sigma}\right)^2\) and scale \(\lambda=\frac{\mu}{\sigma^2}=\frac{\alpha}{\mu}\). The gamma-exponential connection is also illustrated in an example below.

References

N.L. Johnson, S. Kotz, N. Balakrishnan. Continuous univariate distributions, volume 1. Wiley, New York, 2nd edition, 1994.

See Also

dexp, dgamma, dhalfnormal, dhalft, dhalfcauchy, drayleigh, TurnerEtAlPrior, RhodesEtAlPrior, bayesmeta.

Examples

Run this code
# NOT RUN {
#######################
# illustrate densities:
x <- seq(0,6,le=200)
plot(x, dexp(x, rate=1), type="l", col="cyan", ylim=c(0,1),
     xlab=expression(tau), ylab=expression("probability density "*f(tau)))
lines(x, dlomax(x), col="orange")
abline(h=0, v=0, col="grey")

# show log-densities (note the differing tail behaviour):
plot(x, dexp(x, rate=1), type="l", col="cyan", ylim=c(0.001,1), log="y",
     xlab=expression(tau), ylab=expression("probability density "*f(tau)))
lines(x, dlomax(x), col="orange")
abline(v=0, col="grey")

######################################################
# illustrate the gamma-exponential mixture connection;
# specify a number of samples:
N <- 10000
# specify some gamma shape and scale parameters
# (via mixing distribution's moments):
expectation <- 2.0
stdev       <- 1.0
gammashape <- (expectation / stdev)^2
gammascale <- stdev^2 / expectation
print(c("expectation"=expectation, "stdev"=stdev,
        "shape"=gammashape, "scale"=gammascale))
# generate gamma-distributed rates:
lambda <- rgamma(N, shape=gammashape, scale=gammascale)
# generate exponential draws according to gamma-rates:
y <- rexp(N, rate=lambda)
# determine Lomax quantiles accordingly parameterized:
x <- qlomax(ppoints(N), scale=1/gammascale, shape=gammashape)
# compare distributions in a Q-Q-plot:
plot(x, sort(y), log="xy", main="quantile-quantile plot",
     xlab="theoretical quantile", ylab="empirical quantile")
abline(0, 1, col="red")
# }

Run the code above in your browser using DataLab