# Probability mass function of poisson binomial distribution

I'm trying to write a program that calculates the PMF of a Poisson Binomial Distribution. I know there are libraries that have all sort of probability distribution functions, but I'm doing this just for the learning.

I've experience programming but the part I need help with is the math symbols in this equation:

Here I understand sigma it's the summation symbol, and uppercase pi (Π) is the product operator in mathematics. But I'm used to see numbers below and above those symbols that indicate the range of the summation or product.

But in the formula from Wikipedia I don't understand what is the range of the summation or product.

1. $i \in A$: $A$ is a particular collection of indices for which the event occurred,. For example, if we have five trials, the "event" occurred on three of them, and the first, fourth, and fifth trials were the ones on which the three events occurred, $A = \{1, 4, 5\}$. We multiply the associated probabilities $p_i$ together. $i$ refers to the individual indices within $A$.

2. $j \in A^c$: $A^c$ is the complement of $A$, i.e., the collection of indices for which the event did not occur, e.g., to continue the previous example, if we have five trials and $A = \{1,4,5\}$, $A^c = \{2, 3\}$. We multiply the associated probabilities of the event not occurring $(1-p_j)$ together. $j$ refers to the individual indices within $A^c$.

3. $A \in F_k$. If $K=k$, that means $k$ events occurred. However, which $k$ is unknown, so you have to sum over all possible arrangements of the $k$ events occurring in the $n$ total trials. $F_k$ refers to all possible arrangements of indices for which $k$ events (out of $n$ trials) occurred.

The number of indices in $A$ and the number of indices in $A^c$ must add up to the total number of trials $n$.

For example, say $n=3$ and $k=2$:

$$F_k = \{(1,2), (1,3), (2,3)\}$$

as these are all the ways two out of the three trials can have events - the first and second, the first and third, or the second and third.

$$A \in F_k: A = (1,2) \text{ or } A = (1,3) \text{ or } A = (2,3)$$

$$i \in A: \text{ if }A = (1,2), \text{ then } i \text{ iterates over } (1,2)$$

$$j \in A^c: \text{ if }A = (1,2), \text{ then } A^c = 3, \text{ so } j = \text{ only }3$$

The outer sum iterates over the (three in this case) elements of $F_k$. The $i$ loop iterates over the elements of whichever $A$ the outer sum is at at the moment, and the $j$ loop iterates over the elements of $A^c$, which are defined as whatever isn't in $A$.

• can you add a solution and steps to a simple problem as an example? Mar 18 '18 at 14:59
• What's your sticking point? Mar 18 '18 at 15:42
• "A is a particular collection of indices for which the event occurred" this is what I don't understand, if the events hasn't happened yet, we are calculating the probability of the event happening where those indexes come from? Also I don't understand what is the complement of A (Ac). Let's say we have 5 events with probabilities {0.4, 0.35, 0.15, 0.9, 0.5} and we wanna know the probability of 3 successes out of those 5 events. What is A, Ac and what are the steps towards is the result? Mar 19 '18 at 22:27
• Have you read the "For example" part of my answer? It basically outlines the case where you are calculating the probability of 2 successes out of 3 trials. Mar 19 '18 at 23:24
• nvm that last comment, I already found the answers to my questions. Thanks for the help Mar 19 '18 at 23:38