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.

```
data{
//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)]));
}
sum_DP_weights=sum(DP_weights);
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 ?