--- title: "R Problem due Tuesday 9/18" author: "YOUR NAME" output: pdf_document --- Acknowledgements: ADD NAMES HERE IF ANYONE ASSISTED YOU. **Email knitted pdf file to tleise@amherst.edu by 4pm on the due date.** Read Problem 2.28. Then answer the problem by completing the parts below. Here is the code provided in the problem to simulate birthdays from a group of 23 people, outputting a frequency table of how many people share each birthday (with days of the year numbered 1 to 365). ```{r} bday.table <- table(sample(1:365,23,replace=TRUE)) bday.table ``` We want to know whether or not at least two people shared a birthday in the simulated data, so we ask whether any numbers greater than 1 occur in the table. The code suggested in the problem statement only checks whether exactly 2 share a birthday. We'd like to allow 2 or more to share a birthday, so we'll use "any" rather than "%in%" for this problem. ```{r} any(bday.table>1) ``` a. Estimate the probability that at least two people have the same birthday in a room of 23 people through 10000 simulations like the one above. Feel free to check your answer by calculating the theoretical formula in R. ```{r} set.seed(6) ``` > ANSWER b. Use simulations like what you did in part a to estimate the number of people needed so that the probability of a match is greater than 95%. You should check using multiple seeds, as the estimate will vary a bit from simulation to simulation, or else verify your answer by computing the formula. ```{r} ``` > ANSWER c. Use similar simulations to estimate the probability that at least three people share the same birthday in a room of 50 people. ```{r} ``` > ANSWER d. Estimate the number of people needed so that the probability of having three people or more with the same birthday is at least 95%. Check your answer using multiple runs of the simulation, as the estimated probability will vary a bit. ```{r} ``` > ANSWER