Kernel density and dirichlet prior

Hello ,every one ! I’m working on a bayesian measurement error model, there have some questions for my working.I want to use dirichlet process(stick-breaking construction) as the latent variable’s prior,but I have some troubles in the construction.
Further more, I want to use kernel density estimation(Gaussian kernel) to smooth the distribution.It is worth noting that it is discrete when dirichlet prior is used for sampling,so I want to smooth it.Can you give me some useful advises?Thanks a lot.

  //the stick-breaking construction
  int<lower=1> L;// length of the truncated Dirichlet process, smaller than n
  real theta[2]; //parameter of the base function of DP

transformed parameters{
  //stick-breaking DP_weights
  real DP_weights[L];
  real sum_DP_weights; 
  real<lower=0> alpha=4;

 DP_weights[1] = nu[1];
  for (s in 2:L){   
    DP_weights[s] = nu[s] * prod(1 - to_vector(nu[1:(s - 1)]));
  for (s in 1:L)
  DP_weights[s] = DP_weights[s] / sum_DP_weights;  //Standardized weight

there is for stick-breaking construction.Then what I should do ?

Sorry, I don’t think I completely understand your problem.

Could you be more specific? What kind of trouble are you having? What is the motivation for the smoothing? I have generally had bad experience trying to use kernel smoothing to approximate densities in Stan, so I would first try to figure out if you are not able to marginalize the discrete parameters out…

Thank you very much. At present, I have solved relevant problems.My original intention was to smooth the discrete dirichlet process using a gaussian kernel.This is owing to some variables are not always discrete.