| Title: | Bayesian ZINB-Ordinal Joint Model with CDPMM Random Effects |
| Version: | 0.1.0 |
| Description: | Fits a Bayesian joint model for longitudinal zero-inflated negative binomial (ZINB) and ordinal outcomes with shared random effects under a centered Dirichlet process mixture model (CDPMM) prior. Provides a blocked Gibbs sampler with Polya-Gamma (PG) and Chinese restaurant table data augmentation, plus helpers for simulation and posterior summaries based on the deviance information criterion (DIC), the widely applicable information criterion (WAIC) and the leave-one-out information criterion (LOOIC). The PG augmentation follows Polson, Scott and Windle (2013) <doi:10.1080/01621459.2013.829001>, the zero-inflated negative binomial construction follows Neelon (2019) <doi:10.1214/18-BA1132>, and the centered Dirichlet process mixture prior follows Tang, Tang and Pan (2014) <doi:10.1016/j.csda.2014.02.015>. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/Liang-ShuQing/zinb-ordinal-cdpmm-code |
| BugReports: | https://github.com/Liang-ShuQing/zinb-ordinal-cdpmm-code/issues |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 4.1.0) |
| Imports: | BayesLogit, mvtnorm, MCMCpack, truncnorm, loo, stats |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-10-12 08:00:56 UTC; lenovo |
| Author: | Shuqing Liang [aut, cre], Jiang Du [aut] |
| Maintainer: | Shuqing Liang <lsq19853500795@163.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-10-21 16:40:02 UTC |
zinbcdpmm: Bayesian ZINB–Ordinal Joint Model with CDPMM Random Effects
Description
Fits a Bayesian joint model for longitudinal zero-inflated negative binomial and ordinal outcomes with CDPMM shared random effects via a blocked Gibbs sampler.
Author(s)
Maintainer: Shuqing Liang lsq19853500795@163.com
Authors:
Shuqing Liang lsq19853500795@163.com
Jiang Du dujiang84@163.com
See Also
Useful links:
Fit joint ZINB-ordinal model with CDPMM random effects
Description
Thin wrapper around fit_joint_model.
Usage
fit_zinb_ordinal(data, chain = 2000, burn = 1000, thin = 5, G = 8, ...)
Arguments
data |
A list / |
chain |
MCMC iterations. |
burn |
Burn-in. |
thin |
Thinning interval. |
G |
Truncation level of the stick-breaking CDPMM (default 8). |
... |
Additional arguments passed to |
Value
An object of class zinbcdpmm_fit.
Examples
set.seed(1)
dat <- simulate_zinb_ordinal(n = 8, nis = 2, scenario = 1)
# Tiny chain for a quick check; use much larger chain/burn in applications.
fit <- suppressWarnings(
fit_zinb_ordinal(dat, chain = 25, burn = 10, thin = 5, G = 2)
)
print(fit)
Simulate longitudinal ZINB + ordinal data
Description
Thin wrapper around generate_data. Returns an object of class
zinbcdpmm_data.
Usage
simulate_zinb_ordinal(
n = 100,
nis = 10,
seed = 2026,
random_nis = FALSE,
nis_range = 1:20,
scenario = 1,
C = 5,
re_dist = "normal",
mvt_df = 4,
rho = NULL,
zi_intercept = NULL,
...
)
Arguments
n |
Number of subjects. |
nis |
Visits per subject (scalar or length-n vector). |
seed |
RNG seed. |
random_nis |
If TRUE, sample visit counts from |
nis_range |
Integer range for random visit counts. |
scenario |
Simulation scenario (1, 2, or 3). |
C |
Number of ordinal categories. |
re_dist |
Random-effects truth: "normal", "mixture", or "mvt". |
mvt_df |
Degrees of freedom when |
rho |
Common RE correlation (default 0.5). |
zi_intercept |
Optional override of zero-inflation intercept. |
... |
Passed to |
Value
A list with class zinbcdpmm_data.
Examples
set.seed(1)
dat <- simulate_zinb_ordinal(n = 8, nis = 2, scenario = 1)
stopifnot(inherits(dat, "zinbcdpmm_data"), dat$n == 8L)
Print and summarize zinbcdpmm fits
Description
Print and summarize zinbcdpmm fits
Usage
## S3 method for class 'zinbcdpmm_fit'
print(x, ...)
## S3 method for class 'zinbcdpmm_fit'
summary(object, ...)
## S3 method for class 'summary.zinbcdpmm_fit'
print(x, digits = 3, ...)
Arguments
x |
A |
... |
Unused. |
object |
A |
digits |
Digits for printing. |
Value
print.zinbcdpmm_fit and print.summary.zinbcdpmm_fit
invisibly return their input object (they are called for their side
effect of printing to the console). summary.zinbcdpmm_fit returns
an object of class summary.zinbcdpmm_fit: a list containing
posterior means and 95% credible intervals for the zero-inflation
(alpha), count (beta) and ordinal (gamma) fixed
effects, the thresholds (delta), the negative-binomial size
(r), the implied random-effects covariance Sigma and
correlations Rho, and the information criteria dic,
waic and looic, together with nclust_est.