In: Math
Playing Roulette In the game of roulette, a wheel consists of 38 slots numbered 0, 00, 1, 2, . . . , 36. To play the game, a ball is spun around the wheel and is allowed to fall into on of the numbered slots. If the number of the slot the ball falls into matches the number you select, you win $35; otherwise you lose $1.
1. Construct a probability distribution for the random variable X, the winnings of each spin.
2. Determine the mean and standard deviation of the random variable X.
3. Suppose that you play the game 100 times, simulate at least 5 possible outcomes. Describe the pattern.
4. Imagine a person who plays the game 1000 times a day, for 365 days. Simulate such a scenario. What is the frequency distribution of that person’s winnings and losings?
5. Suppose that you play the game 1000 times. Describe the sampling distribution of the mean amount won per game.
6. What is the probability of being ahead after playing the game 100 times?
7. What is the probability of being ahead after playing the game 200 times?
8. What is the probability of being ahead after playing the game 1000 times?
9. Based on your investigation, what lesson does this teach you? Write an essay to inform your gambler friend.
Hint: To find the mean and standard deviation:
x <- c(35, -1) p <- c(1/38, 37/38) (mu.X <- sum(x*p))
## [1] -0.05263158
(sigma.X <- sqrt(sum((x - mu.X)^2*p)))
## [1] 5.762617
We simulate two possible outcomes if a person plays the game 100 times.
sample(x, 100, replace = TRUE, p)
## [1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ## [24] -1 -1 -1 -1 35 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ## [47] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ## [70] -1 35 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 -1 -1 ## [93] -1 -1 -1 -1 -1 -1 -1 -1
sample(x, 100, replace = TRUE, p)
## [1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ## [24] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 -1 -1 -1 -1 -1 -1 -1 -1 ## [47] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ## [70] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ## [93] -1 -1 -1 -1 -1 -1 -1 -1
Repeat this simulation many times and describe the pattern.
Imagine a person who plays the game n=100n=100 times a day, for 365 days. We examine the sum:
day <- 365 daily.sum <- replicate(day, sum(sample(x, 100, replace = TRUE, p))) (tb <- table(daily.sum))
## daily.sum ## -100 -64 -28 8 44 80 116 152 188 ## 27 63 78 84 62 33 14 2 2
plot(tb)
As the number of games nn increase, the sums follow a normal distribution N(nμ,nσ2)N(nμ,nσ2). With n=1000n=1000 and class width 36,
day <- 365 daily.sum <- replicate(day, sum(sample(x, 1000, replace = TRUE, p))) (tb <- table(daily.sum))
## daily.sum ## -568 -532 -460 -424 -388 -352 -316 -280 -244 -208 -172 -136 -100 -64 -28 ## 1 1 4 4 4 12 16 16 23 17 27 26 26 24 25 ## 8 44 80 116 152 188 224 260 296 332 368 440 ## 32 19 26 16 12 11 5 4 7 3 1 3
plot(tb/day/36) curve(dnorm(x, 1000*mu.X, sqrt(1000)*sigma.X), add = TRUE)
The distribution of sample means has a standard deviation of σ/n−−√σ/n:
daily.mean <- daily.sum/1000 hist(daily.mean, probability = TRUE, xlim = c(-2, 2), ylim = c(0, 2.5)) curve(dnorm(x, mu.X, sigma.X/sqrt(1000)), xlim = c(-2, 2), add = TRUE)
Play 100 times. What is the probability of being ahead?
n1 <- 100 curve(dnorm(x, mu.X, sigma.X/sqrt(n1)), xlim = c(-2, 2), ylim = c(0, 2.5), main = "n=100", ylab = "pdf") abline(v = mu.X) coord.x <- c(0, seq(0, 2, 0.01), 2) coord.y <- c(0, dnorm(seq(0, 2, 0.01), mu.X, sigma.X/sqrt(n1)), 0) polygon(coord.x, coord.y, density = 10)
1 - pnorm(0, mu.X, sigma.X/sqrt(n1))
## [1] 0.4636141
Play 200 times:
n2 <- 200 curve(dnorm(x, mu.X, sigma.X/sqrt(n2)), xlim = c(-2, 2), ylim = c(0, 2.5), main = "n=200", ylab = "pdf") abline(v = mu.X) coord.x <- c(0, seq(0, 2, 0.01), 2) coord.y <- c(0, dnorm(seq(0, 2, 0.01), mu.X, sigma.X/sqrt(n2)), 0) polygon(coord.x, coord.y, density = 10)
1 - pnorm(0, mu.X, sigma.X/sqrt(n2))
## [1] 0.4486139
Play 1000 times:
n3 <- 1000 curve(dnorm(x, mu.X, sigma.X/sqrt(n3)), xlim = c(-2, 2), ylim = c(0, 2.5), main = "n=1000", ylab = "pdf") abline(v = mu.X) coord.x <- c(0, seq(0, 2, 0.01), 2) coord.y <- c(0, dnorm(seq(0, 2, 0.01), mu.X, sigma.X/sqrt(n3)), 0) polygon(coord.x, coord.y, density = 10)
1 - pnorm(0, mu.X, sigma.X/sqrt(n3))
## [1] 0.3863597
We see the probability of win is
and loss is
.
a) The probability distribution for the random
variable
, the winnings of each spin is
b) The mean of RV
is
Standard deviation is
c) The game is simulated 100 times below.
[1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 -1
-1 35 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[37] 35 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[73] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1
35 occurred only thrice. The win in this game is very rare.
d) The replications of 100 games on 365 days are plotted below. (Histogram).
e) The replications of 1000 games on 365 days are plotted below overlayed by the approximating normal distribution.
According to CLT, the approximating normal PDF is
We are required to solve only 4 parts. Please post the remaining questions as another post.