I try to visualize a bernoulli chain. With variables p q and s.
pprobability for successqprobability for failureslength of the chain
For fixed p q and s the chain is easiliy calcultated. However s in my case is determined by a roll of n dice which each have d sides:
n= number of dice rolledd= number of sided of the dice (3, 4, 6, 8, 10, 12, 20)
So lets take this example:
p = 0.25q = 0.75n = 10d = 3
So s can be anywhere from 10 to 30. I want to cacluclate a probability vecotor with
[No success, exactly 1 success, exactly 2 Successes..., exactly 30 successes]
I think I have to calculate the probability of each possible s, multiplie it with the actual bernoulli formula. And add the probabilities for i.e. 5 successes from each possible outcome of s. Is this correct?
I really struggle to get the probabilities of each sum. I get it for 2 or 3 dice I could just go through all possible results and well add it but for 20 dice it breaks my computer ;)
There is a stars and bars approach...
Lets start with an example:
Suppose you roll 5 six-sided dice and you want to now the probability that they sum to 20.
You can visualize this as 20 pips getting divided into 5 bins, with no more than 6 pips going into any one bin, and every bin receiving at least one pip.
20 pips over 5 bins is with every bin getting at least 1 is ${20-1 \choose 5-1}$
Now we need to excluding the possibilities that there are more than 6 allocated to any 1 bin.
$-{5\choose 1}{13 \choose 4}$
We have over-corrected, and must count the cases with more than 6 going to 2 bins.
$+{5\choose 2}{7 \choose 4}$
${19 \choose 4} -{5\choose 1}{13 \choose 4} + {5\choose 2}{7 \choose 4} = 651$
and there are $6^5$ ways to roll $5$ six sided dice.
$\frac {651}{6^5}$
How to generalize this...
How many ways to roll $m, n$-sided dice, with sum equal to $y.$
Let $k = \lfloor \frac {y-m}n \rfloor$
$\sum_\limits{i=0}^{k} (-1)^i{m\choose i}{y-1 - in\choose m-1}$