# Probability game - Simulation

• MHB
• Lancelot1
In summary: The probability of odd on each pick is 3/5 so the sum of the two numbers would be even with probability 4/25. The probability of even is 2/5 so in order for the sum of the two numbers to be even, both choices must be even which has probability 4/25. The probability of winning in anyone game is 4/25+ 9/25= 13/25. The expected winning in anyone game is (13/25)(100)= $52. You would have to pay$160 to play so your expected loss is $128. Lancelot1 Two numbers are bring chosen by random from the set {1,2,3,4,5}. If the sum of the two numbers is even, you win 100 dollars, otherwise you win nothing. In order to participate in the game, you pay$80. What is the expected value and variance of the profit after 17 games ?

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)

Please clarify- when you "choose two numbers from the set", can you choose the same number twice? That is, is this "sampling with replacement" or "sampling without replacement?

If it is the first, then there are 25 possible outcomes. The probability of odd on each pick is 3/5, the probability of even is 2/5. In order that the sum of the two numbers be even, both choices must be even, which has probability 4/25, or both choice odd which has probability 9/25. The probability of winning in anyone game is 4/25+ 9/25= 13/25. The expected winning in anyone game is (13/25)(100)= $52. You had to pay$80 to pay so you can expect to lose $28 on each game. The other, sampling without replacement, is slightly harder. The probability you draw an even number the first time is still 2/5 but now there are 4 numbers to pick from with only one even. The probability you also draw an even number the second time is 1/4 so the probability you draw two even numbers, and win, is (2/5)(1/4)= 1/10. The probability you draw an odd number the first time is 3/5. Now there are 4 numbers to pick from, 2 odd. The probability you draw an odd number the second time is 2/4= 1/2 so the probability you draw two odd numbers, and win, is (3/5)(1/2)= 3/10. The expected value now is (3/10)(100)=$30. You had to pay $80 to play so your expected loss is$50.the second, 20 possible outcomes. In the f

## 1. What is a probability game simulation?

A probability game simulation is a computer-based simulation that models the outcomes of a game or scenario based on random chance. It allows players to explore different strategies and outcomes without actually playing the game in real life.

## 2. How does a probability game simulation work?

A probability game simulation uses algorithms and random number generators to mimic the randomness of real-life events. It takes into account various factors and probabilities to generate a range of possible outcomes.

## 3. What are the benefits of using a probability game simulation?

Using a probability game simulation allows players to test different strategies and understand the likelihood of certain outcomes without risking real money. It also provides a controlled environment for experimentation and learning.

## 4. Can a probability game simulation accurately predict real-life outcomes?

While a probability game simulation can provide valuable insights and information, it cannot accurately predict real-life outcomes. It is based on random chance and does not take into account all the variables and complexities of real-life situations.

## 5. How can probability game simulations be used in scientific research?

Probability game simulations can be used in scientific research to model and study complex systems and phenomena. They can also be used to test hypotheses and understand the effects of different variables on outcomes.

• Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
4
Views
3K
• Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
5
Views
956
• Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
5
Views
897
• Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K