00:01
The game described in this exercise is basically one where we have a random number of chips which is defined by this probability distribution.
00:09
And each of the chips has a random number amount of winnings, which is defined by this probability distribution.
00:21
So the total winnings is a function of both the number of chips and the amount one by each chip.
00:27
So in this question we are asked to create a program that simulates the total winnings when this game is played.
00:34
So i have produced a program in our code.
00:46
So first i would just point out that we have two probability distributions, so there's that one, which corresponds to the number of chips, and there's this one, which is the amount one by each chip.
01:01
And then for each simulated game, we first draw a random number of chips, which is drawn from this distribution, and then we use this number to determine the sample size that we draw from our winnings.
01:19
So if we happen to end up with 10 chips randomly, then we would draw 10 values from this probability distribution to represent the amount that is won by those 10 chips.
01:34
And so this will provide us with a vector that contains the winnings for each of the chips.
01:39
And then to find the total winnings for that game, we just sum the winnings from each chip.
01:44
And we store the total winnings for the jth simulation in a vector called winnings, which we begin the program by setting to null.
01:55
So what we end up with is a vector called winnings, that is 10 ,000 in size, and each entry corresponds to the winnings of a simulated game.
02:09
In part a, we were asked what the probability is that somebody playing the game will win more than $11 ,000.
02:19
So in r we can simply type, and this will provide us with that probability.
02:41
Running this in r, i get 0 .3031.
02:48
And for b, we are looking for the expected winnings.
02:53
So the r code for that is simply the mean of the winnings.
03:06
And in my simulation, i got $8 ,831 .131...