# How to draw samples from a Bayesian nonparamatric density estimation? [DPpackage]

I am trying to compute a Kernel Density from high dimensional data ($n > 2$). The underlying (generative) model is assumed unknown.

The goal is to draw samples from this estimate, in a sense creating synthetic data akin to the underlying distribution.

I was hoping to use Bayesian nonparametrics for this, since the complexity of the model can then grow with the amount of observed data.

The intuition was to use the Dirichlet Process with a Gaussian kernel. DPpackage supports this functionality, but I have little clue on how to interpret the results or sample from them.

Does anyone have a short explanation on how to interpret the returned values from the DPdensity function, and possibly sample from them?

-

## 1 Answer

Neal 2000 gives an overview of the MCMC implementations for DP models. Indeed the package docs reference algorithm 8 from that paper as the default in the method you mention.

Looking at the docs I'd suggest having a poke at the thetasave save attribute of the returned object. I'd guess the thetas will involve tuples of (mean vector, inverse wishart matrix) as the components of the gaussian mixture model sampled at each iteration.

-