Distribution of \(X\) density function \(\mathbb{E}[X]\) \(\mathbb{V}[X]\) parameter bounds
Poisson()$ \(e^{-\lambda}\lambda^x / x!\) \(\lambda\) \(\lambda\) \(\lambda > 0\)
  1. Assume the population distribution of interest is \(\text{Poisson}(\lambda = 7)\).

    1. Generate a random sample of \(N = 314\) observations from the population of interest and store it into a vector named x.

    2. Write in R a function that returns negative one times the simplified log-likelihood for N observations from the population of interest. The function signature should be ll_poisson <- function(l, X).

    3. Use the function optim(...), along with the vector named x that you generated in a., to find the maximum likelihood estimate of \(\lambda\), \(\hat{\lambda}\) by minimizing the function your wrote in part b.. Remember that \(\lambda\) is bounded below by \(0\), such that you should set the lower bound as an argument to optim().

    4. In a for loop of length R = 1001, repeatedly sample with uniform probabilities and with replacement observations from the vector x. For each re-sampled vector, calculate and store your estimate, found in the element name par returned from optim(). Don’t forget to pre-allocate your memory.

    5. Make a density plot of the R sample statistics \(\hat{\lambda}\).

    6. Describe the sampling distribution of the statistic \(\hat{\lambda}\). What approximate shape does it take on? Why? Explain.

    7. Will the width of the sampling distribution get wider or narrower as your sample size increase? If you’re not sure, change N above and repeat a. through e. to find out.

    8. Use the function quantile(), along with the vector of bootstrap re-sampled estimates of \(\hat{\lambda}\), to calculate an 90% confidence interval for population parameter \(\lambda\). Interpret this confidence interval.