Message Boards Message Boards

Generating negative binomial counts using a Poisson mixture of Gamma distributions

Posted 19 days ago

Hello!

I'm trying to simulate counts of (pseudo-) species with different characteristics (rare, medium, abundant). From this point of view, it is quite natural to use Gamma-Poissson mixtures, with convenient parameters for the Gamma distributions. It works very well for generating a SINGLE sample of each king of species, but my code completely fails in simulating several species :

Sampled median values of \[Gamma] : {0.000231012,0.000198812,0.000166503,0.000251062,0.000187207,0.000241421,0.000192554,0.000186855,0.000168828,0.000209722,0.000183093,4.94303,0.490392,0.490566,0.00018395,4.96136,0.000237141,0.488084,0.493871,0.00020586,4.95461,0.493009,4.92685,0.495393,0.000231126,4.93443,0.493136,0.496181,0.492077,0.491182}

Sampled median counts of species : {0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,0,0,0,0,5,0,5,0,0,5,0,0,0,0}

Theoretical median counts of species : {2,2,2,2,2,2,2,2,2,2,2,49967,4967,4967,2,49967,2,4967,4967,2,49967,4967,49967,4967,2,49967,4967,4967,4967,4967}

Here, theoretical median counts are of course right, sample median values of Gamma are correct, but sample median counts obtained from random values of Gamma are completely wrong! There is certainly a mistake somewhere in my code, but I'm not able to find it... Could somebody help?

Attachments:
POSTED BY: Claude Mante
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract