Hi all! I'm trying to solve the following problem. The number of successes in a sequence of N yes/no experiments (i.e., N Bernoulli trials), each of which yields success with probability p, is given by the well-known binomial distribution. This is true if the success probability p is constant and the same for all the N trials. However, when the probability of success, p, is different for each trial, p_1, p_2, ..., p_N, then the number of successes does not follow a binomial distribution, but a Poisson's binomial distribution instead: wikipedia--> /Poisson_binomial_distribution I understand that the Poisson's binomial distribution is valid for any set of probabilities p_1, p_2, ..., p_N. In my problem, I know that the probabilities p_1, p_2, ..., p_N follow a beta distribution. I found out that, in such a case, the resulting PMF of the number of successes in N trials is given by the beta-binomial distribution: wikipedia --> /Beta-binomial_distribution However, I have been playing a bit with some simulation and it seems that this distribution does not fit the resulting PMF. I'm attaching a Matlab file that makes some simulation and generates the PMFs. What am I doing wrong? Is it possible to exploit the knowledge that the p_1, p_2, ..., p_N follow a beta distribution to simply the general Poison's binomial case? What is the PMF that I need? Many thanks in advance! Fryderyk C.