Gaussian copula for discrete marginals

@anhsmith Thanks for your message. Happy to discuss this as have been thinking of making more multivariate discrete copula densities (and perhaps putting them into a package). My email is ben.c.lambert@gmail.com if you want to send me a message.

1 Like

Hi @Andre_Pfeuffer
Could you please explain to me why you used the poisson_lpmf?

I reckon to construct a bivariate discrete density with copulas you need only the cdfs and not the pmfs. Is it correct?

I guess you take P(X<=x)=P(X=x)+P(X<=x-1)?
Is it more efficient this way???

That’s the idea. When using two times CDF we need to sum up from 0 … x-1 and 0 … x.
For P(X<=x), there is no need to sum up 0 … x-1 again.

1 Like

@andre.pfeuffer Thank you for your answer.
When I take the log of the function it always return -inf. I changed the log and the exp functions to log1p and expm1 but still i am receiving -inf. Do you have any clue?
Thanks for your help!

should be:
return fcop(tau,exp(-exp(la1)), exp(-exp(la2)));

and la1, la2 is at exp scale. Sorry for the bug.

I am implementing the copula with binomial marginals, but I should do the same I guess. (Bin_cdf(X=0,N,p)= (1-p)^N)

You might think of working on log-scale, but I guess that the binomial distribution is more stable
than the poisson distribution. Just make sure that all sums up to 1. Another problem was to figure
out which is the best copula. There are so many. Also the rotated options.

1 Like

Thanks for your help @andre.pfeuffer! Everything runs smoothly now.
Just to let you know that it is unstable without taking the log. So working on log scale is essential for the binomial distr as well.

Hi Ben,

Your method is great. How can I cite this?

I’m not really sure which method you are referring to, but it is surely unpublished and only marginally original. Most all of what I have said over the past however many years about doing things like this is just a Stan variant of


which you could cite.

1 Like

Thanks Ben.

And I have one question: from the GHK algorithm, it is like y_i* from the truncted normal distribution is simulated just from k uniformly distributed u_k’s. But in your manuscript you sample u_k with some kernel derived from Jacobian, that way the vector (u_1, …, u_k) are not Uniform(0,1)^k. Shouldn’t we just use 1 as kernel to sample (u_1, …, u_k) and get y_i^* by the transform given in GHK algorithm? And I was thinking the jacobian term and the cdf of v should cancel and gives you the cdf of u being 1. Hope you can help me out with my confision. Thanks!

Hi,

I am trying to make a negative binomial version of the script made by @Ben_Lambert. I have essentially swapped the marginal poisson (which, in my case, seems be not working) for the negative binomial marginal with the attempt of making it work. Unfortunately it doesn’t since cdfs go to 1. Could anyone help me with this??

Thanks

I don’t think I can help with that script, but you might find something helpful in this brms issue.