Write a program in (mathrm{R}) that generates a sample from a population with distribution function [F(x)= begin{cases}0

Question:

Write a program in \(\mathrm{R}\) that generates a sample from a population with distribution function

\[F(x)= \begin{cases}0 & x<-1 \\ 1+x & -1 \leq x<-\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} \leq x<\frac{1}{2} \\ 1-x & \frac{1}{2} \leq x<1 \\ 1 & x \geq 1\end{cases}\]

This distribution is UnIForm on the set \(\left[-1,-\frac{1}{2}ight] \cup\left[\frac{1}{2}, 1ight]\). Use this program to generate samples of size \(n=5,10,25,50,100,500\), and 1000 . For each sample compute the sample median \(\hat{\xi}_{0.5}\). Repeat this process five times and plot the results on a single set of axes. What effect does the flat area of the distribution have on the convergence of the sample median? For comparison, repeat the entire experiment but compute \(\hat{\xi}_{0.75}\) instead.

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: