dlomax {bayesmeta} | R Documentation |
Lomax density, distribution and quantile functions, random number generation, and expectation and variance.
dlomax(x, shape=1, scale=1, log=FALSE) plomax(q, shape=1, scale=1) qlomax(p, shape=1, scale=1) rlomax(n, shape=1, scale=1) elomax(shape=1, scale=1) vlomax(shape=1, scale=1)
x,q |
quantile. |
p |
probability. |
n |
number of observations. |
shape |
shape parameter (α > 0). |
scale |
scale parameter (λ > 0). |
log |
logical; if |
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 α>0 and scale λ>0 is given by
p(x) = (α / λ) (1 + x / λ)^{-(α+1)}.
The density function is monotonically decreasing in x. Its mean is λ / (α-1) (for α>1) and its median is alpha*(2^(1/alpha)-1). Its variance is finite only for α > 2 and equals (lambda^2*alpha) / ((alpha-1)^2 * (alpha-2)). The cumulative distribution function (CDF) is given by
P(x) = 1-(1+ x / λ)^{-α}.
The Lomax distribution also arises as a gamma-exponential mixture. Suppose that X is a draw from an exponential distribution whose rate θ again is drawn from a gamma distribution with shape a and scale s (so that E[theta]=as and Var(theta)=as^2, or E[1/theta]=1/(s*(a+1)) and Var(1/theta)=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 θ are given by \mathrm{E}[θ]=μ and \mathrm{Var}(θ)=σ^2, then X is Lomax distributed with shape alpha=(mu/sigma)^2 and scale lambda=mu/sigma^2=alpha/mu. The gamma-exponential connection is also illustrated in an example below.
‘dlomax()
’ gives the density function,
‘plomax()
’ gives the cumulative distribution
function (CDF),
‘qlomax()
’ gives the quantile function (inverse CDF),
and ‘rlomax()
’ generates random deviates.
The ‘elomax()
’ and ‘vlomax()
’
functions return the corresponding Lomax distribution's
expectation and variance, respectively.
Christian Roever christian.roever@med.uni-goettingen.de
C. Roever, R. Bender, S. Dias, C.H. Schmid, H. Schmidli, S. Sturtz, S. Weber, T. Friede. On weakly informative prior distributions for the heterogeneity parameter in Bayesian random-effects meta-analysis. Research Synthesis Methods, 12(4):448-474, 2021. doi: 10.1002/jrsm.1475.
N.L. Johnson, S. Kotz, N. Balakrishnan. Continuous univariate distributions, volume 1. Wiley, New York, 2nd edition, 1994.
dexp
,
dgamma
,
dhalfnormal
, dhalft
, dhalfcauchy
,
drayleigh
,
TurnerEtAlPrior
, RhodesEtAlPrior
,
bayesmeta
.
####################### # 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")