| Type: | Package |
| Title: | Zero-Modified Complex 'Tri-Parametric' Pearson Distribution for Overdispersed Count Data |
| Version: | 0.1.0 |
| Description: | Implements zero-modified versions of the Complex 'Tri-Parametric' Pearson distribution for overdispersed count data. The package addresses limitations of existing implementations when the parameter b approaches zero. It provides distribution functions, maximum likelihood estimation, and diagnostic tools for modeling count data with excess zeros. The methodology is based on 'Rodriguez-Avi' and coauthors (2003) <doi:10.1007/s00362-002-0134-7>. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| Depends: | R (≥ 3.5.0) |
| Imports: | stats, graphics |
| Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown, spelling |
| VignetteBuilder: | knitr |
| RoxygenNote: | 7.3.3 |
| URL: | https://github.com/roladoja/zmctp |
| BugReports: | https://github.com/roladoja/zmctp/issues |
| Maintainer: | Rasheedat Oladoja <roladoja@ttu.edu> |
| Language: | en-US |
| NeedsCompilation: | no |
| Packaged: | 2026-03-30 15:14:35 UTC; kemmi |
| Author: | Rasheedat Oladoja |
| Repository: | CRAN |
| Date/Publication: | 2026-04-03 08:00:02 UTC |
zmctp: Zero-Modified Complex Triparametric Pearson Distribution
Description
The zmctp package extends the Complex Triparametric Pearson (CTP) distribution with zero-modified versions for handling overdispersed count data, particularly when the parameter b approaches zero.
Details
Main functions:
-
dzictp,pzictp,qzictp,rzictp- Zero-Modified CTP distribution functions -
ctp.fit- Fit CTP model -
zictp.fit- Fit Zero-Modified CTP model
Author(s)
Maintainer: Rasheedat Oladoja roladoja@ttu.edu (ORCID)
See Also
Useful links:
Maximum Likelihood Estimation for the CTP Distribution
Description
Fits the Complex Triparametric Pearson (CTP) distribution to count data using maximum likelihood estimation.
Usage
ctp.fit(
x,
a_start = NULL,
b_start = NULL,
gama_start = NULL,
method = "L-BFGS-B",
penalty = 1e+10
)
Arguments
x |
Numeric vector of nonnegative counts. |
a_start |
Optional starting value for parameter a. |
b_start |
Optional starting value for parameter b. |
gama_start |
Optional starting value for parameter gamma. |
method |
Optimization method (default: "L-BFGS-B"). |
penalty |
numeric penalty added for numerical stability when b → 0 |
Value
An object of class "ctpfit" containing:
estimates |
Named vector of MLEs |
se |
Standard errors |
vcov |
Variance-covariance matrix |
logLik |
Log-likelihood |
AIC |
Akaike Information Criterion |
BIC |
Bayesian Information Criterion |
pearson_chisq |
Pearson's chi-squared statistic |
wald_chisq |
Wald's chi-squared statistic |
fitted_freq |
Data frame of observed vs expected frequencies |
data |
Original data |
converged |
Convergence status |
Examples
set.seed(123)
x <- rctp(30, a = 1, b = 0.5, gama = 5)
fit <- ctp.fit(x)
print(fit)
plot(fit)
Probability Mass Function of the CTP Distribution
Description
Evaluates the probability mass function of the Complex TriParametric Pearson (CTP) distribution for nonnegative integer values.
The pmf is
p(x) = p(0)\frac{(a+ib)_x(a-ib)_x}{(\gamma)_x x!}, \quad x=0,1,\dots
and satisfies the recurrence
\frac{p(x+1)}{p(x)} = \frac{(a+x)^2+b^2}{(\gamma+x)(x+1)}.
Usage
dctp(x, a, b, gama, log = FALSE)
Arguments
x |
Vector of nonnegative integers. |
a |
Parameter a. |
b |
Parameter b (must satisfy b >= 0). |
gama |
Parameter gamma. |
log |
Logical; if TRUE, returns log-probabilities. |
Value
A numeric vector of probabilities.
Examples
dctp(0:5, a = 1, b = 0.5, gama = 6)
Probability Mass Function of the ZM-CTP Distribution
Description
The Zero-Modified CTP (ZM-CTP) distribution modifies the zero probability of the baseline CTP distribution.
Usage
dzictp(x, a, b, gama, omega, log = FALSE)
Arguments
x |
Vector of nonnegative integers. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
omega |
Zero-modification parameter, with 0 < omega < 1. |
log |
Logical; if TRUE, returns log-probabilities. |
Value
Numeric vector of probabilities.
Examples
dzictp(0:5, a = 1, b = 0.5, gama = 6, omega = 0.3)
Cumulative Distribution Function of the CTP Distribution
Description
Cumulative Distribution Function of the CTP Distribution
Usage
pctp(q, a, b, gama, lower.tail = TRUE, log.p = FALSE)
Arguments
q |
Vector of quantiles. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
lower.tail |
Logical; if TRUE, probabilities are P(X <= q), otherwise P(X > q). |
log.p |
Logical; if TRUE, probabilities are given on the log scale. |
Value
Numeric vector of cumulative probabilities.
Examples
pctp(0:5, a = 1, b = 0.5, gama = 6)
Plot method for ctpfit objects
Description
Plot method for ctpfit objects
Usage
## S3 method for class 'ctpfit'
plot(x, type = c("frequency", "cdf", "qq"), ...)
Arguments
x |
A ctpfit object |
type |
Type of plot: "frequency", "cdf", or "qq" |
... |
Additional graphical parameters |
Value
No return value. Called for its side effect of producing a plot.
Plot method for zictpfit objects
Description
Creates diagnostic plots for Zero-Modified CTP distribution fits, including frequency comparisons, CDF plots, and Q-Q plots.
Usage
## S3 method for class 'zictpfit'
plot(x, type = c("frequency", "cdf", "qq"), ...)
Arguments
x |
A zictpfit object from zictp.fit() |
type |
Type of plot: "frequency", "cdf", or "qq" |
... |
Additional graphical parameters |
Value
No return value. Called for its side effect of producing a plot.
Print method for ctpfit objects
Description
Print method for ctpfit objects
Usage
## S3 method for class 'ctpfit'
print(x, ...)
Arguments
x |
A ctpfit object |
... |
Additional arguments (ignored) |
Value
Invisibly returns the original fitted model object. The function is called for its side effect of printing a model summary.
Print method for zictpfit objects
Description
Print method for zictpfit objects
Usage
## S3 method for class 'zictpfit'
print(x, ...)
Arguments
x |
A zictpfit object |
... |
Additional arguments (ignored) |
Value
Invisibly returns the original fitted model object. The function is called for its side effect of printing a model summary.
Cumulative Distribution Function of the ZM-CTP Distribution
Description
Cumulative Distribution Function of the ZM-CTP Distribution
Usage
pzictp(q, a, b, gama, omega, lower.tail = TRUE, log.p = FALSE)
Arguments
q |
Vector of quantiles. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
omega |
Zero-modification parameter. |
lower.tail |
Logical. |
log.p |
Logical. |
Value
Numeric vector of cumulative probabilities.
Examples
pzictp(0:5, a = 1, b = 0.5, gama = 6, omega = 0.3)
Quantile Function of the CTP Distribution
Description
Quantile Function of the CTP Distribution
Usage
qctp(p, a, b, gama, lower.tail = TRUE, log.p = FALSE, max_q = 1000)
Arguments
p |
Vector of probabilities. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
lower.tail |
Logical. |
log.p |
Logical. |
max_q |
Maximum x to search. |
Value
Numeric vector of quantiles.
Examples
qctp(c(0.25, 0.5, 0.75), a = 1, b = 0.5, gama = 6)
Quantile Function of the ZM-CTP Distribution
Description
Quantile Function of the ZM-CTP Distribution
Usage
qzictp(p, a, b, gama, omega, lower.tail = TRUE, log.p = FALSE, max_q = 1000)
Arguments
p |
Vector of probabilities. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
omega |
Zero-modification parameter. |
lower.tail |
Logical. |
log.p |
Logical. |
max_q |
Maximum x to search. |
Value
Numeric vector of quantiles.
Examples
qzictp(c(0.25, 0.5, 0.75), a = 1, b = 0.5, gama = 6, omega = 0.3)
Random Generation from the CTP Distribution
Description
Random Generation from the CTP Distribution
Usage
rctp(n, a, b, gama)
Arguments
n |
Number of observations. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
Value
Integer vector of random draws.
Examples
set.seed(123)
rctp(10, a = 1, b = 0.5, gama = 6)
Random Generation from the ZM-CTP Distribution
Description
Random Generation from the ZM-CTP Distribution
Usage
rzictp(n, a, b, gama, omega)
Arguments
n |
Number of observations. |
a |
Parameter a. |
b |
Parameter b. |
gama |
Parameter gamma. |
omega |
Zero-modification parameter. |
Value
Integer vector of random draws.
Examples
set.seed(123)
rzictp(10, a = 1, b = 0.5, gama = 6, omega = 0.3)
Summary method for ctpfit objects
Description
Summary method for ctpfit objects
Usage
## S3 method for class 'ctpfit'
summary(object, ...)
Arguments
object |
A ctpfit object |
... |
Additional arguments (ignored) |
Value
Invisibly returns the original fitted model object. The function is called for its side effects, producing a formatted summary of parameter estimates, moments, and goodness-of-fit diagnostics.
Summary method for zictpfit objects
Description
Summary method for zictpfit objects
Usage
## S3 method for class 'zictpfit'
summary(object, ...)
Arguments
object |
A zictpfit object |
... |
Additional arguments (ignored) |
Value
Invisibly returns the original fitted model object. The function is called for its side effects, producing a formatted summary of parameter estimates, moments, and goodness-of-fit diagnostics.
Maximum Likelihood Estimation for the Zero-Modified CTP Distribution
Description
Fits the Zero-Modified Complex TriParametric Pearson (ZM-CTP) distribution to count data using maximum likelihood estimation.
A logit reparameterization is used for omega to ensure 0 < omega < 1, and a log reparameterization is used for gamma so that gama = 2*a + 2 + exp(eta), which guarantees variance existence throughout optimization.
Usage
zictp.fit(
x,
a_start = NULL,
b_start = NULL,
gama_start = NULL,
omega_start = NULL,
method = "BFGS"
)
Arguments
x |
Numeric vector of nonnegative counts. |
a_start |
Optional starting value for parameter a. |
b_start |
Optional starting value for parameter b. |
gama_start |
Optional starting value for parameter gamma. |
omega_start |
Optional starting value for omega (0 < omega < 1). |
method |
Optimization method (default: "BFGS"). |
Value
An object of class '"zictpfit"'.
Examples
set.seed(123)
x <- rzictp(30, a = 1, b = 0.5, gama = 5, omega = 0.3)
fit <- zictp.fit(x)
fit$estimates