Last data update: 2014.03.03

R: One-Parameter Lindley Distribution
LindleyR Documentation

One-Parameter Lindley Distribution

Description

Density function, distribution function, quantile function, random number 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 ≤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(xmid θ )=frac{θ ^{2}}{(1+θ )}(1+x)e^{-θ x}

Cumulative distribution function

F(xmid θ ) =1 - ≤ft(1+ frac{θ x}{1+θ } ight)e^{-θ x}

Quantile function

Q(pmid θ )=-1-frac{1}{θ }-frac{1}{θ }W_{-1}≤ft((1+θ)( p-1)e^{-(1+θ) } ight)

Hazard rate function

h(xmid θ )=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.

See Also

lambertWm1, DLindley.

Examples

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)

## waiting times data (from Ghitany et al., 2008)
data(waitingtimes)
library(fitdistrplus)
fit <- fitdist(waitingtimes, 'lindley', start = list(theta = 0.1))
plot(fit)


Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LindleyR)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LindleyR/Lindley.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Lindley
> ### Title: One-Parameter Lindley Distribution
> ### Aliases: Lindley dlindley hlindley plindley qlindley rlindley
> ###   waitingtimes
> 
> ### ** Examples
> 
> 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)
       10%        20%        30%        40%        50%        60%        70% 
0.09817996 0.19989985 0.29902217 0.40432785 0.51980019 0.59989131 0.70652747 
       80%        90% 
0.80249670 0.89937839 
> plindley(q, theta = 1.5, lower.tail = FALSE)
      10%       20%       30%       40%       50%       60%       70%       80% 
0.9018200 0.8001002 0.7009778 0.5956721 0.4801998 0.4001087 0.2934725 0.1975033 
      90% 
0.1006216 
> qlindley(p, theta = 1.5, lower.tail = TRUE)
[1] 0.1145570 0.2376153 0.3721440 0.5222804 0.6942468 0.8982645 1.1532321
[8] 1.5010908 2.0740189
> qlindley(p, theta = 1.5, lower.tail = FALSE)
[1] 2.0740189 1.5010908 1.1532321 0.8982645 0.6942468 0.5222804 0.3721440
[8] 0.2376153 0.1145570
> 
> ## waiting times data (from Ghitany et al., 2008)
> data(waitingtimes)
> library(fitdistrplus)
Loading required package: MASS
> fit <- fitdist(waitingtimes, 'lindley', start = list(theta = 0.1))
> plot(fit)
> 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>