## Problem 8.2 (4 points)

We are given $$E[\hat{\theta}_1] = E[\hat{\theta}_2] = \theta$$, $$V[\hat{\theta}_1]=\sigma_1^2$$, $$V[\hat{\theta}_2]=\sigma_2^2$$, and $$\hat{\theta}_1$$ and $$\hat{\theta}_2$$ are independent.

Let $$\hat{\theta}_3 = a\cdot \hat{\theta}_1 + (1-a)\cdot \hat{\theta}_2$$.
1. Since $$E[\hat{\theta}_3] = E[a\cdot \hat{\theta}_1 + (1-a)\cdot \hat{\theta}_2] = a\cdot E[\hat{\theta}_1] + (1-a)\cdot E[\hat{\theta}_2] = a\cdot \theta + (1-a)\cdot \theta = \theta$$, we see that $$\hat{\theta}_3$$ is an unbiased estimator for $$\theta$$ for all $$a\in\mathbb{R}$$.
2. The variance of $$\hat{\theta}_3$$ is given by the quadratic function $f(a) = V[\hat{\theta}_3] = a^2\cdot \sigma_1^2 + (1 - a)^2\cdot \sigma_2^2.$ The first derivative $$f'(a) = 2\cdot [(\sigma_1^2 + \sigma_2^2)\cdot a - \sigma_2^2]$$ equals zero at $$a = \sigma_2^2 / (\sigma_1^2 + \sigma_2^2)$$, and since the second derivative $$f''(a) = 2\cdot (\sigma_1^2 + \sigma_2^2) > 0$$, we see that the critical point is a global minimum for the quadratic function. Thus, of all possible weighted averages of the unbiased estimators $$\hat{\theta}_1$$, $$\hat{\theta}_2$$, $\hat{\theta}_3 = \frac{\sigma_2^2}{\sigma_1^2 + \sigma_2^2}\cdot \hat{\theta}_1 + \frac{\sigma_1^2}{\sigma_1^2 + \sigma_2^2}\cdot \hat{\theta}_2$ has the smallest variance $$\sigma_3^2 = V[\hat{\theta}_3] = \sigma_1^2\cdot \sigma_2^2 / (\sigma_1^2 + \sigma_2^2)$$. Observe that the variance of $$\hat{\theta}_3$$ is less than the variance of either $$\hat{\theta}_1$$ or $$\hat{\theta}_2$$. This fact becomes apparant when we see that $$1/\sigma_3^2 = 1/\sigma_1^2 + 1/\sigma_2^2$$ and noting that both terms in the sum are positive.

This problem shows that a suitable weighted average of independant, unbiased estimators for $$\theta$$ produces a new unbiased estimator for $$\theta$$ that has smaller variance than either of the original estimators.

## Problem 8.4 (4 points)

Suppose $$Y_1, Y_2, Y_3$$ denotes a random sample from an exponential distribution with probability density function $f(y) = \begin{cases} \frac{1}{\theta}\cdot e^{-y/\theta} &, y > 0 \\ 0 &, y \le 0. \end{cases}$ Note that $$E[Y_i]=\theta$$ and $$V[Y_i]=\theta^2$$, $$i=1,2,3$$.

1. Consider: $$\hat{\theta}_1 = Y_1$$, $$\hat{\theta}_2 = \frac{1}{2}(Y_1 + Y_2)$$, $$\hat{\theta}_3 = \frac{1}{3}Y_1 + \frac{2}{3}Y_2$$ $$\hat{\theta}_4 = \min{(Y_1, Y_2, Y_3)}$$, $$\hat{\theta}_5 = \overline{Y}$$.

\begin{align*} E[\hat{\theta}_1] &= E[Y_1] = \theta. \\ E[\hat{\theta}_2] &= \frac{1}{2}\left(E[Y_1] + E[Y_2]\right) = \frac{1}{2}(\theta + \theta) = \theta. \\ E[\hat{\theta}_3] &= \frac{1}{3}E[Y_1] + \frac{2}{3}E[Y_2] = \frac{1}{3}\theta + \frac{2}{3}\theta = \theta. \\ E[\hat{\theta}_4] &= \frac{1}{3}\theta \text{ (see exercise 6.65(a), page 324).} \\ E[\hat{\theta}_5] &= E[\overline{Y}] = \theta. \end{align*} So, $$\hat{\theta}_1$$, $$\hat{\theta}_2$$, $$\hat{\theta}_3$$, $$\hat{\theta}_5$$ are unbiased estimators for $$\theta$$.
2. We calculate the variances of the unbiased estimators. \begin{align*} V[\hat{\theta}_1] &= V[Y_1] = \theta^2 \\ V[\hat{\theta}_2] &= \frac{1}{4}(\theta^2 + \theta^2) = \frac{1}{2}\theta^2 \\ V[\hat{\theta}_3] &= \frac{1}{9}\theta^2 + \frac{4}{9}\theta^2 = \frac{5}{9}\theta^2 \\ V[\hat{\theta}_5] &= \frac{1}{3}\theta^2, \end{align*} so $$\hat{\theta}_5 = \overline{Y}$$ has the least variance.

## Problem 8.8 (6 points)

We are given that $$Y_1, \dotsc, Y_n$$ represents a random sample from a uniform distribution on the interval $$(\theta,\theta + 1)$$. Therefore, $$E[Y_i] = \theta + \frac{1}{2}$$, $$V[Y_i] = 1/12$$, $$i=1,\dotsc,n$$.
1. The bias for $$\overline{Y}$$ (as an estimator for $$\theta$$) is $B = E[\overline{Y}] - \theta = (\theta + 1/2) - \theta = 1/2.$
2. Let $$\hat{\theta} = \overline{Y} - 1/2$$, then $$E[\hat{\theta}] = E[\overline{Y} - 1/2] = (\theta + 1/2) - 1/2 = \theta$$, so $$\overline{Y} - 1/2$$ is an unbiased estimator for $$\theta$$.
3. $$\text{MSE}[\overline{Y}] = V[\overline{Y}] + B^2 = \frac{1}{12n} + \frac{1}{4} = \frac{3n+1}{12n}$$.

## Problem 8.10 (6 points)

Let $$Y_1, \dotsc, Y_n$$ denote a random sample from a population whose density and distribution functions are \begin{align*} f(y) &= \begin{cases} \alpha\cdot y^{\alpha-1}/\theta^\alpha & , 0 \le y \le \theta \\ 0 & , \text{ otherwise} \end{cases} \\ F(y) &= \begin{cases} 1 & , y > \theta \\ (y/\theta)^\alpha & , 0 \le y \le \theta \\ 0 & , y < 0. \end{cases} \end{align*} Let $$\hat{\theta} = \max\{Y_1, \dotsc, Y_n\} = Y_{(n)}$$. Then $$\hat{\theta}$$ has density $g_{(n)}(y) = \begin{cases} n \alpha\cdot y^{n \alpha - 1} / \theta^{n \alpha} & , 0 \le y \le \theta \\ 0 & , \text{ otherwise.} \end{cases}$
1. We use $$g_{(n)}$$ to find the expected value of $$\hat{\theta}$$. $E[\hat{\theta}] = \int_{0}^{\theta} n\alpha\cdot y\cdot y^{n\alpha - 1}/\theta^{n\alpha}\,dy = \left.\frac{n\alpha}{n\alpha + 1}\cdot \frac{y^{n\alpha + 1}}{\theta^{n\alpha}}\right|_0^{\theta} = \frac{n\alpha}{n\alpha + 1}\cdot \theta.$ Since $$E[\hat{\theta}] \ne \theta$$, we see that $$\hat{\theta}$$ is a biased estimator for $$\theta$$.
2. $$\frac{n\alpha + 1}{n\alpha}\cdot \hat{\theta}$$ is an unbiased estimator for $$\theta$$.
3. The bias for $$\hat{\theta}$$ is $$B = \frac{n\alpha}{n\alpha+1}\cdot\theta - \theta = -\theta / (n\alpha + 1)$$. We calculate the second moment $E\left[\hat{\theta}^2\right] = \int_{0}^{\theta} n\alpha\cdot y^{n\alpha + 1} / \theta^{n\alpha}\,dy = \frac{n\alpha}{n\alpha + 2}\cdot \theta^2.$ Finally, we calculate the mean square error \begin{align*} \text{MSE}[\hat{\theta}] &= V[\hat{\theta}] + B^2 \\ &= \frac{n\alpha}{n\alpha + 2}\cdot \theta^2 - \left(\frac{n\alpha}{n\alpha + 1}\right)^2\cdot \theta^2 + \frac{1}{(n\alpha + 1)^2}\cdot \theta^2 \\ &= \frac{2\cdot \theta^2}{(n\alpha + 1)(n\alpha + 2)}. \end{align*}

## Problem 8.12 (6 points)

Suppose $$Y_1, \dotsc, Y_n$$ constitute a random sample from a normal distribution with mean $$\mu$$ and variance $$\sigma^2$$.

Let $$Y = (n - 1)\cdot S^2 / \sigma^2$$, which we know has the $$\chi^2$$ probability distribution with $$\nu = n - 1$$ degrees of freedom. By exercise 4.90(c), $$E[\sqrt{Y}] = \sqrt{2}\cdot \Gamma(n/2) / \Gamma((n-1)/2)$$.
1. Now, $$S = {\sigma}\cdot \sqrt{Y} / {\sqrt{n-1}}$$ and therefore $E[S] = \frac{\sigma}{\sqrt{n-1}}\cdot E\left[\sqrt{Y}\right] = \sqrt{\frac{2}{n-1}}\cdot \frac{\Gamma(n/2)}{\Gamma\left((n-1)/2)\right)}\cdot \sigma.$ We see that $$S$$ is a biased estimator for $$\sigma$$, even though $$S^2$$ is an unbiased estimator for $$\sigma^2$$.
2. We can adjust $$S$$ by a multiplicative constant to create the unbiased estimator for $$\sigma$$ $\hat{\sigma} = \sqrt{\frac{n-1}{2}}\cdot \frac{\Gamma\left((n-1)/2)\right)}{\Gamma(n/2)}\cdot S.$
3. An unbiased estimator for $$\mu - z_{\alpha}\cdot \sigma$$ is $$\overline{Y} - z_{\alpha}\cdot \hat{\sigma}$$, where $$\overline{Y} = \frac{1}{n}\sum_{i=1}^{n} Y_{i}$$ and $$\hat{\sigma}$$ is the estimator defined in part (b).

## Problem 8.14 (2 points)

Let $$Y_1, \dotsc, Y_n$$ denote a random sample from a population with a uniform distribution on the interval $$(0,\theta)$$. Let $$Y_{(1)} = \min\{Y_1, \dotsc, Y_n\}$$. Recall that the density and distribution functions for this uniform distribution are, respectively, \begin{align*} f(y) &= \begin{cases} \frac{1}{\theta} & , 0 < y < \theta \\ 0 & , \text{ otherwise}, \end{cases} \\ F(y) &= \begin{cases} 1 & , y \ge \theta \\ \frac{y}{\theta} & , 0 < y < \theta \\ 0 & , y \le 0. \end{cases} \end{align*}

Thus, the density function for $$Y_{(1)}$$ is $g_{(1)}(y) = n\cdot \left[ 1 - F(y)\right]^{n-1}\cdot f(y) = \begin{cases} \frac{n}{\theta} \cdot \left( 1 - \frac{y}{\theta}\right)^{n-1} & , 0 < y < \theta \\ 0 & , \text{ otherwise} \end{cases}.$ Now that we have the density for $$Y_{(1)}$$, we can calculate $E[Y_{(1)}] = \int_{0}^{\theta} \frac{ny}{\theta}\cdot \left( 1 - \frac{y}{\theta}\right)^{n-1}\,dy = \frac{\theta}{(n + 1)}.$ We see that $$Y_{(1)}$$ is a biased estimator for $$\theta$$, but we may adjust it by a multiplicative constant to obtain the unbiased estimator $$\hat{\theta} = (n + 1)\cdot Y_{(1)}$$.

## Problem 8.16 (4 points)

Suppose that $$Y_1, Y_2, Y_3, Y_4$$ denotes a random sample from a population with an exponential distribution whose density is given by $f(y) = \begin{cases} \frac{1}{\theta}\cdot e^{-y/\theta} & , y > 0 \\ 0 & , \text{ otherwise} \end{cases}.$ Recall that $$Y$$ is a Gamma distribution with parameters $$\alpha = 1$$ and $$\beta = \theta$$. By exercise 4.89(a), $$E[Y^a] = \theta^{a}\cdot \Gamma(1 + a)/\Gamma(1) = \theta^{a}\cdot a\cdot \Gamma(a)$$, therefore $E[ \sqrt{Y} ] = \frac{1}{2} \Gamma\left(\frac{1}{2}\right)\cdot \sqrt{\theta} = \frac{1}{2}\sqrt{\pi\cdot \theta}.$
1. Let $$X = \sqrt{Y_1\cdot Y_2}$$. Since $$Y_1$$ and $$Y_2$$ are independent, $E[X] = E[Y_1]\cdot E[Y_2] = \frac{1}{4}\pi\cdot \theta,$ so an unbiased estimator for $$\theta$$ is $$\frac{4}{\pi}\sqrt{Y_1\cdot Y_2}$$.
2. Let $$W = \sqrt{Y_1\cdot Y_2\cdot Y_3\cdot Y_4}$$, then $E[W] = E[Y_1]\cdot E[Y_2]\cdot E[Y_3]\cdot E[Y_4] = \frac{1}{16}\pi^2\cdot \theta^2.$ Thus, an unbiased estimator for $$\theta^2$$ is $$\frac{16}{\pi^2}\sqrt{Y_1\cdot Y_2\cdot Y_3\cdot Y_4}$$.
LS0tCnRpdGxlOiAiU29sdXRpb25zIHRvIEhvbWV3b3JrIEFzc2lnbm1lbnQgMyIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKIyMgUHJvYmxlbSA4LjIgKDQgcG9pbnRzKQpXZSBhcmUgZ2l2ZW4gXChFW1xoYXR7XHRoZXRhfV8xXSA9IEVbXGhhdHtcdGhldGF9XzJdID0gXHRoZXRhXCksIFwoVltcaGF0e1x0aGV0YX1fMV09XHNpZ21hXzFeMlwpLCBcKFZbXGhhdHtcdGhldGF9XzJdPVxzaWdtYV8yXjJcKSwgYW5kIFwoXGhhdHtcdGhldGF9XzFcKSBhbmQgXChcaGF0e1x0aGV0YX1fMlwpIGFyZSBpbmRlcGVuZGVudC4KCkxldCBcKFxoYXR7XHRoZXRhfV8zID0gYVxjZG90IFxoYXR7XHRoZXRhfV8xICsgKDEtYSlcY2RvdCBcaGF0e1x0aGV0YX1fMlwpLgo8b2wgdHlwZT0iYSI+CjxsaT4KU2luY2UgXChFW1xoYXR7XHRoZXRhfV8zXSA9IEVbYVxjZG90I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