EDCM MM with EP

Hello,

I am new to stan and after looking at the experiments section in expectation propagation as a way of life, I want to implement the following mixture model using EP to learn about EP and stan.

The model is basically a mixture of EDCMs as explained here.

The PGM looks like this:

where:

45

I am using the following site approximations:

34

That leads to the following approximating distribution:

I derived the model with EP, but I am having problems implementing in stan. Could somebody guide to where to start? I am looking at the code in ep-stan, but I don’t know what to look for.

Also, Z_i is not closed form since I have an EDCM and Gaussian distributions, so is there any way to use Laplace or MCMC in stan.

Thanks so much for your help!

Since the B_j values for the EDCM distribution are really small (B_j<<1), is it okay to use a truncated gaussian distribution 0-1 or a beta distribution for each site?

And how can I define a custom distribution in Stan?