\renewcommand{\coddate}{{\small \today}}
\renewcommand{\sheweek}{MT2006/2007 Exercise 5: Solutions}

\begin{enumerate}

\item
(i) $\bar b = {1\over n} \sum_{i=1}^n b_i ={1\over n} \sum_{i=1}^n
(\alpha a_i + \beta) = \alpha {1\over n} \sum_{i=1}^n a_i + \beta =
\alpha \bar a + \beta$. $ \sum_{i=1}^n (b_i - \bar b)^2 =
\sum_{i=1}^n (\alpha a_i + \beta - \alpha \bar a - \beta)^2 =
\alpha^2 \sum_{i=1}^n (a_i - \bar a)^2$.



(ii) $\sum_{i=1}^n (a_i -c) (b_i -d) = \sum_{i=1}^n (a_i - \bar a +
\bar a - c) (b_i - \bar b + \bar b - d) = \sum_{i=1}^n (a_i - \bar a
)(b_i - \bar b ) + \{\sum_{i=1}^n (a_i - \bar a) \} (\bar b - d) +
(\bar a - c) \sum_{i=1}^n [(b_i - \bar b) + (\bar a - c) (\bar b -
d)]$. The first equation follows from the fact that $\sum_{i=1}^n
(a_i - \bar a )= 0$ and $\sum_{i=1}^n (b_i - \bar b) =0$. The second
equation follows from the first equation immediately by letting $c =
d =0$.


\item
(i) From the course work, we know that
$\bar X \sim N(\mu_1, {1\over n}\sigma^2)$
and
$
\bar Y \sim N(\mu_2, {1\over m} \sigma^2 )$.
Since $\bar X$ and $\bar Y$ are independent,
$\bar X - \bar Y \sim N( \mu_1 - \mu_2 ,
({1\over n} + {1\over m}) \sigma^2 )$.

(ii) We know that $ \sigma^{-2}(n-1)s^2_x \sim \chi^2(n-1)$
and $ \sigma^{-2}(m-1) s^2_y \sim \chi^2(m-1)$.
Note that $s^2_x$ and $s^2_y$ are also independent.
From the reproductive property of $\chi^2$ distribution,
we have $\sigma^{-2} T \sim \chi^2(n+m-2)$.

(iii) Note that
\[
Z \equiv
{\bar X - \bar Y \over \sqrt {T}}
\sqrt { nm(n+m-2) \over m+n}
= {(\bar X - \bar Y)/\sqrt{\sigma^2 ({1\over n} + {1\over m})}
\over
\sqrt { \sigma^{-2} T /(n+m-2)} }.
\]
On the right hand side of the above expression, the numerator is a
standard normal random variable, and the denominator is a square root
of $\chi^2$-distributed random variable divided by its degrees of
freedom, and the two parts are independent. Hence $Z$ has
$t$-distribution with $(n+m-2)$ degrees of freedom.

\item
For outcome (i), the likelihood is
\[
L(N_a) = {N_a \over 100} {N_b\over 99}
{N_a -1 \over 98} {N_b -1\over 97} {N_a -2 \over 96}
\propto N_a(N_a-1)(N_a-2) (100 -N_a) (99-N_a).
\]
Note the probability of outcome (ii) is the same as the probability of
 outcome (i).
Therefore $L(N_a)$ defined above is also the likelihood with outcome (ii).

The probability for the event of 3 $A$'s and 2 $B$'s with unknown ordering is
\[
{ \Big(
\begin{array}{c}
N_a \\
3
\end{array}
\Big) \Big(
\begin{array}{c}
N_b\\
2
\end{array}
\Big)
\over \Big(
\begin{array}{c}
100\\
5
\end{array}
\Big) }
\propto  N_a(N_a-1)(N_a-2) (100 -N_a) (99-N_a),
\]
which is different, as a probability, from
those for outcomes (i) and (ii).
However the likelihood with this `combined' outcome is still in principle
the same as likelihood based outcome (i) or (ii).
According to the likelihood principle, the inference for $N_a$ based all three
outcomes should be the same.

\item \label{qu:4}
 \begin{enumerate}
    \item The joint probability function of the observations is
    \[
    \prod_{i=1}^n
    \left[e^{-\lambda}\frac{\lambda^{y_i}}{y_i!}\right]
=
    e^{-n\lambda}\lambda^{\sum y_i}\times \frac{1}{\prod y_i!}.
    \]
    So we have a factorisation of the joint probability function
    into
    \[
    g\left(\sum y_i; \lambda\right) =e^{-n\lambda}\lambda^{\sum y_i}
    \]
    and
$
    h(\by)=\frac{1}{\prod y_i!}.
$
    It follows that $\sum Y_i$ is a sufficient statistic for
    $\lambda$ using the factorisation criterion.
    \item the joint density function is
    \[
    \prod_{i=1}^n
    \left[\frac{1}{\sqrt{2\pi}\sigma}e^{-y_i^2/(2\sigma^2)}\right]
=
    \left[\frac{1}{\sqrt{2\pi}\sigma}\right]^ne^{-\sum
    y_i^2/(2\sigma^2)}.
    \]
    Here we can take $g\left(\sum y_i^2; \sigma^2\right)$ as the joint
    density and $h(\by)$ as identically 1. It follows by the
    factorisation criterion that $\sum Y_i^2$ is a sufficient
    statistics for $\sigma^2$.
    \item
    The probability function for the geometric distribution is
$
    f(y_i;\pi)=(1-\pi)\pi^{y_i}, \hspace{0.1in} y_i=0,1,2,\dots .
$
    The joint probability function is
\[
    f(\by;\pi) = \prod_{i=1}^nf(y_i;\pi)
    =(1-\pi)^n\pi^{\sum y_i}
\]
    So we can again take $g\left(\sum y_i\right)$ as the joint probability
    function and $h(\by)=1$.  By the factorisation criterion $\sum
    Y_i$ is a sufficient statistic for $\pi$.
    \item We can write the density function
    \[
    f_{Y_i}(y_i)=\frac{1}{\theta_2-\theta_1}I_{(\theta_1,\infty)}(y_i)I_{(-\infty,\theta_2)}(y_i)
    \]
    where the indicator functions are defined so that for a set
    $A$,
$
    I_{A}(y)=\left\{\begin{array}{lr}
                    0&y\not\in A,\\
                    1& y\in A.
                    \end{array}\right.
$
    The joint density function is therefore
    \[
    f_\bY(\by)=\left[\frac{1}{\theta_2-\theta_1}\right]^n\left[\prod_{i=1}^n
    I_{(\theta_1,\infty)}(y_i)\right]
    \left[\prod_{i=1}^nI_{(-\infty,\theta_2)}(y_i)\right]
    \]
    which simplifies to
    \[
    \left[\frac{1}{\theta_2-\theta_1}\right]^nI_{(\theta_1,\infty)}(\min_i y_i)
    I_{(-\infty,\theta_2)}(\max_i y_i)
    \]
Once again we can take $g(\min_i y_i,\max_i
    y_i;\theta_1,\theta_2)$ as the joint density function, and
    $h(\by)=1$.  By the factorisation criterion, $(\min_i Y_i,\max_i
    Y_i)$ is a sufficient statistic for $(\theta_1,\theta_2)$.
    \item the joint density function is
    \[
    f_{\bY}(\by)=\prod_{i=1}^n\left[e^{-(y_i-\theta)}I_{(\theta,\infty)}(y_i)\right]
 %   \]
 %   which is
 %   \[
 %   e^{-n(\bar{y}-\theta)}I_{(\theta,\infty)}(\min_i y_i).
 %   \]
 %   and this is
 %   \[
 =   e^{n\theta}I_{(\theta,\infty)}(\min_i y_i)
    e^{-n\bar{y}}.
    \]
    We can take $g(\min_i y_i; \theta)=e^{n\theta}I_{(\theta,\infty)}(\min_i
    y_i)$ and $h(\by)=e^{-n(\bar{y}}$ to show that $\min_i Y_i$ is
    a sufficient statistic for $\theta$.
    \end{enumerate}


\end{enumerate}
