dlindley: Lindley Distribution Density

View source: R/dlindley.R

Density Lindley DistributionR Documentation

Lindley Distribution Density

Description

Gives the density value of a univariate Lindley Distribution.

Usage

dlindley(x, beta, log = FALSE)

Arguments

x

value or vector of values, to apply in the mixture probability density function.

beta

value of parameter.

log

logical; if TRUE, probabilities p are given as log(p).

Details

The distribution has density

f(x) = (x + 1)/(β * (β + 1)) * exp(-x/β).

Author(s)

CASTRO, M. O.; MONTALVO, G. S. A.

Examples

f <- function(x){dlindley(x, beta = 4)}
## Plot using graphics package
require(graphics)
curve(f, 0, 25)

require(ggplot2)
## Plot using ggplot2 package
ggplot(data.frame(x=c(0, 25)), aes(x)) +
  stat_function(fun=f, size = 1L, colour = "#0c4c8a") +
  theme_minimal()

## Integrate
integrate(f, 0, Inf)$value

matheuscastro43/finiteMix documentation built on March 30, 2022, 12:49 p.m.