$29
For this lab, we will run some simulations of rolling dice and tossing coins using the statistical software program R. Your solutions should contain clearly identified numerical answers and well labeled tables/figures, where appropriate. Make sure to include clear and concise interpretations of any values, figures, and responses to queries posed. Place all code in an appendix, at the end of your solutions document.
1. Suppose we run an experiment to estimate the probability of obtaining a heads when flipping a coin based on an n number of flips.
a) Run this simulation for 10, 100, 500, and 100 flips
b) For each simulation in a), calculate the estimated proportion of heads that you obtained from n flips.
c) Plot the cumulative proportion of heads versus number of coin toss for the simulation of 1,000 flips. Describe what you notice about the proportion of heads as the number of flips increase.
2. In a game of craps, snake eyes is the event of rolling two 1’s from a pair of dice.
a) Calculate by hand the theoretical (true) probability of rolling a sum of 6 P(snake eyes) = !" × !" = %"! = 0.0278
b) Use R and simulate 1,000 rolls of a pair of dice. From these rolls, estimate the proportion of pairs that were snake eyes
c) Compare the true probability from a) within your empirical probability from b)