# GAMLindley: Gamma 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 Gamma Lindley distribution with parameters theta and alpha.

## Usage

 1 2 3 4 5 6 7 8 9 dgamlindley(x, theta, alpha, log = FALSE) pgamlindley(q, theta, alpha, lower.tail = TRUE, log.p = FALSE) qgamlindley(p, theta, alpha, lower.tail = TRUE, log.p = FALSE) rgamlindley(n, theta, alpha, mixture = TRUE) hgamlindley(x, theta, alpha, log = FALSE) 

## Arguments

 x, q vector of positive quantiles. theta, alpha positive parameters. 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 mixture of gamma and one-parameter Lindley distributions, otherwise from the quantile function.

## Details

Probability density function

f(x\mid θ ,α )=\frac{{θ }^{2}}{α ≤ft( 1+θ \right) }≤ft[ ≤ft( α +α θ -θ \right) x+1\right] e{^{-θ x}}

Cumulative distribution function

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

Quantile function

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

Hazard rate function

h(x\mid θ ,α )=\frac{{θ }^{2}≤ft[ ≤ft( α +α θ -θ \right) x+1\right] }{{θ }≤ft( α +α θ-θ \right) x+α ≤ft( 1+θ \right) }

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

Particular case: α = 1 the one-parameter Lindley distribution.

## Value

dgamlindley gives the density, pgamlindley gives the distribution function, qgamlindley gives the quantile function, rgamlindley generates random deviates and hgamlindley gives the hazard rate function.

Invalid arguments will return an error message.

## Author(s)

Josmar Mazucheli [email protected]

Larissa B. Fernandes [email protected]

## Source

[d-h-p-q-r]gamlindley are calculated directly from the definitions. rgamlindley uses either a mixture of gamma and one-parameter Lindley distributions or the quantile function.

## References

Nedjar, S. and Zeghdoudi (2016). On gamma Lindley distribution: Properties and simulations. Journal of Computational and Applied Mathematics, 298, 167-174.

Zeghdoudi, H, and Nedjar, S. (2015) Gamma Lindley distribution and its application. Journal of Applied Probability and Statistics, 11, (1), 1-11.

lambertWm1.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 set.seed(1) x <- rgamlindley(n = 1000, theta = 1.5, alpha = 1.5, mixture = TRUE) R <- range(x) S <- seq(from = R[1], to = R[2], by = 0.1) plot(S, dgamlindley(S, theta = 1.5, alpha = 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) pgamlindley(q, theta = 1.5, alpha = 1.5, lower.tail = TRUE) pgamlindley(q, theta = 1.5, alpha = 1.5, lower.tail = FALSE) qgamlindley(p, theta = 1.5, alpha = 1.5, lower.tail = TRUE) qgamlindley(p, theta = 1.5, alpha = 1.5, lower.tail = FALSE) library(fitdistrplus) fit <- fitdist(x, 'gamlindley', start = list(theta = 1.5, alpha = 1.5)) plot(fit)