GENLindley: Generalized Lindley Distribution

Description Usage Arguments Details Value Note Author(s) Source References See Also Examples

Description

Density function, distribution function, quantile function, random number generation and hazard rate function for the generalized Lindley distribution with parameters theta, alpha and beta.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dgenlindley(x, theta, alpha, beta, log = FALSE)

pgenlindley(q, theta, alpha, beta, lower.tail = TRUE, log.p = FALSE)

qgenlindley(p, theta, alpha, beta, lower.tail = TRUE, log.p = FALSE,
  L = 1e-04, U = 50)

rgenlindley(n, theta, alpha, beta, mixture = TRUE, L = 1e-04, U = 50)

hgenlindley(x, theta, alpha, beta, log = FALSE)

Arguments

x, q

vector of positive quantiles.

theta, alpha, beta

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.

L, U

interval which uniroot searches for a root (quantile), L = 1e-4 and U = 50 are the default values.

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{θ ^{α +1}}{≤ft( θ +β \right) Γ ≤ft( α +1\right) }x^{α -1}≤ft( α +β x\right) e^{-θ x}

Cumulative distribution function

F(x\mid θ,α,β )=∑_{j=0}^{1}≤ft\vert j-\frac{θ }{≤ft( θ +β \right) }\right\vert \frac{Γ ≤ft( α -j,θ x\right) }{Γ ≤ft( α -j\right) }

Quantile function

\code{does not have a closed mathematical expression}

Hazard rate function

h(x\mid θ,α,β )=\frac{θ ^{α +1}x^{α -1}≤ft(α +β x\right) e^{-θ x}}{≤ft( θ +β \right) Γ ≤ft( α +1\right) ∑\limits_{j=0}^{1}≤ft\vert j-\frac{θ }{ ≤ft( θ +β \right) }\right\vert \frac{Γ ≤ft( α -j,θ x\right) }{Γ ≤ft( α -j\right) }}

where Γ ≤ft( a,b\right) is the lower incomplete gamma function.

Particular cases: (α=1, β = 1) the one-parameter Lindley distribution, α=1 the two-parameter Lindley distribution, (α=1,β=0) the exponential distribution, β = 0 the gamma distribution and for β=α the weighted Lindley distribution.

Value

dgenlindley gives the density, pgenlindley gives the distribution function, qgenlindley gives the quantile function, rgenlindley generates random deviates and hgenlindley gives the hazard rate function.

Invalid arguments will return an error message.

Note

The uniroot function with default arguments is used to find out the quantiles.

Author(s)

Josmar Mazucheli jmazucheli@gmail.com

Larissa B. Fernandes lbf.estatistica@gmail.com

Source

[d-h-p-q-r]genlindley are calculated directly from the definitions. rgenlindley uses either a two-component mixture of the gamma distributions or the quantile function.

References

Zakerzadeh, H., Dolati, A., (2009). Generalized Lindley distribution. Journal of Mathematical Extension, 3, (2), 13–25.

See Also

lambertWm1, uniroot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(1)
x <- rgenlindley(n = 1000, theta = 1.5, alpha = 1.5, beta = 1.5, mixture = TRUE)
R <- range(x)
S <- seq(from = R[1], to = R[2], by = 0.1)
plot(S, dgenlindley(S, theta = 1.5, alpha = 1.5, beta = 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)
pgenlindley(q, theta = 1.5, alpha = 1.5, beta = 1.5, lower.tail = TRUE)
pgenlindley(q, theta = 1.5, alpha = 1.5, beta = 1.5, lower.tail = FALSE)
qgenlindley(p, theta = 1.5, alpha = 1.5, beta = 1.5, lower.tail = TRUE)
qgenlindley(p, theta = 1.5, alpha = 1.5, beta = 1.5, lower.tail = FALSE)

library(fitdistrplus)
fit <- fitdist(x, 'genlindley', start = list(theta = 1.5, alpha = 1.5, beta = 1.5))
plot(fit)

LindleyR documentation built on May 1, 2019, 8:05 p.m.