mix {Bmix}  R Documentation 
Basic implementation for a variety of stickbreaking mixture models, including particle learning and Gibbs sampling for static DP mixtures, particle learning for dynamic BAR stickbreaking, and DP mixture regression.
mix(Z, alpha, g0params, times=NULL, rho=NULL, cat=0, state=NULL, read=FALSE, print=FALSE, N=100, niter=0)
Z 

alpha 
Stickbreaking precision parameter. 
g0params 
A vector of the base measure parameters: [γ, κ, ν, γ_Ω, Ψ_Ω ], as in Taddy (2009), followed by a list of Dirichlet parameters for each categorical variable. 
times 
Discrete time period for each data row; must be an increasing list of integers starting at 0. 
rho 
Stickbreaking correlation parameter (between 0 and 1). 
cat 
Number of categorical variables. 
state 
Random number generator seed. 
read 
Read in existing particle info? 
print 
Print out particles for each new time? WARNING: This will litter your working directory with .particle* files! 
N 
Number of particles. 
niter 
Number of Gibbs sampling iterations after filtering (only for 
This is a barebones implementation of sampling algorithms for Bayesian stickbreaking mixture models. The software is designed to be easy to customize to suit different situations and for experimentation with stickbreaking models. Since particles are repeatedly copied, it is not especially efficient.
The package implements particle learning (Carvalho et al, 2009) for both dynamic and constant stickbreaking mixture models, and collapsed Gibbs sampling for DP mixtures. Conditional sufficient statistics for each mixture component are output as ‘particle’ files.
Mixture kernels are the product of independent multinomial densities for each categorical variable, and a multivariate normal density for continuous covariates. The base measure is conditionally conjugate normalWishartDirichlet product, with Wishart hyperprior for inverse base covariance. Betaautoregressive stickbreaking is used to model correlated densities.
Refer to Taddy (2009) for all specification details.
See DPreg demo for regression with categorical and continuous covariates, with additional Gibbs sampling for filtered particles.
See bar1D and bar2D demos for dynamic stickbreaking mixture density estimation, Bayes factor calculations, and comparison between correlated and independent model fit.
If print=TRUE particle representations for each time point are printed
to files .particle[i].[t].[rho].txt, where ‘i’ is the particle
id, ‘t’ is the time, and ‘rho’ is the stickbreaking correlation
parameter. These files are read into R via the particle()
function.
Output to R is minimal. The object returned by function mix()
is mostly just a list of input variables, except for
logprob 
Filtered marginal loglikelihood 
m 
Filtered mean number of mixture components 
k 
If kout, this is the list of filtered allocations 
Matt Taddy: matt.taddy@chicagobooth.edu
An autoregressive mixture model for dynamic spatial Poisson processes: Application to tracking the intensity of violent crime (Taddy 2009),
Particle learning for general mixtures (Carvalho, Lopes, Polson, and Taddy 2009),
A Bayesian nonparametric approach to inference for quantile regression (Taddy and Kottas 2009).
and other papers at faculty.chicagobooth.edu/matt.taddy/research.
particle
demo(package="Bmix")