Last data update: 2014.03.03

R: Weighted Lindley Distribution
WLindleyR Documentation

Weighted Lindley Distribution

Description

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

Usage

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

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

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

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

hwlindley(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.

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( xmid θ,α) =frac{θ ^{α +1}}{≤ft( θ+α ight) Γ ≤ft( α ight) }x^{α -1}≤ft( 1+x ight)e^{-θ x} label{density-weighted-lindley}

Cumulative distribution function

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

Quantile function

code{does not have a closed mathematical expression}

Hazard rate function

h(xmid θ,α) =frac{θ ^{α +1}x^{α-1}≤ft( 1+x ight) e^{-θ x}}{≤ft( θ +α ight) Γ≤ft( α,θ x ight) +≤ft( θ x ight) ^{α }e^{-θ x}}

where Γ ≤ft(α,θ x ight) = int_{θ x}^{∞}x^{α -1}e^{-x}dx is the upper incomplete gamma function.

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

Value

dwlindley gives the density, pwlindley gives the distribution function, qwlindley gives the quantile function, rwlindley generates random deviates and hwlindley 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]wlindley are calculated directly from the definitions. rwlindley uses either a two-component mixture of the gamma distributions or the quantile function.

References

Al-Mutairi, D. K., Ghitany, M. E., Kundu, D., (2015). Inferences on stress-strength reliability from weighted Lindley distributions. Communications in Statistics - Theory and Methods, 44, (19), 4096-4113.

Bashir, S., Rasul, M., (2015). Some properties of the weighted Lindley distribution. EPRA Internation Journal of Economic and Business Review, 3, (8), 11-17.

Ghitany, M. E., Alqallaf, F., Al-Mutairi, D. K. and Husain, H. A., (2011). A two-parameter weighted Lindley distribution and its applications to survival data. Mathematics and Computers in Simulation, 81, (6), 1190-1201.

Mazucheli, J., Louzada, F., Ghitany, M. E., (2013). Comparison of estimation methods for the parameters of the weighted Lindley distribution. Applied Mathematics and Computation, 220, 463-471.

Mazucheli, J., Coelho-Barros, E. A. and Achcar, J. (2016). An alternative reparametrization on the weighted Lindley distribution. Pesquisa Operacional, (to appear).

See Also

lambertWm1, uniroot, DWLindley.

Examples

set.seed(1)
x <- rwlindley(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, dwlindley(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)
pwlindley(q, theta = 1.5, alpha = 1.5, lower.tail = TRUE)
pwlindley(q, theta = 1.5, alpha = 1.5, lower.tail = FALSE)
qwlindley(p, theta = 1.5, alpha = 1.5, lower.tail = TRUE)
qwlindley(p, theta = 1.5, alpha = 1.5, lower.tail = FALSE)

## carbon fibers data (from Ghitany et al., 2013)
data(carbonfibers)
library(fitdistrplus)
fit <- fitdist(carbonfibers, 'wlindley', start = list(theta = 0.1, alpha = 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/WLindley.Rd_%03d_medium.png", width=480, height=480)
> ### Name: WLindley
> ### Title: Weighted Lindley Distribution
> ### Aliases: WLindley carbonfibers dwlindley hwlindley pwlindley qwlindley
> ###   rwlindley
> 
> ### ** Examples
> 
> set.seed(1)
> x <- rwlindley(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, dwlindley(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)
> pwlindley(q, theta = 1.5, alpha = 1.5, lower.tail = TRUE)
      10%       20%       30%       40%       50%       60%       70%       80% 
0.1132117 0.2082754 0.3247539 0.4165327 0.5174558 0.6215062 0.7147220 0.8011697 
      90% 
0.8933663 
> pwlindley(q, theta = 1.5, alpha = 1.5, lower.tail = FALSE)
      10%       20%       30%       40%       50%       60%       70%       80% 
0.8867883 0.7917246 0.6752461 0.5834673 0.4825442 0.3784938 0.2852780 0.1988303 
      90% 
0.1066337 
> qwlindley(p, theta = 1.5, alpha = 1.5, lower.tail = TRUE)
[1] 0.2953663 0.4955091 0.6874708 0.8859489 1.1016879 1.3478004 1.6458130
[8] 2.0415032 2.6766067
> qwlindley(p, theta = 1.5, alpha = 1.5, lower.tail = FALSE)
[1] 2.6766067 2.0415032 1.6458130 1.3478004 1.1016879 0.8859489 0.6874708
[8] 0.4955091 0.2953663
> 
> ## carbon fibers data (from Ghitany et al., 2013)
> data(carbonfibers)
> library(fitdistrplus)
Loading required package: MASS
> fit <- fitdist(carbonfibers, 'wlindley', start = list(theta = 0.1, alpha = 0.1))
> plot(fit)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>