Homework 6 in STAT400: Computational Statistics @ CSU
Be sure to set.seed(400)
at the beginning of your homework.
Continue Problem 2 from Homework 4 and Problem 2 from Homework 5 (the Rayleigh distribution). Goal: you will use the code that you created last week for Problem 2. to learn more about evaluating estimators. Here we are going to evaluate the median of the Rayleigh distribution.
Generate a random sample of size \(1000\) from a normal location mixture. The components of the mixture have \(N(0, 1)\) and \(N(3, 1)\) distributions with mixing probabilities \(p_1\) and \(p_2 = 1 - p_1\). Graph the histogram of the sample with density superimposed for \(p_1 = 0.1, \dots, 0.9\) and observe whether the mixture appears to be bimodal. Make a conjecture about the values of \(p_1\) that produce bimodal mixtures.
Develop two Monte Carlo integration approaches to estimate \(\int\limits_0^5 x^2 \exp(-x) dx\). (You must use different distributions in the two approaches). Check your answer using the integrate()
function.
Estimating the cdf of a normal distribution. Use \(m = 1000\).
R
function pnorm()
for \(x = 0.5, 1, 2, 3\). Summarise your findings comparing the performance of the methods.Turn in in a pdf of your homework to canvas. Your .Rmd file on rstudio.cloud will also be used in grading, so be sure they are identical and reproducible.