SLindley: Two-Parameter Lindley Distribution

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

Description

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

Usage

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

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

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

rslindley(n, theta, alpha, mixture = TRUE)

hslindley(x, theta, alpha, log = FALSE)

Arguments

x, q

vector of positive quantiles.

theta

positive parameter.

alpha

greater than -theta.

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

Cumulative distribution function

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

Quantile function

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

Hazard rate function

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

where θ > 0, α > -θ and W_{-1} denotes the negative branch of the Lambert W function.

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

Value

dslindley gives the density, pslindley gives the distribution function, qslindley gives the quantile function, rslindley generates random deviates and hslindley 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]slindley are calculated directly from the definitions. rslindley uses either a two-component mixture of the gamma distributions or the quantile function.

References

Shanker, R., Sharma, S. and Shanker, R. (2013). A two-parameter Lindley distribution for modeling waiting and survival times data. Applied Mathematics, 4, (2), 363-368.

See Also

lambertWm1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(1)
x <- rslindley(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, dslindley(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)
pslindley(q, theta = 1.5, alpha = 1.5, lower.tail = TRUE)
pslindley(q, theta = 1.5, alpha = 1.5, lower.tail = FALSE)
qslindley(p, theta = 1.5, alpha = 1.5, lower.tail = TRUE)
qslindley(p, theta = 1.5, alpha = 1.5, lower.tail = FALSE)

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

LindleyR documentation built on May 29, 2017, 10:54 a.m.