I have been reading chapter two of the book Statistical Rethinking: A Bayesian Course with Examples in R and Stan and I can't see why for the marble example, successive multiplications will produce the same results as a single number of ways calculation. In the example we are calculating the number of ways to draw with replacement a blue marble followed by a white and then another blue marble (BWB), given there are four marbles in the bag, I can't seem to get the same result if I do calculation in three stages like:
Posterior = (Number of ways / Total number of ways) * Prior
Assuming Prior is 1 at the beginning.
| p | Blue | White | Blue | Product |
|---|---|---|---|---|
| 0.25 | 0.17 (1) | 0.50 (3) | 0.17 (1) | 0.0145 |
| 0.50 | 0.33 (2) | 0.33 (2) | 0.33 (2) | 0.0360 |
| 0.75 | 0.50 (3) | 0.17 (1) | 0.50 (3) | 0.0425 |
Calculate in one go:
| p | BWB |
|---|---|
| 0.25 | 0.15 (3) |
| 0.50 | 0.40 (8) |
| 0.75 | 0.45 (9) |
The normalization should be 1 for every stage?
For the proportion of water example, I also tried to see if the probabilities are calculated individually, the product will be the same as a single calculation. If we had the sequence WWWLL:
| E | Likelihood | Posterior |
|---|---|---|
| W | p | $2p$ |
| WW | p | $3p^2$ |
| WWW | p | $4p^3$ |
| WWWL | 1-p | $20p^3 - 20p^4$ |
| WWWLL | 1-p | $60p^3 - 120p^4 + 60p^5$ |
And this is different if I use the binomial distribution formula directly, the result is:
$\frac{$5!}{2!3!} * p^3 * (1-p)^2 = 10p^3 - 20p^4 + 10p^5$
I can see I get 1/6 after integrating the binomial result from the formula and the reciprocal matches the multiple constant from the results of individual multiplications. And table one is the same as table two to if I do normalization at each step (or in one go in the last step).