Question

In: Statistics and Probability

Task 1: Roulette wheel simulation A roulette wheel has 38 slots of which 18 are red,...

Task 1: Roulette wheel simulation

A roulette wheel has 38 slots of which 18 are red, 18 are black, and 2 are green. If a ball spun on to the wheel stops on the color a player bets, the player wins. Consider a player betting on red. Winning streaks follow a Geometric(p = 20/38) distribution in which we look for the number of red spins in a row until the first black or green. Use the derivation of the Geometric distribution from the Bernoulli distribution to simulate the game. Namely, generate Bernoulli(p = 20/38) random variates (0 = red; 1 = black or green) until a black or green occurs.

Code set-up

A while loop allows us to count the number of spins until a loss. If we use indicator variable lose to note a win (1) or loss (0), the syntax is “while we have not lost (i.e., lose==0), keep spinning.” Once you win, the while loop ends and the variable streak has counted the number of spins. Try running a few times.

streak = 0
lose = 0
p = 20/38
while(lose==0){
lose = (runif(1) < p) # generate Bernoulli with probability p
streak = streak + 1 # tally streak
}
streak

## [1] 2

The problem

The code chunk above performs the experiment once: spin the roulette wheel until you lose and record the number of spins. Simulate 1000 experiments. As usual, do this by wrapping the code chunk above within a for-loop and storing the number of spins streak in a vector.

# [Place code here]

Report the following:

  • Histogram of the win streak length. Note that this is a discrete distribution so should place histogram bars at discrete values {0, 1, 2, …}. This may be done with the breaks option within hist. If your storage variable is called winstreak:

hist(winstreak, br=seq(min(winstreak)-0.5, max(winstreak+0.5)), main="")

  • Average length of the win streak. [Answer here]
  • Standard deviation of the winning streak lengths. [Answer here]
  • Compare the empirical average and standard deviation in the previous two bullets to the true values from the Geometric(p = 20/38) distribution.

[Answer here]

  • Longest winning streak. [Answer here]

Solutions

Expert Solution

Let X be the random variable indicating the win streak length. We know that X has a Geometric distribution with parameter, probability of success (the probability of a black or green spin) p=20/38

The expected value if X is

The standard deviation of X is

These are the theoretical average and standard deviation of win streak length

R code already given for task 1

-----

#set the random seed
set.seed(123)

streak = 0
lose = 0
p = 20/38
while(lose==0){
lose = (runif(1) < p) # generate Bernoulli with probability p
streak = streak + 1 # tally streak
}
streak
----

get this

This means we won 0 times betting on red, before we lost.

Note: This will not be same as "## [1] 2" a streak length of 2 given in the question as each run of the simulation gives different result, unless we set same the random seed

The problem

R code with comments

--

#set the random seed
set.seed(123)

#set the number of experiments
n<-1000
#initialize streak
winstreak<- numeric(n)

for (i in 1:n){
   streak = 0
   lose = 0
   p = 20/38
   while(lose==0){
       lose = (runif(1) < p) # generate Bernoulli with probability p
       streak = streak + 1 # tally streak
   }
   winstreak[i]<-streak
}
#Histogram of the win streak length.
hist(winstreak, br=seq(min(winstreak)-0.5, max(winstreak+0.5)), main="Histogram of the win streak length",xlab="win streak length")
#Average length of the win streak.
sprintf('Average length of the win streak is %.4f',mean(winstreak))
#Standard deviation of the winning streak lengths.
sprintf('Standard deviation of the win streak lengths is %.4f',sd(winstreak))
#Compare the empirical average and standard deviation with
#Geometric(p = 20/38) distribution.
sprintf('Theoretical average length of the win streak is %.4f',1/p)
#Standard deviation of the winning streak lengths.
sprintf('Theoretical Standard deviation of the win streak lengths is %.4f',sqrt((1-p)/p^2))
Longest winning streak.
sprintf('Longest winning streak is %g',max(winstreak))
--

get this

ans:

  • Histogram of the win streak length.

  • Average length of the win streak.  1.9010
  • Standard deviation of the winning streak lengths 1.2903
  • Compare the empirical average and standard deviation in the previous two bullets to the true values from the Geometric(p = 20/38) distribution.

We can see that the true value of Average length of the win streak is 1.90 and the empirical value of 1.9010 is close enough to it.

The true value of Standard deviation of the winning streak lengths is 1.3077 and the empirical value of 1.2903 is close enough to it

  • Longest winning streak is 10

Related Solutions

The roulette wheel has 38 slots. Two of the slots are green, 18 are red, and...
The roulette wheel has 38 slots. Two of the slots are green, 18 are red, and 18 are black. A ball lands at random in one of the slots. A casino offers the following game. Pay $1 to enter the game. If the ball falls on black, you don’t get anything, if the ball falls on green, you get a dollar, if the ball falls on red, you get $1.95. Bob plays this game 100 times, and of course, the...
A roulette wheel has 38 slots, 18 of which are black, 18 red, and 2 green....
A roulette wheel has 38 slots, 18 of which are black, 18 red, and 2 green. When the wheel is spun, the ball is equally likely to land in any of the 38 slots. Gamblers can place a number of different bets in roulette. One of the simplest wagers chooses red or black. A bet of $1 on red will pay off an additional dollar if the ball lands in a red slot. Otherwise, the player loses the original dollar....
The American roulette wheel has 38 total slots of which 18 are colored red, 18 are...
The American roulette wheel has 38 total slots of which 18 are colored red, 18 are colored black, and 2 are colored green. The red and the black slots are numbered 1 through 36. The green slots are numbered 0 and 00. Construct the probability distribution for betting $1 on the second dozen numbers, 13 through 24, (which pays 2 to 1) in the game of roulette and calculate the corresponding mean and standard deviation.
2. (Binomial model) Consider a roulette wheel with 38 slots, of which 18 are red, 18...
2. (Binomial model) Consider a roulette wheel with 38 slots, of which 18 are red, 18 are black, and 2 are green (0 and 00). You spin the wheel 6 times. (a) What is the probability that 2 of those times the ball ends up in a green slot? ( b) What is the probability that 4 of those times the ball ends up in a red slot? 3. (Normal approximation to binomial model) Take the roulette wheel from question...
A roulette wheel has 38 slots: 18 red, 18 black, and 2 green. A ball is...
A roulette wheel has 38 slots: 18 red, 18 black, and 2 green. A ball is tossed into the wheel and eventually settles in a slot at random. You play many games, betting $1 on red each time. If the ball lands in a red slot you win $1, otherwise you lose the dollar you bet. After n games, what is the probability that you have more money than you started with? Give (approximate) numerical answers for n = 100...
The game of roulette involves spinning a wheel with 38 slots: 18 red, 18 black, and...
The game of roulette involves spinning a wheel with 38 slots: 18 red, 18 black, and 2 green. A ball is spun onto the wheel and will eventually land in a slot, where each slot has an equal chance of capturing the ball. (a) You watch a roulette wheel spin 4 consecutive times and the ball lands on a black slot each time. What is the probability that the ball will land on a block slot on the next spin?...
A roulette wheel is divided into 38 labeled pockets, 18 of which are red, 18 are...
A roulette wheel is divided into 38 labeled pockets, 18 of which are red, 18 are black, and 2 are green. Each round, you can place a $1 bet on one specific red or black pocket with odds of 35 : 1. That is, if you are correct you receive $35 in addition to the dollar you bet, and if you are incorrect, you get nothing. Your friend has developed what he describes as a “foolproof system” for winning. It...
A roulette wheel has 38 slots, numbered 0, 00, and 1 to 36. The slots 0...
A roulette wheel has 38 slots, numbered 0, 00, and 1 to 36. The slots 0 and 00 are colored green, 18 of the others are red, and 18 are black.The dealer spins the wheel and at the same time rolls a small ball along the wheel in the opposite direction. The wheel is carefully balanced so that the ball is equally likely to land in any slot when the wheel slows. Gamblers can bet on various combinations of numbers...
In the game of​ roulette, a wheel consists of 38 slots numbered​ 0, 00,​ 1, 2,...,...
In the game of​ roulette, a wheel consists of 38 slots numbered​ 0, 00,​ 1, 2,..., 36. To play the​ game, a metal ball is spun around the wheel and is allowed to fall into one of the numbered slots. If the number of the slot the ball falls into matches the number you​ selected, you win​ $35; otherwise you lose​ $1. Complete parts ​(a) through ​(g) below (a) Construct a probability distribution for the random variable​ X, the winnings...
In the game of roulette, there is a wheel with 37 slots numbered with the integers...
In the game of roulette, there is a wheel with 37 slots numbered with the integers from 0 to 36, inclusive. A player bets $3 and chooses a number. The wheel is spun and a ball rolls on the wheel. If the ball lands in the slot showing the chosen number, the player receives $3 plus 100$. Otherwise, the player loses the $3 bet. Assume that all numbers are equally likely. Determine the variance of the gain or loss per...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT