How to build a simple model with copula

I am trying to build the following model:
For 1\leq i \leq k
p_i \sim Beta(\alpha_i, \beta_i)
Where the \{ p_i\} are correlated through a gaussian copula with a given covariance \Sigma
B_i \sim Bernoulli(p_i)
Q=\prod_i p_i

I have observations of \{B_i\} with some missing data.
How do i sample from the posterior distribution of Q?
Also, how do i do it with a custom distribution instead of beta?

Hi @begelfor. There is actually a copula-based example notebook in the works, but it has sat idle for some time. This reminds me to move it forward. In the mean time, I’d recommend An intuitive, visual guide to copulas by @twiecki.

Thank you @drbenvincent. I am familiar with the write-up by @twiecki. My problem lies with its last line: We also haven’t addressed how we would actually fit a copula model. I leave that, as well as the PyMC3 implementation, as an exercise to the motivated reader ;).
I am motivated enough, but I lack the understanding of the library. Any pointers will be, of course more than welcome

So the draft notebook we have explains how to do fitting. The PR is here Bayesian copula estimation example notebook by drbenvincent · Pull Request #257 · pymc-devs/pymc-examples · GitHub Though that was started some time ago - it needs updating from PyMC3 to the latest.

I can try to make progress on this to get it over the line soon, but things are pretty busy at the moment. But maybe you can get something from copula-estimation.ipynb in the draft PR as it stands?

@begelfor If you’re motivated, maybe you can help move the PR over the finish line?