# Lindley: One-Parameter Lindley Distribution In LindleyR: The Lindley Distribution and Its Modifications

## Description

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

## Usage

 1 2 3 4 5 6 7 8 9 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 ≤q 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 deviates are generated from a two-component mixture of gamma distributions, otherwise from the quantile function.

## Details

Probability density function

f(x\mid θ )=\frac{θ ^{2}}{(1+θ )}(1+x)e^{-θ x}

Cumulative distribution function

F(x\mid θ ) =1 - ≤ft(1+ \frac{θ x}{1+θ }\right)e^{-θ x}

Quantile function

Q(p\mid θ )=-1-\frac{1}{θ }-\frac{1}{θ }W_{-1}≤ft((1+θ)( p-1)e^{-(1+θ) }\right)

Hazard rate function

h(x\mid θ )=\frac{θ ^{2}}{1+θ +θ x}(1+x)

where W_{-1} denotes the negative branch of the Lambert W 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.

## Author(s)

Josmar Mazucheli jmazucheli@gmail.com

Larissa B. Fernandes lbf.estatistica@gmail.com

## Source

[d-h-p-q-r]lindley are calculated directly from the definitions. rlindley uses either a two-component mixture of the gamma distributions or the quantile 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.

lambertWm1, DLindley.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 set.seed(1) x <- rlindley(n = 1000, theta = 1.5, mixture = TRUE) R <- range(x) S <- seq(from = R, to = R, 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) ## waiting times data (from Ghitany et al., 2008) data(waitingtimes) library(fitdistrplus) fit <- fitdist(waitingtimes, 'lindley', start = list(theta = 0.1)) plot(fit)