Write a program in (mathrm{R}) that simulates five samples of size (n) from a distribution (F), where
Question:
Write a program in \(\mathrm{R}\) that simulates five samples of size \(n\) from a distribution \(F\), where \(n\) and \(F\) are specified below. For each sample compute a kernel density estimate of the density \(f=F^{\prime}\) using the plug-in bandwidth estimator supplied by R. Plot the original density, along with the five kernel density estimates on the same set of axes, making the density estimate a different line type than the true density for clarity. Discuss the estimates and how well they are able to capture the characteristics of the true density. What type of characteristics appear to be difficult to estimate? Does there appear to be areas where the kernel density estimator has more bias? Are there areas where the kernel density estimator appears to have a higher variance? Repeat the experiment for \(n=50,100,250\), 500 , and 1000 .
a. \(F\) is a \(\mathrm{N}(\theta, 1)\) distribution.
b. \(F\) is a \(\operatorname{Uniform}(0,1)\) distribution.
c. \(F\) is a \(\operatorname{Cauchy}(0,1)\) distribution.
d. \(F\) is a Triangular \((-1,1,0)\) distribution.
e. \(F\) corresponds to the mixture of a \(\mathrm{N}(0,1)\) distribution with a \(\mathrm{N}(2,1)\) distribution. That is, \(F\) has corresponding density \(\frac{1}{2} \phi(x)+\frac{1}{2} \phi(x-2)\).
Step by Step Answer: