# NWLindley: New Weighted 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 new weighted Lindley distribution with parameters theta and alpha.

## Usage

  1 2 3 4 5 6 7 8 9 10 dnwlindley(x, theta, alpha, log = FALSE) pnwlindley(q, theta, alpha, lower.tail = TRUE, log.p = FALSE) qnwlindley(p, theta, alpha, lower.tail = TRUE, log.p = FALSE, L = 1e-04, U = 50) rnwlindley(n, theta, alpha, L = 1e-04, U = 50) hnwlindley(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.

## Details

Probability density function

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

Cumulative distribution function

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

Quantile function

\code{does not have a closed mathematical expression}

Hazard rate function

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

## Value

dnwlindley gives the density, pnwlindley gives the distribution function, qnwlindley gives the quantile function, rnwlindley generates random deviates and hnwlindley 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]nwlindley are calculated directly from the definitions. rnwlindley uses the quantile function.

## References

Asgharzadeh, A., Bakouch, H. S., Nadarajah, S., Sharafi, F., (2016). A new weighted Lindley distribution with application. Brazilian Journal of Probability and Statistics, 30, 1-27.

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