- #1

Lancelot1

- 28

- 0

I solved this one analytically and with Monte Carlo simulation and got different results, I wonder where my mistake it.

The Solution:

The probability of success in a single game is:

\[p=\frac{\binom{2}{2}\binom{3}{0}+\binom{2}{0}\binom{3}{2}}{\binom{5}{2}}=0.6\]

If we define X to be the number of successes, then

\[X:Bin(17,0.6)\]

Therefore:

\[E(X)=10.2, V(X)=4.08\]

The profit is a linear transformation of X:

\[Y=100X-1360\]

And thus:

\[E(Y)=100\cdot 10.2-1360=-340\]

\[V(Y)=10000\cdot 4.08=40800\]My R code is below, and it yields different results , e.g.:

\[E(Y)=-480.38 ... V(Y)=10000\cdot 4.08=42751.21\]

**where is the mistake ?**

n = 5000

successes = rep(0,n)

for (j in 1:n)

{

result = rep(0,17)

for (i in 1:17)

{

game.result = sample(1:5,2,replace = T)

if (sum(game.result)%%2==0)

{

result

*= 1*

}

}

successes[j] = sum(result)

}

successes

mean(successes)

var(successes)

profit = 100*successes-1360

mean(profit)

var(profit)

}

}

successes[j] = sum(result)

}

successes

mean(successes)

var(successes)

profit = 100*successes-1360

mean(profit)

var(profit)