zmctp: Zero-Modified Complex Triparametric Parametric Distribution

R-CMD-check License: GPL v3

Overview

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.

Key Features

Installation

# Install from GitHub (when available)
# devtools::install_github("yourusername/zmctp")

# Or install from source
devtools::install_local("path/to/zmctp")

Quick Start

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)

Why zmctp?

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:

  1. Reparameterization - Ensures variance constraint is always satisfied
  2. Zero-Modified variant - Explicitly models zero-inflation/deflation
  3. Better optimization - Robust default starting values

Documentation

Example: Comparison with cpd

library(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 omega

Citation

If 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}
}

License

GPL-3

Author

Rasheedat Oladoja - roladoja@ttu.edu