Learn R Programming

LindleyR (version 1.0.0)

Lindley: One-Parameter Lindley Distribution

Description

Density function, distribution function, quantile function, random numbers generation and hazard rate function for the one-parameter Lindley distribution with parameter theta.

Usage

dlindley(x, theta, log = FALSE)

plindley(q, theta, lower.tail = TRUE, log.p = FALSE)

qlindley(p, theta, lower.tail = TRUE, log.p = FALSE)

rlindley(n, theta, mixture = TRUE)

hlindley(x, theta, log = FALSE)

Arguments

x, q
vector of positive quantiles.
theta
positive parameter.
log, log.p
logical. If TRUE, probabilities p are given as log(p).
lower.tail
logical. If TRUE (default) $P(X \leq x)$ are returned, otherwise $P(X > x)$.
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is taken to be the number required.
mixture
logical. If TRUE (default), random values are generated from a two-component mixture of gamma distributions, otherwise from the quantile function.

Value

  • dlindley gives the density, plindley gives the distribution function, qlindley gives the quantile function, rlindley generates random deviates and hlindley gives the hazard rate function.

    Invalid arguments will return an error message.

source

[dpqh]lindley are calculated directly from the definitions. rlindley uses either a two-component mixture of the gamma distributions or the inverse transform method.

Details

Probability density function $$f(x\mid \theta )=\frac{\theta ^{2}}{(1+\theta )}(1+x)e^{-\theta x}$$

Cumulative distribution function $$F(x\mid \theta ) =1 - \frac{1+\theta +\theta x}{1+\theta }e^{-\theta x}$$

Quantile function $$Q(p\mid \theta )=-1-\frac{1}{\theta }-\frac{1}{\theta }W_{-1}\left((1+\theta)( p-1)e^{-1-\theta }\right)$$

Hazard rate function $$h(x\mid \theta )=\frac{\theta ^{2}}{1+\theta +\theta x}(1+x)$$

where $W_{-1}$ denotes the negative branch of the Lambert W function.

References

Ghitany, M. E., Atieh, B., Nadarajah, S., (2008). Lindley distribution and its application. Mathematics and Computers in Simulation, 78, 4, 49-506.

Jodra, P., (2010). Computer generation of random variables with Lindley or Poisson-Lindley distribution via the Lambert W function. Mathematics and Computers in Simulation, 81, (4), 851-859.

Lindley, D. V., (1958). Fiducial distributions and Bayes' theorem. Journal of the Royal Statistical Society. Series B. Methodological, 20, 102-107.

Lindley, D. V., (1965). Introduction to Probability and Statistics from a Bayesian View-point, Part II: Inference. Cambridge University Press, New York.

See Also

W, Lindley.

Examples

Run this code
set.seed(1)
x <- rlindley(n = 1000, theta = 1.5, mixture = TRUE)
R <- range(x)
S <- seq(from = R[1], to = R[2], by = 0.1)
plot(S, dlindley(S, theta = 1.5), xlab = 'x', ylab = 'pdf')
hist(x, prob = TRUE, main = '', add = TRUE)

p <- seq(from = 0.1, to = 0.9, by = 0.1)
q <- quantile(x, prob = p)
plindley(q, theta = 1.5, lower.tail = TRUE)
plindley(q, theta = 1.5, lower.tail = FALSE)
qlindley(p, theta = 1.5, lower.tail = TRUE)
qlindley(p, theta = 1.5, lower.tail = FALSE)

library(fitdistrplus)
fit <- fitdist(x, 'lindley', start = list(theta = 1.5), lower = c(0))
plot(fit)

Run the code above in your browser using DataLab