R codes implementing MCMC algorithms for DP mixture of univariate Normals
| Level | Distribution |
|---|---|
| Kernel | y_i | μ_i, σ² ~ Normal(μ_i, σ²) |
| Mixing distribution | μ_i | G ~ G |
| Dirichlet process prior | G | α ~ DP(α, G₀) |
| Base measure | G₀ = Normal(μ₀, τ₀²) |
| Concentration parameter | α ~ p(α) |
Please cite the following publication if you use this repository in your research:
Franzolini, B. & Gaffi, F., (2026). Complexity bounds for Dirichlet process slice samplers. 43rd International Conference on Machine Learning (ICML 2026)
_main_to_run1.R runs the numerical experiment with 3 equally-sized clusters
_main_to_run2.R runs the numerical experiment with perturbed zipf
BGS.R MCMC function to run the block Gibbs sampler
CRPnoAtoms.R MCMC function to run the CRP with atoms
CRPwithAtoms.R MCMC function to run the CRP with atoms
DPalg.R this code sources the required functions and packages it is called by _main_to_run1.R and _main_to_run2.R
Slice.R MCMC function to run the slice sampler
SlicenoAtoms.R MCMC function to run the slice sampler with no atoms
utils contains helper functions for the MCMCs
LaplacesDemon(version 16.1.6) — sampling from finite Dirichlet distributionsprogress(version 1.2.3) — progress barsrstudioapi(version 0.17.1) — working directory handlingggplot2(version 4.0.1) — plottingpatchwork(version 1.3.2) — combining plotsfossil(version 0.4.0) — Rand index computationsalso(version 0.3.53) — posterior similarity matrices and clustering point estimates
For bug reporting purposes, e-mail Beatrice Franzolini (franzolini@pm.me)
Clone the repository and make sure all required packages are installed before running the scripts.
To reproduce the experiments, open one of the main scripts (for example _main_to_run1.R) in RStudio and run it or source it.