In: Statistics and Probability
What is the code in Rstudio or R?
(a) Generate 200 random samples of size n = 10 from a Poisson distribution with mean λ = 12.
i. Calculate sample means for each sample. Report the first 10 sample means.
ii. Draw a histogram of the sample means (where the y-axis is the density) and fit a density estimate (default density estimator is ok).
iii. What is your finding about the sampling distribution of the sample mean, based on your histogram. Be sure to give the distribution name along with its parameter estimates.
(b) Generate 200 random samples of size n = 50 from a Poisson distribution with mean λ = 12.
i. What distribution is the new set of sample means? State the exact distribution expected from theory (including parameter values), and state the distribution obtained from your samples (including estimated parameter values).
ii. Based on this distribution, construct a 95% confidence interval for the mean λ. Assume σ is known.
(c) Generate 200 random samples of size n = 20 from a Chi-Square distribution with degrees of freedom df = 6.
i. Find the first quantile Q1 from each sample (note: qchisq() gives the quantile from the exact distribution, NOT the sample). Report the first 10 quantiles.
ii. Draw a histogram of the sample Q1’s (where the y-axis is the density) and fit a density estimate (default density estimator is ok).
(d) Generate 200 random samples of size n = 100 from a Chi-Square distribution with degrees of freedom df = 6.
i. Draw a histogram of the sample first quantiles (where the y-axis is the density) and fit a density estimate (default density estimator is ok).
ii. Are there any differences between the distribution from Problem 2(a)ii and 2(b)i? Describe any differences you may see.