# Given likelihood of gamma (external approximation convoluted gamma) calculate likelihood of NB

I found a function that approximates efficiently the density of a convoluted gamma

``````gamma(a1, b1) + gamma(a2, b2) + ...
``````
``````.Call(
"_coga_dcoga_approx",
PACKAGE = "coga",
1.5,
c(1, 3, 5, 2, 2),
c(3, 5, 3, 5, 3)
)
 0.003897655
``````

Now is it possible to algebrically calulate the likelihood of a negative binomial from that?

I guess the explicit formulation would be

``````y ~ poisson(mu)
mu ~ R_convoluted_gamma(alpha1, alpha2, alpha3, beta1, beta2, beta3);
``````

But I would like to avoid the creation of an intermediate parameter mu.

2 Likes

The sum of independend gamma distributions leads to a nested integral expression, but maybe the approximiation https://projecteuclid.org/download/pdfview_1/euclid.ejs/1403812157 can bring you closer.

1 Like

I played a little bit with the difference of gamma distributions.

The saddle approximation has an analytical solution for the convolution of two gammas.

2 Likes