Let X Binomial(n, p). In this question well simulate data from X where the true value

Question:

Let X ∼ Binomial(n, p). In this question we’ll simulate data from X where the true value of p is known. Suppose p = 0.8.

a. Let pbbe the maximum likelihood estimator of p when the sample size is n. Write down an expression for pbin terms of X and n.

b. Specify R commands to draw one million samples of pb when n = 20, n = 100, and n = 500. Save your three simulations of pbin R vectors called respectively phat20, phat100, and phat500.

c. Plot standardised histograms in R of your three sets of simulated pbresults. Keep the same plotting range for each histogram by specifying xlim=c(0,1). For example, you can plot your simulated results for phat20 using hist(phat20,prob=T,xlim=c(0,1),main="n=20")

The command main="n=20" adds the appropriate title to the plot.

d. What do you notice about the distribution of pbas the sample size increases? Can you explain this?

Step by Step Answer:

Related Book For  book-img-for-question

Mathematics And Statistics For Science

ISBN: 9783031053177

1st Edition

Authors: James Sneyd, Rachel M. Fewster, Duncan McGillivray

Question Posted: