Question: Write a function that uses Monte Carlo to approximate the distribution of the sample proportion of Heads from n coin tosses of a coin (which

 Write a function that uses Monte Carlo to approximate the distribution

Write a function that uses Monte Carlo to approximate the distribution of the sample proportion of Heads from n coin tosses of a coin (which may or may not be a fair coin). The function should take as input the sample size n, the probability of heads p, the number of replicates (repetitions of the experiment) B and a boolean plotHist that if TRUE prints a histogram of the samples and if not, does not. If the user does not input a value for B, default to the one we often use in class, that is, set B = 10,000. The output of the function should be the mean and standard deviation of the distribution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!