Build Dirichlet Process Objects for Bayesian Modelling

Perform nonparametric Bayesian analysis using Dirichlet processes without the need to program the inference algorithms. Utilise included pre-built models or specify custom models and allow the '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 and not limited to: density estimation, clustering and prior distributions in hierarchical models. See Teh, Y. W. (2011) < https://www.stats.ox.ac.uk/~teh/research/npbayes/Teh2010a.pdf>, among many other sources.


dirichletprocess

R buildstatus AppVeyor BuildStatus CoverageStatus

The dirichletprocess package provides tools for you to build custom Dirichlet process mixture models. You can use the pre-built Normal/Weibull/Beta distributions or create your own following the instructions in the vignette. In as little as four lines of code you can be modelling your data nonparametrically.

Installation

You can install the stable release of dirichletprocess from CRAN:

install.packages("dirichletprocess")

You can also install the development build of dirichletprocess from github with:

# install.packages("devtools")
devtools::install_github("dm13450/dirichletprocess")

For a full guide to the package and its capabilities please consult the vignette:

browseVignettes(package = "dirichletprocess")

Examples

Density Estimation

Dirichlet processes can be used for nonparametric density estimation.

faithfulTransformed <- faithful$waiting - mean(faithful$waiting)
faithfulTransformed <- faithfulTransformed/sd(faithful$waiting)
dp <- DirichletProcessGaussian(faithfulTransformed)
dp <- Fit(dp, 100, progressBar = FALSE)
plot(dp)

Clustering

Dirichlet processes can also be used to cluster data based on their common distribution parameters.

faithfulTrans <- scale(faithful)
dpCluster <-  DirichletProcessMvnormal(faithfulTrans)
dpCluster <- Fit(dpCluster, 2000, progressBar = FALSE)
plot(dpCluster)

For more detailed explanations and examples see the vignette.

Tutorials

I’ve written a number of tutorials:

and some case studies:

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("dirichletprocess")

0.4.2 by Dean Markwick, 3 years ago


https://github.com/dm13450/dirichletprocess, https://dm13450.github.io/dirichletprocess/


Report a bug at https://github.com/dm13450/dirichletprocess/issues


Browse source code at https://github.com/cran/dirichletprocess


Authors: Gordon J. Ross [aut] , Dean Markwick [aut, cre] , Kees Mulder [ctb] , Giovanni Sighinolfi [ctb] , Filippo Fiocchi [ctb]


Documentation:   PDF Manual  


GPL-3 license


Imports gtools, ggplot2, mvtnorm

Suggests testthat, knitr, rmarkdown, tidyr, dplyr


Imported by MIRES, copre.


See at CRAN