The zmctp package extends the Complex Triparametric Pearson (CTP) distribution with zero-modified versions for handling overdispersed count data. It addresses limitations in existing implementations when the parameter b approaches zero.
# Install from GitHub (when available)
# devtools::install_github("yourusername/zmctp")
# Or install from source
devtools::install_local("path/to/zmctp")library(zmctp)
# Generate data
x <- rctp(200, a = 1, b = 0.5, gama = 5)
# Fit CTP model
fit <- ctp.fit(x)
print(fit)
plot(fit)
# Fit Zero-Modified CTP
x_zi <- rzictp(200, a = 1, b = 0.5, gama = 5, omega = 0.3)
fit_zi <- zictp.fit(x_zi)
plot(fit_zi)Existing implementations (e.g., the cpd package)
struggle when b ≈ 0, often estimating b = 0 which
reduces model flexibility. The zmctp package solves this
through:
vignette("introduction", package = "zmctp")?ctp.fit,
?zictp.fit, ?dctplibrary(cpd)
library(zmctp)
# Data where cpd estimates b ≈ 0
x <- rzictp(200, a = 1, b = 0.001, gama = 8, omega = 0.2)
# cpd may fail
fit_cpd <- cpd::fitCTP(x)
# b estimate ≈ 0
# zmctp handles it better
fit_zmctp <- zictp.fit(x)
# Recovers both b and omegaIf you use this package, please cite:
@Manual{zmctp,
title = {zmctp: Zero-Modified Complex Triparametric Pearson Distribution},
author = {Rasheedat Oladoja},
year = {2025},
note = {R package version 0.1.0},
}
And the original CTP paper:
@article{rodriguez2003,
title={A new class of discrete distributions with complex parameters},
author={Rodríguez-Avi, J and Conde-Sánchez, A and Sáez-Castillo, AJ},
journal={Statistical Papers},
volume={44},
pages={67--88},
year={2003},
doi={10.1007/s00362-002-0134-7}
}
GPL-3
Rasheedat Oladoja - roladoja@ttu.edu