There is a difference in my computed expected number of throws by hand and by simulation. The difference is about 1/4, but my question is, which one is wrong?
Clarification of the rules of this game: We have $6$-sided dice, with colours Red, Green, Blue, Cyan, Magenta and Yellow. Based on the throw and the eligible paths you move a pawn. The starting state in the game is position $0$. When throwing the right colour you can move your pawn to the next state, otherwise the pawn remains in the same position. The eligible paths are (with the numbers denoting the column):
- 0 -> 1R, 1B
- 1B -> 2C, 2G, 2Y
- 1R -> 2G, 2M, 2Y
- 2C -> 3B, 3M
- 2G -> 3B, 3R
- 2M -> 3R
- 2Y -> 3B, 3M
- 3B -> 4C, 4G, 4M, 4Y
- 3R -> 4M, 4R, 4Y
- 3M -> 4B, 4C, 4G, 4Y
My interest: $E(X_i)$, with $X_i$ the number of throws to get in column $i$. $E(X_0) = 0$, since it is the begin state.
My computation by hand: Let $Z_j$ the number of throws to get in one of the eligible next states from state $j$, $$ \begin{align*} E(X_1) &= 3 + E(Z_{0}), \text{since the propability of throwing one of those is 2/6.}\\ E(X_2) &= (E(Z_{1R}) + E(Z_{1B})/2 + E(X_1) = 2 + 3, \text{assuming independence between throws.}\\ E(X_3) &= (E(Z_{2C}) + E(Z_{2G}) + E(Z_{2M}) + E(Z_{2Y}))/4 + E(X_2) = (3 + 3 + 6 + 3)/4 + 5\\ E(X_4) &= ... = 1\frac{2}{3} + 8\frac{3}{4} = 10\frac{5}{12} \end{align*} $$
The difference starts occurring at $E(X_3)$ in my simulation I get about $8.5$ a difference of about $0.25$, but when I compute $E(X_4)$ the difference is still about the same. So I feel like the manual computation of the expected number of throws is wrong, what do you think?
The flaw in the equation $$ E(X_3) = (E(Z_{2C}) + E(Z_{2G}) + E(Z_{2M}) + E(Z_{2Y}))/4 + E(X_2) = (3 + 3 + 6 + 3)/4 + 5 $$ is the following.
On average, after $E(X_2)$ throws, you will end up in the second column. However, you are not equally likely to end up in any state in the second column. States 2G and 2Y have both 1R and 1B as predecessors; states 2C and 2M only have one of those states as predecessors. So you're twice as likely to end up in 2G or 2Y, and your computation should be $$ E(X_3) = \frac{E(Z_{2C}) + 2 E(Z_{2G}) + E(Z_{2M}) + 2 E(Z_{2Y})}{1 + 2 + 1 + 2} + E(X_2) = \frac{3 + 2 \cdot 3 + 6 + 2 \cdot 3}{6} + 5 $$ which evaluates to $8.5$, as intended.
In general, you should weight the states in each column proportionally to the total number of paths from state 0 to that state.