\magnification=\magstep1
\nopagenumbers
\centerline{Mathematics 376 -- Probability and Statistics 2}
\centerline{Solutions for Midterm Examination 2}
\centerline{April 22, 2010}
\bigskip
\noindent
I. Let $Y_1, \ldots, Y_n$ be independent samples from the distribution
with pdf containing the unknown parameter $\theta > 0$:
$$f(y|\theta) = \cases{{1\over\theta}y^{1/\theta-1} & if $0 < y < 1$\cr
                                        0 & otherwise}$$
\item{A)} (10)  Determine the method of moments estimator for $\theta$ using
the $Y_i$.  
\bigskip
\item{} {\it Solution:}  For a random variable with this density, 
$$\eqalign{
E(Y) &= \int_0^1 y\cdot {1\over \theta} y^{1/\theta - 1}\ dy\cr
&= {1\over \theta} \int_0^1 y^{1\over\theta}\ dy\cr
&= \left.{{1\over \theta}\over {1\over \theta} + 1} y^{{1\over \theta} + 1}\right|_0^1\cr
&= {1 \over \theta+1}.\cr
}$$
Then by the method of moments, we set 
$$\overline{Y} = {1 \over \theta+1}$$
and solve for theta to get the estimator:
$$\theta \overline{Y} + \overline{Y} = 1 \Rightarrow \widehat{\theta}_{MM} = 
{1 - \overline{Y} \over \overline{Y}}\ .$$ 
\item{B)} (15)  Determine the maximum likelihood estimator for $\theta$ using the 
$Y_i$.
\bigskip
\item{} {\it Solution:}  We have 
$$
L(y_1,\ldots,y_n|\theta) = {1\over \theta^n} (y_1 \cdots y_n)^{1/\theta - 1},
$$
so 
$$\ln(L) = -n\ln(\theta) + \left({1\over\theta} - 1\right)\ln(y_1\cdots y_n).$$
This is a case where $\ln(L)$ {\it does have} a critical point (exactly one):
$${d\over d\theta} \ln(L) = {-n\over \theta} - {1\over\theta^2}\ln(y_1\cdots y_n) = 0$$
when $\theta$ equals:
$$\widehat{\theta}_{ML} = {-\ln(Y_1\cdots Y_n)\over n}.$$
It can be checked without too much difficulty that this is a local maximum.  For instance,
by the Second Derivative Test, 
$${d^2\over d\theta^2} \ln(L) = {n\over \theta^2} + {2\over \theta^3} \ln(y_1\cdots y_n)$$
Substituting $\theta = {-\ln(y_1\cdots y_n)\over n}$ gives the second derivative value:
$$
{n^3 \over \ln(y_1\cdots y_n)^2} - {2n^3\over \ln(y_1\cdots y_n)^2} < 0.
$$
Therefore, this is a local maximum.  

\bigskip
\noindent
II.  A shop manufactures O-rings for the Space Shuttle booster rockets
for NASA.  Let $d$ be the proportion of defectives in the shop's output.
A random sample of size $n = 70$ O-rings produced $6$ defectives.
\item{A)}  (15) Test the hypothesis $H_0 : d = .1$ versus
$H_a : d \ne .1$ using this data.  Take $\alpha = .02$ (probability
of Type I error).  Also give the $p$-value of your test.
\bigskip
\item{} {\it Solution:} Since $n = 70 > 30$, a large-sample test is appropriate. The 
test statistic is 
$$z = {6/70 - .1 \over \sqrt{(.1)(.9)\over 70}} = -.3984.$$
For a two-tail test at level $\alpha = .02$, we would have
$$RR = \{z\mid |z| > z_{.01}\} = \{z\mid |z| > 2.33\}.$$
Since $z$ is not in the rejection region, we cannot reject $H_0$.
The $p$-value of the test would be about $2 \times .3446 = .6892$
from the standard normal table.  This is much too large to reject $H_0$.
\bigskip  
\item{B)}  (15)  For the test in part A, what is $\beta$
(probability of Type II error) if the true value of $d$ is $.03$?
\bigskip
\item{} {\it Solution:}  The Type II error probability is the
probability of {\it not rejecting $H_0$} when it is not true.
This corresponds to having ${Y\over 70}$ in the complement of the rejection 
region so:
$$.1 - 2.33\sqrt{(.1)(.9)\over 70} \le {Y\over 70} \le .1 + 2.33\sqrt{(.1)(.9)\over 70}.\leqno(1)$$
If the true value of $d$ is $.03$, then this probability can be estimated using the fact that
$${{Y\over 70} - .03 \over \sqrt{(.03)(.97)\over 70}}$$
is approximately standard normal, so the probability that ${Y\over 70}$ is in the range from (1) is
$$P\left(
{.07 - 2.33\sqrt{(.1)(.9)\over 70} \over \sqrt{(.03)(.97)\over 70}} < Z < 
{.07 + 2.33\sqrt{(.1)(.9)\over 70} \over \sqrt{(.03)(.97)\over 70}}
\right)$$
This is 
$$P(-.66 < Z < 7.53) \doteq P(Z \le +.66) = 1 - .2546 = .7454.$$
This value of $\beta$ would be clearly unacceptable in general for a reliable test.  
A larger sample size is indicated!
\bigskip
\noindent
III.  Consider the following measurements of the heat-producing
capacity of the natural gas produced by two fields of gas wells
(in calories per cubic meter):
$$\matrix{
{\rm Field\ 1:}& 8.26 & 8.13 & 8.35 & 8.07 & 8.34 &\cr
{\rm Field\ 2:}& 7.95 & 7.89 & 7.90 & 8.14 & 7.92 & 7.84\cr}$$
Let $\mu_i$ ($i = 1,2$) be the population mean heat-producing capacity
of the natural gas from field $i$.  
\item{A)} (10)  What assumptions do you need to make in order 
to use the appropriate test of $H_0: \mu_1 = \mu_2$ versus
$H_a: \mu_1 \ne \mu_2$?  How could you determine whether 
it is reasonable to assume those assumptions are satisfied?  
\bigskip
\item{} {\it Solution:}  For the basic small-sample test for equality of means,
we would need to assume the usual independence of the two sets of samples, 
that the two populations have normal distributions, and that the variances
of the two normal populations are {\it equal}.  You could do an $F$-test
for equality of the two population variances.  (Note that no $F$-table was
provided with the exam(!)  If you had one, then you could proceed as follows. 
The two sample variances are 
$$S_1^2 = .01575 \quad {\rm and} \quad S_2^2 = .01092.$$
So $F = S_1^2/S_2^2 = 1.4423$.  For 4 degrees of freedom in the numerator and 
5 degrees of freedom in the denominator, with $\alpha = .05$,
$F_{.025} = 7.39$ and $F_{.975} = 1/9.36 \doteq .011$.
The rejection region would consist of values $F > 7.39$ and $0 < F < .011$.  
We do not reject the null hypothesis $H_0: \sigma_1^2 = \sigma_2^2$.)
\bigskip
\item{B)}  (15)  Carry out the test from part A with $\alpha = .05$ 
and state your conclusion clearly and succinctly.
\bigskip
\item{} {\it Solution:}  We use the pooled estimator for the variance:
$$S_p^2 = {4 S_1^2 + 5 S_2^2\over 9} \doteq .0131.$$
Then 
$$t = {8.23 - 7.94\over \sqrt{.0131}\sqrt{1/5 + 1/6}} \doteq 4.19$$
For a $t$-distribution with 9 degrees of freedom $t_{.025} = 2.262$.
So there is relatively strong evidence to reject $H_0$ here.  (The $p$-value is
between .01 and .02.)
\bigskip
\item{C)} (5) Construct a two-sided $95\%$ confidence interval 
for the difference of the population mean heat producing capacities $\mu_1 - \mu_2$.
How is this related to your answer in B?  
\bigskip
\item{} {\it Solution:}  The confidence interval can be computed using all the 
information developed in the previous part:
$$\mu_1 - \mu_2 = (8.23 - 7.94) \pm (2.262)\sqrt{.0131}\sqrt{1/5 + 1/6}.$$
Under the null hypothesis, $\mu_1 - \mu_2 = 0$, so we ``accept'' $H_0$ with 
sample means $\overline{Y}_1$ and $\overline{Y}_2$ when $0$ is in the confidence
interval
$$\overline{Y}_1 - \overline{Y}_2 \pm (2.262)\sqrt{.0131}\sqrt{1/5 + 1/6}$$
and reject $H_0$ otherwise.
\bigskip
\noindent
IV.  (15) Let $(x_i,y_i)$, $i = 1, \ldots, n$ be a collection of
data points in the plane.  Using the matrix formulation, explain how to 
derive the normal equations
for the least squares estimators for the coefficients
$\beta_0,\beta_1,\beta_2,\beta_3$ in the model 
$Y = \beta_0 + \beta_1 x + \beta_2 x^2 + \beta_3 x^3 + \varepsilon$
fitting the data.  (Note:  You {\it do not need to solve the equations}.)
\bigskip
\item{} {\it Solution:}  We have 
$$X = \pmatrix{1 & x_1 & x_1^2 & x_1^3\cr
               1 & x_2 & x_2^2 & x_2^3\cr
              \vdots & \vdots & \vdots & \vdots \cr
               1 & x_n & x_n^2 & x_n^3\cr}$$
and $Y = $ column vector of with entries $y_1,\ldots,y_n$.  Let $\beta$ be the column vector
with entries $\beta_0,\beta_1,\beta_2,\beta_3$.  Then the normal equations are 
$$X^tX \beta = X^t Y.$$  This can be written in the following form:
$$\pmatrix{n & \sum x_i & \sum x_i^2 & \sum x_i^3\cr
           \sum x_i & \sum x_i^2 & \sum x_i^3 &\sum x_i^4 \cr
           \sum x_i^2 & \sum x_i^3 & \sum x_i^4 &\sum x_i^5 \cr
           \sum x_i^3 & \sum x_i^4 & \sum x_i^5 &\sum x_i^6 \cr} \pmatrix{\beta_0 \cr \beta_1\cr\beta_2\cr\beta_3\cr} = \pmatrix{\sum y_i \cr \sum x_iy_i \cr \sum x_i^2 y_i \cr \sum x_i^3 y_i\cr}$$

\bigskip
\noindent
{\it Extra Credit} (10)  In the situation of question I, 
suppose you set up a test of the hypothesis $H_0:  \theta = 1$ versus
the alternative $H_a:  \theta > 1$ using $Y_1, Y_2$ (exactly two of the samples).  
If you reject $H_0$ when $Y_1 + Y_2 > 1.8$, what is the Type I error probability, $\alpha$?
\bigskip
\item{} {\it Solution:}  Under $H_0$, $\theta = 1$, so $Y_1,Y_2$ have uniform distributions on
the interval $[0,1]$.  The samples are assumed independent, so the joint density of $Y_1$ and $Y_2$
is 1 on the unit square $[0,1]\times [0,1]$ and zero elsewhere.  We make a Type I error
when we reject $H_0$, but $\theta = 1$. The probability that $Y_1 + Y_2 > 1.8$ is the area of an isosceles
right triangle with legs $.2$, so $\alpha = (.2)(.2)/2 = .02$.  
\bye
