dglindley_mix: Generalized Lindley Mixture Density

View source: R/dglindley_mix.R

Density Generalized Lindley MixtureR Documentation

Generalized Lindley Mixture Density

Description

Gives the density value of a univariate Generalized Lindley Mixture.

Usage

dglindley_mix(x, pi, alpha, beta, gamma, log = FALSE)

Arguments

x

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

pi

vector of mixture weights.

alpha

vector of parameters.

beta

vector of parameters.

gamma

vector of parameters.

log

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

Details

Each component of the mixture has density

f_j(x) = (x^(α_j - 1) * (α_j + γ_j*x) * exp(-x/β_j))/(β_j^(α_j * (β_j*γ_j + 1) * Gamma(α_j + 1)))

where α_j, β_j and γ_j are the parameters of the jth component. j = 1, 2, ..., g.

Author(s)

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

Examples

f <- function(x){dglindley_mix(x, pi = c(0.1, 0.9), alpha = c(1, 3), 
                               beta = c(5, 2), gamma = c(1, 2))}
## 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.