\magnification=\magstep1
\def\sol{\bigskip\item{} {\it Solution:} }
\nopagenumbers
\centerline{Mathematics 376 -- Probability and Statistics 2}
\centerline{Midterm Examination 2 -- Solutions}
\centerline{April 21, 2006}
\bigskip
\noindent
I. (20) Let $Y_1, \ldots, Y_n$ be independent samples from the distribution
with pdf containing the unknown parameter $\theta$:
$$f(y|\theta) = \cases{{1\over\theta}y^{1/\theta-1} & if $0 < y < 1$\cr
                                        0 & otherwise}$$
Determine the maximum likelihood estimator for $\theta$ using the 
$Y_i$.
\sol
The log-likelihood function is:
$$\eqalign{
\ln(L) &= \ln\left({1\over\theta^n}(y_1\ldots y_n)^{1/\theta - 1}\right)\cr
       &= -n\ln(\theta) + (1/\theta - 1)\sum_i \ln(y_i)\cr}$$
So 
$$\eqalign{
0 = {d\over d\theta} \ln(L) &= {-n\over\theta} - {1\over\theta^2}\sum_i\ln(y_i)\cr
\Rightarrow \widehat\theta &= {-\sum_i \ln(y_i)\over n}\cr}$$ 
(It can be checked that this is a maximum for the likelihood
by the second derivative test.)
\bigskip
\noindent
II.  A machine shop manufactures toggle levers.  Let $d$ be 
the proportion of defectives in the shop's output.
A random sample of size $n = 150$ toggle levers
produced $6$ defectives.
\item{A)}  (10) Find a $95\%$ confidence interval for $d$ using this 
information.
\sol
Since $n = 150$ we use the large sample formula, and 
$z_{.05/2} = 1.96$.
The confidence interval is 
$$\eqalign{
d &= {6\over 150} \pm 1.96 \sqrt{{(6/150)(144/150)\over 150}}\cr
  &=  .04 \pm .03136\cr}$$
(Note that this interval contains only positive numbers.)
\bigskip
\item{B)}  (10) 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.  
\sol
Again, since $n = 150$, we use a $z$-test.  The test statistic
is 
$$z = {.04 - .10\over \sqrt{(.1)(.9)\over 150}} = -2.45$$
The rejection region for the two-tailed test ($H_a$ is $d \ne .1$) is
$$RR = \{z : |z| > z_{.01} = 2.33\}$$
So we reject $H_0$ at the $\alpha = .02$ level.  The $p$-value
is $p = 2(.0071) = .0142$ from the standard normal table with $z = 2.45$.
\bigskip
\item{C)}  (10)  For the test in part B, what is $\beta$
(probability of Type II error) if the true value of $d$ is $.03$?
\sol
We find $\beta$ as follows from $TS = {Y/n - .01\over \sqrt{(.1)(.9)\over 150}}$
as above, using the fact that $d$ is really $.03$ (so $Y/n$ is 
approximately normal with mean $.03$ and variance ${(.03)(.97)\over 150}$):
$$\eqalign{
\beta &= P(TS \notin RR\ |\ d = .03)\cr 
      &= P(-2.33 < TS < 2.33\ |\ d = .03)\cr
      &= P(.0429 < Y/n < .1571)\cr
      &= P\left({.0429 - .03\over \sqrt{(.03)(.97)\over 150}} < z < 
          {.1571 + .03\over \sqrt{(.03)(.97)\over 150}}\right)\cr
      &= P(.9281 < z < 9.144)\cr
      &= P(z > .9281) - P(z > 9.144)\cr
      &\doteq .1762 - 0\cr
      &=.1762\cr}$$
\bigskip
\noindent
III.  Consider the following measurements of the heat-producing
capacity of the oil produced by two fields (in billions of 
calories per ton):
$$\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}$$
\item{A)} (10) Estimate the {\it variance} $\sigma^2$ of the heat 
producing capacity of the oil from each field.
\sol 
Use the usual unbiased estimator formula for the sample variance:
$$s^2 = {1\over n-1} \sum_{i=1}^n (Y_i - \overline{Y})^2$$
This gives
$$s_1^2 \doteq .01575 \qquad s_2^2 \doteq .01092$$
\item{B)} (10) Test the null hypothesis $H_0: \sigma_1^2 = \sigma_2^2$
against the alternative $H_a : \sigma_1^2 \ne \sigma_2^2$ at the 
$\alpha = .05$ level.  State your conclusion
clearly and succinctly.
\sol
To test equality of variances, we use an $F$-test.  The
test statistic is $f = s_1^2/s_2^2 \doteq 1.44$.
The rejection region for a test with $\alpha = .05$ is
$$\{f < f_{.975}(4,5)\} \cup \{f > f_{.025}(4,5)\}$$
From the $F$-table we have $f_{.025}(4,5) = 7.39$ 
and $f_{.975}(4,5) = 1/f_{.025}(5,4) = 1/9.36 = .1068$.
$1.44$ is not in the rejection region, so there is not
enough evidence here to indicate that the variances
are different.
\bigskip
\item{C)} (15) Construct a two-sided $95\%$ confidence interval 
for the difference of the population mean
heat producing capacities $\mu_1 - \mu_2$.
\sol 
(Under assumption variances equal) we use the pooled
estimator
$$s_p^2 = {(4)(.01575) + (5)(.01092)\over 9} = .01307.$$
Then the confidence interval is
$$\eqalign{
\overline{Y_1} - \overline{Y_2} \pm t_{.025}(9)\sqrt{s_p^2(1/5 + 1/6)}
&= 8.23 - 7.94 \pm (2.262)\sqrt{(.01307)(1/5 + 1/6)}\cr
&= .29 \pm .1566\cr}$$
\bigskip
\noindent
IV.  (15) Let $(x_i,y_i)$, $i = 1, \ldots, n$ be a collection of
data points.  Using the matrix formulation, derive the normal equations
for the least squares estimators for the coefficients
$\beta_0,\beta_1$ in the model $Y = \beta_0 + \beta_1 x + \varepsilon$
fitting the data.
\sol
We have 
$$X = \pmatrix{1 & x_1\cr 1 & x_2 \cr \vdots &\vdots\cr 1 & x_n\cr}
\qquad Y = \pmatrix{y_1\cr y_2 \cr \vdots \cr y_n\cr}$$
So the normal equations are
$$\eqalign{X^tX \beta &= X^tY\cr
\pmatrix{1 & 1 & \cdots & 1\cr
         x_1 & x_2 & \cdots & x_n\cr} 
\pmatrix{1 & x_1\cr 1 & x_2 \cr \vdots &\vdots\cr 1 & x_n\cr} \beta
&= 
\pmatrix{1 & 1 & \cdots & 1\cr
         x_1 & x_2 & \cdots & x_n\cr}  
\pmatrix{y_1\cr y_2 \cr \vdots \cr y_n\cr}\cr
\pmatrix{n & \sum x_i\cr
 \sum x_i & \sum x_i^2\cr} \pmatrix{\beta_0 \cr \beta_1} &=
         \pmatrix{\sum y_i\cr \sum x_iy_i\cr}\cr}$$ 
\bigskip
\noindent
{\it Extra Credit} (10)  In the situation of question III part C above,
suppose you had $n = 50 = m$ measurements from each oil field
instead of $n_1 = 5$ and  $n_2 = 6$. 
What, if anything, would change in the method you would use?  Explain.
\sol
With 50 measurements from each oil field, you could use
the large sample formula.  The $t_{\alpha/2}$ would be
replaced by $z_{\alpha/2}$.  Moreover, for the large
sample test, it is not necessary to assume that 
the individual variances are equal, so you do not need to
use the pooled estimator for the variance:
$$\overline{Y_1} - \overline{Y_2} \pm z_{.025}\sqrt{s_1^2/50 + s_2^2/50}$$
\bye
