Assignment 6 part D

Assignment 6 part D

by Sarah Shawky -
Number of replies: 3

Hello,

I am having some trouble with part d and figuring out how to incorporate the "m" value into the apply function. From my understanding, we are essentially repeating the sampling and identifying triplicate birthdays 25 times and counting how many times we see "TRUE" out of those 25. I can picture how this can be done via for loop, but could someone please provide any hints as to how to incorporate the 25 times into the apply function? 

Thank you so much in advance! 

In reply to Sarah Shawky

Re: Assignment 6 part D

by Erik Spence -
The answer to this question is at the bottom of 1e).
In reply to Erik Spence

Re: Assignment 6 part D

by Sarah Shawky -
Sorry I think I'm not fully understanding, I'm not sure how m can be entered as the number of repetitions into the sapply function. Aren't we applying the check.n.birthdays function to a sample which would only take n as an argument? Thank you.
In reply to Sarah Shawky

Re: Assignment 6 part D

by Erik Spence -
Sorry, my mistake. I was thinking of part e.

Yes, you are correct, check.n.birthdays only takes n as an argument. You want to repeat the this calculation m times, so you'll need to pass sapply an input vector that will cause sapply to do this.