| Title: | Three-Parameter Generalized Lindley-Poisson Distribution Functions |
|---|---|
| Description: | Provides functions for random generation, density, cumulative distribution, quantile function, moments, and log-likelihood for a three-parameter generalized Lindley-Poisson mixture model. |
| Authors: | Nisansala Wijerathna [aut, cre], DiangLiang Deng [ths] |
| Maintainer: | Nisansala Wijerathna <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-06-03 09:41:26 UTC |
| Source: | https://github.com/cran/tpglp |
Computes the probability mass function of the Three-Parameter Generalized Lindley-Poisson distribution.
dtpglp(y, pi, theta1, theta2, log = FALSE)dtpglp(y, pi, theta1, theta2, log = FALSE)
y |
Numeric vector of non-negative integers. |
pi |
Numeric. Mixing probability in [0,1]. |
theta1 |
Numeric. Positive parameter. |
theta2 |
Numeric. Positive parameter. |
log |
Logical. If TRUE, returns log-probabilities. |
Numeric vector of probabilities.
dtpglp(0:5, pi = 0.6, theta1 = 1, theta2 = 2)dtpglp(0:5, pi = 0.6, theta1 = 1, theta2 = 2)
Computes the log-likelihood.
logLik_tpglp(y, pi, theta1, theta2)logLik_tpglp(y, pi, theta1, theta2)
y |
Numeric vector of counts. |
pi |
Numeric. Mixing probability. |
theta1 |
Numeric. Positive parameter. |
theta2 |
Numeric. Positive parameter. |
Numeric value.
y <- rpois(100, 2) logLik_tpglp(y, pi = 0.5, theta1 = 1, theta2 = 2)y <- rpois(100, 2) logLik_tpglp(y, pi = 0.5, theta1 = 1, theta2 = 2)
Computes the mean.
mean_tpglp(pi, theta1, theta2)mean_tpglp(pi, theta1, theta2)
pi |
Numeric. Mixing probability. |
theta1 |
Numeric. Positive parameter. |
theta2 |
Numeric. Positive parameter. |
Numeric value.
mean_tpglp(pi = 0.6, theta1 = 1, theta2 = 2)mean_tpglp(pi = 0.6, theta1 = 1, theta2 = 2)
Computes cumulative probabilities.
ptpglp(q, pi, theta1, theta2, lower.tail = TRUE)ptpglp(q, pi, theta1, theta2, lower.tail = TRUE)
q |
Numeric vector of quantiles. |
pi |
Numeric. Mixing probability in [0,1]. |
theta1 |
Numeric. Positive parameter. |
theta2 |
Numeric. Positive parameter. |
lower.tail |
Logical. |
Numeric vector of probabilities.
ptpglp(5, pi = 0.6, theta1 = 1, theta2 = 2)ptpglp(5, pi = 0.6, theta1 = 1, theta2 = 2)
Computes quantiles numerically via inversion.
qtpglp(p, pi, theta1, theta2, max_y = 1000, lower.tail = TRUE)qtpglp(p, pi, theta1, theta2, max_y = 1000, lower.tail = TRUE)
p |
Numeric vector of probabilities. |
pi |
Numeric. Mixing probability. |
theta1 |
Numeric. Positive parameter. |
theta2 |
Numeric. Positive parameter. |
max_y |
Integer search limit. |
lower.tail |
Logical. |
Numeric vector of quantiles.
qtpglp(0.5, pi = 0.6, theta1 = 1, theta2 = 2)qtpglp(0.5, pi = 0.6, theta1 = 1, theta2 = 2)
Generates random observations from a two-component mixture model: an Exponential-Poisson (geometric) component and a Gamma-Poisson (negative binomial) component.
rtpglp(n, pi, theta1, theta2, seed = NULL)rtpglp(n, pi, theta1, theta2, seed = NULL)
n |
number of observations |
pi |
mixing probability |
theta1 |
positive parameter |
theta2 |
positive parameter |
seed |
optional seed |
For each observation:
With probability :
With probability :
Then:
vector of counts
rtpglp(100, pi = 0.6, theta1 = 1, theta2 = 2) rtpglp(100, pi = 0.6, theta1 = 1, theta2 = 2, seed = 123)rtpglp(100, pi = 0.6, theta1 = 1, theta2 = 2) rtpglp(100, pi = 0.6, theta1 = 1, theta2 = 2, seed = 123)
Computes the variance.
var_tpglp(pi, theta1, theta2)var_tpglp(pi, theta1, theta2)
pi |
Numeric. Mixing probability. |
theta1 |
Numeric. Positive parameter. |
theta2 |
Numeric. Positive parameter. |
Numeric value.
var_tpglp(pi = 0.6, theta1 = 1, theta2 = 2)var_tpglp(pi = 0.6, theta1 = 1, theta2 = 2)