Question:1You are playing a game where a fair die is rolled first and then a fair coin is tossed a number oftimes equal to the face of the die (e.g. if the die shows three, the coin is tossed three times, and thiscombination is considered as one game).a)Let X be the number of heads(H) you can get in any game.• Write down the probability mass function of X. (this part is not a simulation question. CalculateALL the probabilities and produce a table that represents the pmf)• Calculate E[X] using your pmf.b)Write an R code that will simulate this game 100,000 times.• save the outputs from your simulation(no need to print the outputs).• Use these outputs to calculate an estimate of E[X].c) Suppose you are told that if the number on the die is odd you get a dollar value equivalentto the corresponding X value(e.g. the die shows three, the coin is tossed three times, if there are twoheads you get $2).But if the number on the die is even, you have to pay a dollar value equivalent to X. • Calculate an estimate of your expected gain from each game (You can use numeric calculationsV as you have done in part(a) or you can use your simulation from part(b) to answer this question).
Read less