Development Status:
The R package ChiRP
is an MCMC-based implementation of Chinese Restaurant Process (CRP) mixtures for regression and clustering. CRP models (aka Dirichlet Process models) are a class of Bayesian nonparametric models. We provide facilities for zero-inflated semi-continuous outcomes, continuous outcomes, and binary outcomes.
Install using devtools
package
## install.packages('devtools' ) ## make sure to have devtools installed
devtools::install_github('stablemarkets/ChiRP')
library(ChiRP)
The companion web site contains the statistical details of the model as well as several replicable examples.
Help documentation in R
is also available. After installing the package and loading it with library()
, use ?
to access help documentation for specific functions:
?ChiRP::NDPMix # for continuous outcomes: outputs draws of posterior *predictive* Y | X ~ N( E[Y|X], sd )), not draws of E[Y|X].
?ChiRP::fDPMix # for continuous outcomes: outputs draws of posterior regression E[Y|X] )
?ChiRP::ZDPMix # for zero-inflated, semi-continuous outcomes
?ChiRP::PDPMix # for binary outcomes
?ChiRP::cluster_assign_mode # computes posterior mode cluster assignment
The help file for each function contains an example that you can run directly in your R
session.
ChiRP
uses the testthat
package for unit-testing and Travis CI for continuous integration. Coverage of unit test is tracked using Coveralls.
If you encounter any bugs or have feature requests, please open an issue on GitHub.
You can contribute in two ways:
- Contribute to base code: First, start an issue in this repository with the proposed modification. Fork this repository, make changes/enhancements, then submit a pull request. The issue will be closed once the pull request is merged.
- Contribute an example: First, start an issue in the companion site's repository. Fork the repository and add a new example to
examples.Rmd
. Usermarkdown::render_site()
to build the site. Submit a pull request in that same repository. The issue will be closed once updates are merged.
The corresponding package author is Arman Oganisian (email: [email protected]). You can follow updates about the package on twitter.