This function provides samples from a random measure having a Dirichlet process prior. Realizations are almost surely discrete and represented by a (finite) stick-breaking representation (Sethuraman, 1994), whose atoms (or point masses) are independent and identically distributed. This sampler can only be used with models containing a dCRP
distribution .
The MCMC
argument is an object of class MCMC provided by buildMCMC
, or its compiled version. The MCMC should already have been run, as getSamplesDPmeasure
uses the parameter samples to generates samples for the random measure. Note that the monitors associated with that MCMC must include the cluster membership variable (which has the dCRP
distribution), the cluster parameter variables, all variables directly determining the dCRP
concentration parameter, and any stochastic parent variables of the cluster parameter variables. See help(configureMCMC)
or help(addMonitors)
for information on specifying monitors for an MCMC.
The epsilon
argument is used to determine the truncation level of the random measure. epsilon
is the tail probability of the random measure, which together with posterior samples of the concentration parameter, determines the truncation level (see Section 3 in Gelfand, A.E. and Kottas, A. 2002). The default value is 1e-4.
The returned list contains a matrix with samples from the random measure (one sample per row) and the truncation level. The stick-breaking weights are named weights
and the atoms, or point masses, are named based on the cluster variables in the model.