Robust statistical data modeling under potential model mis-specification often requires relaxing parametric assumptions for nonparametric assumptions.
In bnp, parameters are infinite dimensional objects such as functions, probability distributions or infinite vectors.
Prior distributions are designed for these parameters, which provide a handle to manage the complexity of nonparametric models in practice.
However, the applicability of bnp models, for data analysis, depends on the availability of user-friendly software. This is because bnp models typically require complex representations, which may not be immediately accessible to non-experts.
This work focuses on inference of densities with mixture models [1]}.
The purpose of the present paper is to introduce and describe an extensive revamping of the BNPdensity package, originally presented in [2]}.
The package is programmed in R, and is available from the Comprehensive R Archive Network (CRAN) at https://CRAN.R-project.org/package=BNPdensity.
To the best of our knowledge, BNPdensity is the first R package which implements bnp density models including all types of censored data (left-, right- and interval-censored data), under a general specification of bnp priors called normalised generalised gamma processes [3]}, [2]}.
The improvements to the package cover various aspects.
Notably, careful profiling and re-writing of some critical parts of the code, along with the
use of the R bytecode compiler, yielded a 4-fold decrease of the running time of the algorithm.
Drawing on the flexibility of the algorithm to use non-conjugate prior, we also implemented a range of popular new priors on the scale parameter of the clusters such as the half-Cauchy [5]}, [6]}, the truncated Gaussian and the uniform distributions.
We also revised the truncation method in the algorithm, intended to deal with the infinite dimensional random measures in the bnp model, to include recent contributions by [7]}.
These provide a better and principled control of the truncation approximation.
Moreover, we extended BNPdensity to include all types of censored data (right-, left- or interval-censored data).
To leverage on the clustering properties of bnp mixture models, we interfaced BNPdensity with other packages to estimate the optimal clustering from posterior samples and provided cluster visualisation tools.
We also implemented functions to compute prior distributions on the number of mixture components, for various processes, to better inform prior specification.
Finally, we added several new functions for graphical model checking, assessing mcmc convergence and parallel computation.
