Learn R Programming

DiscreteDists (version 1.1.3)

NPGL: New Poisson-generalised Lindley distribution

Description

The function NPGL() defines the Poisson-generalised Lindley distribution, a two parameter distribution, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss().

Usage

NPGL(mu.link = "log", sigma.link = "log")

Value

Returns a gamlss.family object which can be used to fit a NPGL distribution in the gamlss() function.

Arguments

mu.link

defines the mu.link, with "log" link as the default for the mu parameter.

sigma.link

defines the sigma.link, with "log" link as the default for the sigma.

Author

Tomás Mesa, tomas.mesaz@udea.edu.co

Details

The Poisson-generalised Lindley distribution with parameters \(\mu\) and \(\sigma\) has support \(x = 0, 1, 2, \ldots\) and probability mass function given by

\(f(x \mid \mu, \sigma)=\frac{\mu^2+\frac{\mu^{\sigma}(\mu+1)^{1-\sigma}\Gamma(x+\sigma)}{\Gamma(\sigma)\Gamma(x+1)}}{(\mu+1)^{x+2}}\)

with \(\mu > 0\) and \(\sigma > 0\).

This distribution is useful for modeling over-dispersed count data.

Note: in this implementation we changed the original parameters \(\theta\) and \(\alpha\) for \(\mu\) and \(\sigma\) respectively, we did it to implement this distribution within gamlss framework.

References

Altun, E. A new two-parameter discrete poisson-generalized Lindley distribution with properties and applications to healthcare data sets. Comput Stat 36, 2841–2861 (2021). https://doi.org/10.1007/s00180-021-01097-0

See Also

dNPGL.

Examples

Run this code
# Example 1
# Generating some random values with
# known mu and sigma

set.seed(123)
y <- rNPGL(n=100, mu=20, sigma=2)

# Fitting the model
library(gamlss)
mod1 <- gamlss(y~1, family=NPGL,
               control=gamlss.control(n.cyc=500, trace=FALSE))

# Extracting the fitted values for mu and sigma
exp(coef(mod1, what="mu"))
exp(coef(mod1, what="sigma"))

# Example 2
# Generating random values under some model

# A function to simulate a data set with Y ~ NPGL
gendat <- function(n) {
  x1 <- runif(n)
  x2 <- runif(n)
  mu    <- exp(1.7 - 2.8 * x1) # Approx 1.35
  sigma <- exp(0.73 + 1 * x2)  # Approx 3.42
  y <- rNPGL(n=n, mu=mu, sigma=sigma)
  data.frame(y=y, x1=x1, x2=x2)
}

set.seed(1234)
datos <- gendat(n=200)

mod2 <- gamlss(y~x1, sigma.fo=~x2, family=NPGL, data=datos,
               control=gamlss.control(n.cyc=800, trace=FALSE))

summary(mod2)

Run the code above in your browser using DataLab