Write a program in (mathrm{R}) that simulates a sequence of independent random variables (X_{1}, ldots, X_{100}) where
Question:
Write a program in \(\mathrm{R}\) that simulates a sequence of independent random variables \(X_{1}, \ldots, X_{100}\) where \(X_{n}\) is a \(\mathrm{N}\left(\mu_{n}, \sigma_{n}^{2}ight)\) random variable where the sequences \(\left\{\mu_{n}ight\}_{n=1}^{\infty}\) and \(\left\{\sigma_{n}ight\}_{n=1}^{\infty}\) are specified below. Repeat the experiment five times and plot each sequence \(X_{n}\) against \(n\) on the same set of axes. Describe the behavior observed for the sequence in each case, and relate the behavior to the results of Exercise 18.
a. \(\mu_{n}=n\) and \(\sigma_{n}=n^{-1}\) for all \(n \in \mathbb{N}\).
b. \(\mu_{n}=n^{-1}\) and \(\sigma_{n}=n\) for all \(n \in \mathbb{N}\).
c. \(\mu_{n}=n^{-1}\) and \(\sigma_{n}=n^{-1}\) for all \(n \in \mathbb{N}\).
d. \(\mu_{n}=n\) and \(\sigma_{n}=n\) for all \(n \in \mathbb{N}\).
e. \(\mu_{n}=(-1)^{n}\) and \(\sigma_{n}=10+(-1)^{n}\) for all \(n \in \mathbb{N}\).
f. \(\left\{\mu_{n}ight\}_{n=1}^{\infty}\) is a sequence of independent random variables where \(\mu_{n}\) has a \(\mathrm{N}(0,1)\) distribution for each \(n \in \mathbb{N}\), and \(\left\{\sigma_{n}ight\}_{n=1}^{\infty}\) is a sequence of random variables where \(\sigma_{n}\) has an \(\operatorname{Exponential}(\theta)\) distribution for each \(n \in \mathbb{N}\).
Step by Step Answer: