\pkg dirichletprocess: An \proglang R Package for Fitting Complex Bayesian Nonparametric Models
Gordon J. Ross University of Edinburgh [email protected], Dean Markwick University College London, Priyanshu Tiwari IIT Kanpur · 2026
Read \pkg dirichletprocess: An \proglang R Package for Fitting Complex Bayesian Nonparametric Models by Gordon J. Ross University of Edinburgh [email protected], Dean Markwick University College London, Priyanshu Tiwari IIT Kanpur (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-01603.txt.
Introduction
Gordon J Ross, Dean Markwick, and Priyanshu Tiwari present an R package that puts Dirichlet process models within reach of working statisticians. These Bayesian nonparametric tools let the data decide how complex a model should be, but coding the sampling machinery by hand has kept many users away.
The package wraps that machinery into flexible objects. A user picks one of the pre-built models or specifies a custom one, and the package runs the Markov chain Monte Carlo sampling behind the scenes. The same objects serve as building blocks across jobs: estimating a density, clustering observations, or supplying prior distributions inside larger hierarchical models. Software papers like this one matter quietly: they turn a research-grade method into a routine tool, with the inference code tested once and reused by many.
Catalog record
| CREATOR | Gordon J. Ross University of Edinburgh [email protected], Dean Markwick University College London, Priyanshu Tiwari IIT Kanpur |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 93 KB |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.01603
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
\pkg dirichletprocess: An \proglang R Package for Fitting Complex Bayesian Nonparametric Models Gordon J. Ross University of Edinburgh [email protected], Dean Markwick University College London, Priyanshu Tiwari IIT Kanpur Abstract \Plainauthor Gordon J. Ross, Dean Markwick, Priyanshu Tiwari \Plaintitle dirichletprocess: An R Package for Fitting Complex Bayesian Nonparametric Models \Shorttitle The \pkg dirichletprocess Package \Abstract The \pkg dirichletprocess package provides software for creating flexible Dirichlet process objects. Users can perform nonparametric Bayesian analysis using Dirichlet processes without the need to program their own inference algorithms. Instead, the user can utilise our pre-built models or specify their own models whilst allowing the \pkg dirichletprocess package to handle the Markov chain Monte Carlo sampling. Our Dirichlet process objects can act as building blocks for a variety of statistical models including: density estimation, clustering and prior distributions in hierarchical models. \Keywords dirichlet process, bayesian inference, nonparametric statistics, \proglang R \Plainkeywords dirichlet process, bayesian inference, nonparametric statistics, R \Address Gordon J. Ross School of Mathematics University of Edinburgh James Clerk Maxwell Building Edinburgh, UK E-mail: URL: http://gordonjross.co.uk/ and Dean Markwick Department of Statistical Science University College London 1-19 Torrington Place London, UK E-mail: URL: http://dm13450.github.io/ and Priyanshu Tiwari Indian Institute of Technology Kanpur Kalyanpur Kanpur -208 016 Email: [email protected] 1 Introduction Many applications of statistical models require parametric specifications of the probability distributions of interest – that observations are generated by Normal distributions, that group-level fixed effects can be modeled by Gamma distributions, and so on. However in some situations there will be insufficient prior information and data to justify such parametric assumptions. In this case, nonparametric methods allow a more flexible and robust specification of distributions, so their essential features can be ‘learned from the data’ rather than specified in advance. While frequentist nonparametrics has a long history, Bayesian nonparametrics was a relatively dormant field until the mid 1990s. Although much of the theory of nonparametric priors had been worked out in previous decades ( 6 ) , computational issues prevented their widespread adoption. This changed with the development of posterior simulation methods such as Metropolis-Hastings ( 10 ) and the Gibbs sampler ( 9 ) which were first applied to the task of nonparametric density estimation using Dirichlet process (DP) mixtures in a seminal paper by 5 . This kickstarted research into Bayesian nonparametrics, which has now become one of the most popular research areas in the statistics and machine learning literature. While there are now several widely used models within the field of Bayesian nonparametrics including the Gaussian process, Beta process and Polya trees, the Dirichlet process mixture model (DPMM) has been the most popular due to its wide applicability and elegant computational structure. At the most basic level, the DPMM can be viewed as an infinite dimensional mixture model which represents an unknown density f(y) as: f(y)=\int k(y\mid\theta)p(\theta\mid G)\mathrm{d}\theta,\quad G\sim\text{DP}(\alpha,G_{0}), where k(\cdot\mid\theta) denotes the mixture kernel, and the mixing distribution G is assigned a nonparametric Dirichlet process prior with a base measure G_{0} and concentration parameter \alpha . In the most widely used DPMM, the mixture kernel is taken to be Gaussian so that \theta=(\mu,\sigma^{2}) and k(y\mid\theta)=N(y\mid\mu,\sigma^{2}) with a conjugate Normal Inverse-Gamma specification for G_{0} . The infinite dimensional nature of such a model makes it capable of approximating any continuous distribution to an arbitrary degree of accuracy. The use of DPMMs is not restricted to simply estimating the density of observed data. Instead, the DPMM can be used at any level in a hierarchical model where it is considered necessary to represent a density nonparametrically due to a lack of knowledge about its parametric form. For example, consider a (multilevel) random effects model where there are J groups of observations, with observations in each group j following a Gaussian distribution with a group-specific mean \mu_{j} and a common variance \sigma^{2} . To share information across groups, the means \mu_{j} are assumed to be exchangeable and assigned a prior p(\mu_{j}) . If y_{i,j} denotes the i^{th} observation in group j , then the model is: \displaystyle y_{i,j} \displaystyle\sim N(y_{i,j}\mid\mu_{j},\sigma^{2}), \displaystyle\mu_{j} \displaystyle\sim p(\mu_{j}\mid\gamma), where \gamma is the (hyper-)parameters of the prior. This model is an example of partial pooling , where the inference for each mean \mu_{j} is based on the means of each of the other J-1 groups, allowing information to be shared across groups. As a biased estimation technique, it is related to methods such as the Lasso estimator, and usually results in more accurate estimation than estimating each group mean separately. However, completing the model specification requires choosing a form for the prior distribution of group means p(\mu_{j}\mid\gamma) , which is made more difficult since the group means may not be observable with a high degree of accuracy, particularly when the number of observations is small. In this case, using a nonparametric DPMM specification for p(\mu_{j}\mid\gamma) would avoid the risks of potentially specifying an inappropriate parametric form. Typically when working with DPMMs, the posterior distributions are analytically intractable, so inference instead usually involves computational simulation. A variety of simulation algorithms based around Gibbs sampling and Metropolis-Hastings have been developed to draw samples from DPMM posterior distributions, which can then be used for inference. As such, the widespread adoption of DPMMs has to some extent been held back by the level of statistical and programming literacy required to implement and use them. The purpose of the \pkg dirichletprocess package is not to automate a pre-specified range of tasks, but instead to represent Dirichlet process mixture models as objects in \proglang R so that they can be used as building blocks inside user-specified models. The target audience is hence users who are working with models which use a DPMM at some stage, and who require a DPMM implementation which can be used as part of a more general estimation scheme. As such, the number of tasks which can be achieved using \pkg dirichletprocess is quite large, with an emphasis on flexibility and extensibility rather than a fixed collection of model-specific routines. Several software packages are available for Dirichlet process and related Bayesian nonparametric mixture modelling. Historically, \pkg DPpackage ( 11 ) provided an important collection of implementations for specific Dirichlet process models, although it is now archived on CRAN. More recent \proglang R packages such as \pkg PReMiuM ( 14 ) and \pkg BNPmix ( 4 ) focus on more specialised model classes, including profile regression, clustering, density estimation, and dependent or partially exchangeable extensions. More general probabilistic programming frameworks such as Stan ( 2 ) and PyMC ( 1 ) are broader in scope, but are not built around the object-based Dirichlet process mixture workflow used here; in particular, Stan does not directly sample latent discrete parameters and instead requires such models to be reformulated by marginalisation. In contrast, the aim of \pkg dirichletprocess is to provide a flexible object-based framework for constructing, fitting, and extending Dirichlet process mixture models within \proglang R, rather than a fixed collection of model-specific procedures. The corresponding trade-off is that packages designed for more specialised model classes or broader probabilistic programming tasks may be preferable when those settings align closely with the application of interest. Key features of the \pkg dirichletprocess package include: • An implementation of DP mixture models for various types of