%% This document created by Scientific Word (R) Version 2.5
%% Starting shell: article

\documentclass[12pt,thmsa]{article}%
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{sw20lart}%
\setcounter{MaxMatrixCols}{30}%
\usepackage{graphicx}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2890}
%TCIDATA{TCIstyle=article/art4.lat,lart,article}
%TCIDATA{Created=Thu Oct 15 23:57:36 1998}
%TCIDATA{LastRevised=Tuesday, February 10, 2009 15:59:17}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Language=American English}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\setcounter{section}{3}
\setcounter{page}{53}
\setlength{\oddsidemargin}{0mm}
\setlength{\evensidemargin}{0mm}
\setlength{\topmargin}{-7mm}
\setlength{\headheight}{7mm}
\setlength{\headsep}{4.5mm}
\setlength{\textheight}{225mm}
\setlength{\textwidth}{158mm}
\begin{document}
\section{\bigskip Hypothesis Testing}

Rather than looking at confidence intervals associated with model parameters,
we might formulate a question associated with the data in terms of a
hypothesis. In particular, we have a so-called null hypothesis which refers to
some basic premise which to we will adhere unless evidence from the data
causes us to abandon it.\bigskip\newline\textbf{Example 4.1}\quad In a
clinical treatment data may be collected to compare two treatments (old v.
new). \bigskip\ \newline The \textit{null hypothesis }is likely to be
\[
\text{no difference between treatments}%
\]
The \textit{alternative hypothesis} might be:-
\[%
\begin{array}
[c]{l}%
\text{a) treatments are different (\textit{2-sided\ }),}\\
\text{b) new treatment is better (\textit{1-sided}),}\\
\text{c) old treatment is better (\textit{1-sided}).}%
\end{array}
\]
$\blacksquare\medskip$\newline In general we are often in a position to
specify the form of the p.m.f., $p(x;\theta)$, say, or the p.d.f.,
$f(x;\theta)$, but there is doubt about the value of the parameter $\theta$.
All that is known is that $\theta$ is some element of a specified parameter
space $\Theta$. We assume that the null hypothesis of interest specifies that
$\theta$ is an element of some subset $\Theta_{0}$ of $\Theta$, and so is true
if $\theta\in\Theta_{0}$ but false if $\theta\notin\Theta_{0}$.\medskip

\noindent\textbf{Example 4.2\medskip}

\noindent A coin is tossed and we hypothesise that it is fair. Hence
$\Theta_{0}$ is the set $\left\{  \frac{1}{2}\right\}  $ containing just one
element of the parameter space $\Theta=\left[  0,1\right]  .$\newline%
$\blacksquare$ \medskip\newline As a convention we shall denote the complement
of $\Theta_{0}$ in $\Theta$ by $\Theta_{1}$. We call the original hypothesis
that $\theta\in\Theta_{0}$ the \emph{null hypothesis} and denote it by
$H_{0}.$ The hypothesis that $\theta\in\Theta_{1}$ is referred to as the
\emph{alternative hypothesis} and denoted by $H_{1}$.\newline

\subsection{Data and questions}

\textbf{Data set 2.3 }(which we have seen before)\medskip\quad\emph{Silver
content of Byzantine coins}\newline A number of coins from the reign of King
Manuel I, Comnemus (1143 - 80) were discovered in Cyprus. They arise from four
different coinages at intervals throughout his reign. The question of interest
is whether there is any significant difference in their silver content with
the passage of time; there is a suspicion that it was deliberately and
steadily reduced. The data give the silver content (\%Ag) of the coins.%
\[%
\begin{tabular}
[c]{ccccc}%
\multicolumn{5}{l}{\textbf{Table 2.3}\quad Silver content of coins}%
\\\cline{1-4}%
First & Second & Third & Fourth & \\\cline{1-4}%
5.9 & 6.9 & 4.9 & 5.3 & \\
6.8 & 9.0 & 5.5 & 5.6 & \\
6.4 & 6.6 & 4.6 & 5.5 & \\
7.0 & 8.1 & 4.5 & 5.1 & \\
6.6 & 9.3 &  & 6.2 & \\
7.7 & 9.2 &  & 5.8 & \\
7.2 & 8.6 &  & 5.8 & \\
6.9 &  &  &  & \\
6.2 &  &  &  & \\\cline{1-4}%
\end{tabular}
\]
On the face of it the suspicion could be correct in that the fourth coinage
would seem to have lower silver content than, say, the first coinage, but
there is a need for firm statistical evidence if it is to be confirmed.
Suppose the true percentage of silver in coinage $i$ is $\mu_{i}$. The null
hypothesis would be%
\[
H_{0}:\mu_{1}=\mu_{4}%
\]
versus the alternative hypothesis%
\[
H_{1}:\mu_{1}\neq\mu_{4}.
\]
If we believed, right from the start, that no monarch of the period would ever
\emph{increase} the silver content, and that the only possibility of its
changing would be in the direction of reduction, then the alternative
hypothesis would be%
\[
H_{1}:\mu_{1}>\mu_{4}.
\]
\newline$\square\bigskip$\newline\textbf{Data set 4.1\medskip\quad
}\emph{Patients with glaucoma in one eye}\newline The following data (Ehlers,
N., \emph{Acta Opthalmologica}, \textbf{48}) give corneal thicknesses in
microns for patients with one glaucomatous eye and one normal eye.
\[%
\begin{tabular}
[c]{cccc}%
\multicolumn{4}{l}{\textbf{Table 4.1} \ Glaucoma in one eye}\\\cline{1-3}%
\multicolumn{2}{c}{Corneal thickness} &  & \\\cline{1-3}%
Glaucoma & Normal & Difference & \\\cline{1-3}%
488 & 484 & \multicolumn{1}{r}{$4\quad$} & \\
478 & 478 & \multicolumn{1}{r}{$0\quad$} & \\
480 & 492 & \multicolumn{1}{r}{$-12\quad$} & \\
426 & 444 & \multicolumn{1}{r}{$-18\quad$} & \\
440 & 436 & \multicolumn{1}{r}{$4\quad$} & \\
410 & 398 & \multicolumn{1}{r}{$12\quad$} & \\
458 & 464 & \multicolumn{1}{r}{$-6\quad$} & \\
460 & 476 & \multicolumn{1}{r}{$-16\quad$} & \\\cline{1-3}%
\end{tabular}
\
\]
Is there a difference in corneal thickness between the eyes? To answer this we
take the differences $Glaucoma-Normal$ for each patient and test for the mean
of those differences being zero.
\[
H_{0}:\theta=0\quad\text{against\quad}H_{1}:\theta\neq0\mathrm{.}%
\]
$\square$\bigskip\newline\textbf{Data set 4.2}\medskip\quad\emph{Shoshoni
rectangles}\ \newline\noindent Most individuals, if asked to draw a rectangle,
would produce something instinctively \textquotedblleft not too square and not
too long\textquotedblright\ - something pleasing to the eye.%
%TCIMACRO{\FRAME{dhFU}{2.2208in}{1.4927in}{0pt}{\Qcb{\QTR{bf}{Figure 4.1}}}%
%{}{a5hypo_f1.eps}{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 2.2208in;  height 1.4927in;  depth 0pt;  original-width 2.1923in;
%original-height 1.4659in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'a5hypo_f1.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=1.4927in,
width=2.2208in
]%
{a5hypo_f1.eps}%
\\
\textbf{Figure 4.1}%
\end{center}
%EndExpansion
\noindent The ancient Greeks called a rectangle \emph{golden} if the ratio of
its width to its length was
\[
\frac{w}{l}=\frac{1}{2}\left(  \sqrt{5}-1\right)  =0.618
\]
This ratio is called the \emph{golden ratio}.\medskip\newline Shoshoni Indians
used beaded rectangles to decorate their leather goods. The table below gives
width-to-length ratios for 20 rectangles, analysed as part of a study in
experimental aesthetics.%
\[%
\begin{tabular}
[c]{rrrrr}%
\multicolumn{5}{l}{\textbf{Table 4.2}\quad Shoshoni bead rectangles}%
\\\cline{1-4}%
\multicolumn{4}{l}{Width-to-length ratios} & \\\cline{1-4}%
0.693 & 0.670 & 0.654 & 0.749 & \\
0.606 & 0.553 & 0.601 & 0.609 & \\
0.672 & 0.662 & 0.606 & 0.615 & \\
0.844 & 0.570 & 0.933 & 0.576 & \\
0.668 & 0.628 & 0.690 & 0.611 & \\\cline{1-4}%
\end{tabular}
\]


\noindent The data are taken from Lowie's Selected Papers in Anthropology. ed
Dubois, University of California Press.\medskip\ \newline Did the Shoshoni
instinctively make their rectangles conform to the golden ratio? In terms of
hypothesis testing, we would like to test%
\[
H_{0}:\theta=0.618\quad\text{against\quad}H_{1}:\theta\neq0.618\mathrm{.}%
\]
$\square$\newpage

\noindent\textbf{Data set 4.3\quad}\emph{Etruscan and Italian skull
widths\medskip}\newline The data comprise measurements of maximum head breadth
(in cm) which were made in order to ascertain whether Etruscans were native
Italians. They were published by Barnicott, N.A. and Brothwell, D.R. (1959),
\textit{The Evaluation of Metrical Data in the Comparison of Ancient and
Modern Bones in Medical Biology and Etruscan Origins}. Little, Brown and Co.
\[%
\begin{tabular}
[c]{cccccccccccccc}%
\multicolumn{14}{l}{\textbf{Table 4.3}\quad Ancient Etruscan and modern
Italian skull widths}\\\hline
\multicolumn{7}{c}{Ancient Etruscan skulls} &  & \multicolumn{6}{c}{Modern
Italian skulls}\\\cline{1-7}\cline{9-14}%
141 & 147 & 126 & 140 & 141 & 150 & 142 &  & 133 & 124 & 129 & 139 & 144 &
140\\
148 & 148 & 140 & 146 & 149 & 132 & 137 &  & 138 & 132 & 125 & 132 & 137 &
130\\
132 & 144 & 144 & 142 & 148 & 142 & 134 &  & 130 & 132 & 136 & 130 & 140 &
137\\
138 & 150 & 142 & 137 & 135 & 142 & 144 &  & 138 & 125 & 131 & 132 & 136 &
134\\
154 & 149 & 141 & 148 & 148 & 143 & 146 &  & 134 & 139 & 132 & 128 & 135 &
130\\
142 & 145 & 140 & 154 & 152 & 153 & 147 &  & 127 & 127 & 127 & 139 & 126 &
148\\
150 & 149 & 145 & 137 & 143 & 149 & 140 &  & 128 & 133 & 129 & 135 & 139 &
135\\
146 & 158 & 135 & 139 & 144 & 146 & 142 &  & 138 & 136 & 132 & 133 & 131 &
138\\
155 & 143 & 147 & 143 & 141 & 149 & 140 &  & 136 & 121 & 116 & 128 & 133 &
135\\
158 & 141 & 146 & 140 & 143 & 138 & 137 &  & 131 & 131 & 134 & 130 & 138 &
138\\
150 & 144 & 141 & 131 & 147 & 142 & 152 &  & 126 & 125 & 125 & 130 & 133 & \\
140 & 144 & 136 & 143 & 146 & 149 & 145 &  & 120 & 130 & 128 & 143 & 137 &
\\\hline
\end{tabular}
\]
The question asked by the archaeologists is whether there is evidence of
different race from these two sets of measurements. The null hypothesis is
that the two samples of measurements come from the same distribution; the
alternative hypothesis is that there is a difference between the two
samples.\newline$\square\bigskip$\newline\textbf{Data set 4.4\quad
}\emph{Pielou's data on Armillaria root rot \medskip in Douglas fir
trees}\newline The data below were collected by the ecologist E.C. Pielou, who
was interested in the pattern of healthy and diseased trees. The subject of
her research was \emph{Armillaria} root rot in a plantation of Douglas firs.
She recorded the lengths of 109 runs of diseased trees and these are given
below.
\[%
\begin{tabular}
[c]{lrrrrrrr}%
\multicolumn{8}{l}{\textbf{Table 4.4}\quad Run lengths of diseased
trees}\\\cline{1-7}%
Run length & 1 & 2 & 3 & 4 & 5 & 6 & \\
Number of runs & 71 & 28 & 5 & 2 & 2 & 1 & \\\cline{1-7}%
\end{tabular}
\]
On biological grounds, Pielou proposed a geometric distribution as a
probability model. Is this plausible? Can we formally test the goodness of fit
of a hypothesised distribution to data?\newline$\square$\newpage

\noindent\textbf{Data set 4.5\quad}\emph{Flying bomb hits on London\medskip
}\newline The following data give the number of flying bomb hits recorded in
each of 576 small areas of $\frac{1}{4}km^{2}$ in the south of London during
World War II.
\[%
\begin{tabular}
[c]{lccccccc}%
\multicolumn{8}{l}{\textbf{Table 4.5}\quad Flying bomb hits on London}\\\hline
Number of hits in an area & 0 & 1 & 2 & 3 & 4 & 5 & $\geq6$\\
Frequency & 229 & 211 & 93 & 35 & 7 & 1 & 0\\\hline
\end{tabular}
\
\]
Propaganda broadcasts claimed that the weapon could be aimed accurately. If,
however, this was not the case, the hits should be randomly distributed over
the area and should therefore be fitted by a Poisson distribution. Is this the
case?\newline$\square$\bigskip\newline\textbf{Data set 4.6\quad}\emph{A famous
and historic data set\medskip}\newline These are Pearson's 1909 data on crime
and drinking.
\[%
\begin{tabular}
[c]{lll}%
\multicolumn{3}{l}{\textbf{Table 4.6}\quad Crime and drinking}\\\hline
\emph{Crime} & \emph{Drinker} & \emph{Abstainer}\\\hline
Arson & \multicolumn{1}{c}{50} & \multicolumn{1}{c}{43}\\
Rape & \multicolumn{1}{c}{88} & \multicolumn{1}{c}{62}\\
Violence & \multicolumn{1}{c}{155} & \multicolumn{1}{c}{110}\\
Stealing & \multicolumn{1}{c}{379} & \multicolumn{1}{c}{300}\\
Coining & \multicolumn{1}{c}{18} & \multicolumn{1}{c}{14}\\
Fraud & \multicolumn{1}{c}{63} & \multicolumn{1}{c}{144}\\\hline
\end{tabular}
\]
Is crime drink related?\newline$\square$\bigskip\newline\textbf{Data set
4.7\quad}\emph{Snoring and heart disease\medskip}\newline The data in the
table below come from a study which investigated whether snoring was related
to heart disease (Norton, P.G. and Dunn, E.V. (1985), \emph{British Medical
Journal}, \textbf{291}, pages 630-632).
\[%
\begin{tabular}
[c]{lccccc}%
\multicolumn{6}{l}{\textbf{Table 4.7}\quad Snoring frequency and heart
disease}\\\hline
Heart & Non- & Occasional & Snore nearly & Snore every & \\
disease & snorers & snorers & every night & night & Total\\\hline
Yes & 24 & 35 & 21 & 30 & 110\\
No & 1355 & 603 & 192 & 224 & 2374\\
Total & 1379 & 638 & 213 & 254 & 2484\\\hline
\end{tabular}
\
\]
Is there an association between snoring frequency and heart disease?\newline%
$\square$

\subsection{Basic ideas}

The first, and main idea, is that we need to use statistics which contain all
of the relevant information about the parameter (or parameters) we are going
to test: in other words we will be looking towards using \emph{sufficient
statistics}. Therefore it is hardly surprising that we usually use the same
statistics as we would in calculating confidence intervals. Let us try to work
out how we might do this by applying common-sense to an example.\bigskip
\newline\textbf{Example 4.3}\quad\emph{Shoshoni bead rectangles\medskip
}\newline We want to test whether the Shoshoni instinctively made their
rectangles conform to the golden ratio. That is we want to test%
\[
H_{0}:\theta=0.618\quad\text{against\quad}H_{1}:\theta\neq0.618\mathrm{.}%
\]
Let us start by assuming the data are normally distributed (we haven't checked
this, but let us proceed anyway) with mean $\theta$ and variance $\sigma^{2}$.%
\[
X_{i}\sim N(\mu,\sigma^{2})\quad\Rightarrow\quad\overline{X}\sim N(\mu
,\frac{\sigma^{2}}{n})\quad\Rightarrow\quad\frac{\sqrt{n}(\overline{X}-\mu
)}{\sigma}\sim N(0,1)
\]
\smallskip\ \newline Since we do not know $\sigma^{2}$ we use the t-statistic,
\smallskip\ \newline%
\[
\frac{\sqrt{n}(\overline{X}-\mu)}{S}\sim t\left(  n-1\right)  .
\]
\smallskip\ \newline We have 20 measurements so, under the null hypothesis
$\theta=0.618$ gives \smallskip\ \newline%
\[
\frac{\sqrt{20}(\overline{X}-0.618)}{S}\sim t\left(  19\right)  ,
\]
where $S^{2}=\frac{1}{20}%
%TCIMACRO{\dsum \limits_{i=1}^{20}}%
%BeginExpansion
{\displaystyle\sum\limits_{i=1}^{20}}
%EndExpansion
(X_{i}-\overline{X})^{2}$.\medskip\newline For these data, $\overline
{x}=0.660$, $s=0.093$. Let us look for some evidence which might support the
null hypothesis.\medskip\newline Look at the graph of the $t$-statistic with
$19$ degrees of freedom.%
%TCIMACRO{\FRAME{dhFU}{2.9421in}{2.1983in}{0pt}{\Qcb{\QTR{bf}{Figure 4.2}\quad
%Graph of \QTR{it}{t}(19) p.d.f.}}{}{a5hypo_f2.eps}%
%{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 2.9421in;  height 2.1983in;  depth 0pt;  original-width 3.8847in;
%original-height 2.8954in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'a5hypo_f2.eps';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=2.1983in,
width=2.9421in
]%
{a5hypo_f2.eps}%
\\
\textbf{Figure 4.2}\quad Graph of \textit{t}(19) p.d.f.
\end{center}
%EndExpansion
Suppose we place the observed value of the above $t$-statistic on the graph.
Where should it be? The observed value of $T$ is%
\[
\frac{\sqrt{20}(\overline{x}-0.618)}{s}=\frac{\sqrt{20}(0.660-0.618)}%
{0.093}=2.019
\]
The $t$-distribution is symmetric and the observed value is to the right.
Under the assumption that the null hypothesis holds as above, we can calculate
the probability that a measurement of $T$ gives a value at least as extreme as
the observed value. Because the alternative hypothesis is \textit{2-sided
}this means calculating the following probability
\[
P(\left\vert T\right\vert \geq2.019)=0.058\text{.}%
\]
This says that (for a $t\left(  19\right)  $ distribution)\textit{\ the
probability of a measurement of }$T$\textit{\ being at least as far into the
tails as the observed value is }$0.058$. We write $p=0.058,$ and refer to $p$
as the $p$\textit{-value }or\textit{\ significance level} of the test. It
tells us how far into the tails of the distribution our observed value of the
test statistic $T$ lies under the null hypothesis; in this case $H_{0}%
:\theta=0.618$. \textit{A small p-value gives grounds for rejecting the null
hypothesis in favour of the alternative. }However $p=0.058$ (interpreted as a
roughly $1$ in $17$ chance) is not particularly small. There is some evidence
for rejecting the null hypothesis, but the case for it is very weak.\newline%
$\blacksquare$\bigskip\newline\textbf{Example 4.4}\medskip\quad\emph{Patients
with glaucoma in one eye}

\noindent Here is Table 4.1 again, and we ask \textquotedblleft Is there a
difference in corneal thickness between the eyes?\textquotedblright%

\[%
\begin{tabular}
[c]{cccc}%
\multicolumn{4}{l}{\textbf{Table 4.1} \ Glaucoma in one eye}\\\cline{1-3}%
\multicolumn{2}{c}{Corneal thickness} &  & \\\cline{1-3}%
Glaucoma & Normal & Difference & \\\cline{1-3}%
488 & 484 & \multicolumn{1}{r}{$4\quad$} & \\
478 & 478 & \multicolumn{1}{r}{$0\quad$} & \\
480 & 492 & \multicolumn{1}{r}{$-12\quad$} & \\
426 & 444 & \multicolumn{1}{r}{$-18\quad$} & \\
440 & 436 & \multicolumn{1}{r}{$4\quad$} & \\
410 & 398 & \multicolumn{1}{r}{$12\quad$} & \\
458 & 464 & \multicolumn{1}{r}{$-6\quad$} & \\
460 & 476 & \multicolumn{1}{r}{$-16\quad$} & \\\cline{1-3}%
\end{tabular}
\
\]
\medskip\ Formally we are testing the difference $\theta$ between the corneal
thicknesses.%
\[
H_{0}:\theta=0\quad\text{against\quad}H_{1}:\theta\neq0\mathrm{.}%
\]
\medskip\ 

\noindent Assuming the data to be normally distributed (for the sake of this
example), the mean difference is $\overline{x}=-4$ and the estimated standard
deviation is $s=10.744$. Under $H_{0}$ we obtain a \emph{t}-statistic of
\[
t=\sqrt{n}\frac{\overline{x}}{s}=\frac{-4\sqrt{8}}{10.744}=-1.053.
\]
The \emph{t}-statistic has 7 degrees of freedom for a \emph{p}-value of 0.327.

\noindent We cannot reject the null hypothesis of no difference in corneal
thickness.%
%TCIMACRO{\FRAME{dhFU}{3.1687in}{2.0928in}{0pt}{\Qcb{\QTR{bf}{Figure
%4.3\noindent}\quad Graph of $t$(7) p.d.f.}}{}{a5hypo_f3.eps}%
%{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 3.1687in;  height 2.0928in;  depth 0pt;  original-width 4.4858in;
%original-height 2.9499in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'a5hypo_f3.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=2.0928in,
width=3.1687in
]%
{a5hypo_f3.eps}%
\\
\textbf{Figure 4.3\noindent}\quad Graph of $t$(7) p.d.f.
\end{center}
%EndExpansion
$\blacksquare\bigskip$\newline\textbf{The }$p$\textbf{-value is different
under different alternative hypotheses.\medskip\ }\smallskip\ \newline In
Example 4.4 above the natural alternative hypothesis is $H_{1}:\theta\neq0.$
However it is possible that we may believe that glaucoma can only reduce
corneal thickness, and that no other outcome is possible. In such a case the
alternative hypothesis would be $H_{1}:\theta<0.$ Does this affect the
\textit{p-}value?\medskip\newline In such a case the tail of interest in the
$t$-distribution would be the \textit{lower tail}. For the one-sided
alternative the upper tail no longer provides evidence against the
null-hypothesis, so the $p$-value becomes
\[
p=P(T<-1.053)=0.1635.\text{ }%
\]
In this example even in the case of the alternative hypothesis $H_{1}%
:\theta<0$ there is no strong evidence to suggest that the null hypothesis is
false. Whatever the alternative, we have no grounds to reject the hypothesis
of no difference in the corneal thickness.\bigskip\newline\textbf{Definition
4.1\quad}\emph{Hypothesis test\medskip\newline}A \emph{hypothesis test} is
conducted using a test statistic whose distribution is known under the null
hypothesis $H_{0}$ , and is used to consider the likely truth of the null
hypothesis as opposed to a stated alternative hypothesis $H_{1}$%
.\smallskip\newline$\square\bigskip$\newline\textbf{Definition 4.2\quad}%
$p$\textit{-value}\textbf{\medskip}\newline The $p$\textit{-value} (or
\emph{significance level} or \emph{size}) is the probability of the test
statistic taking a value, in the light of the alternative hypothesis, at least
as extreme as its observed value. It is calculated under the assumption that
the test statistic has the distribution which it would have if the null
hypothesis were true.\smallskip\ \newline If the alternative hypothesis is
two-sided it will usually be the case that extreme values occur in two
disjoint regions, referring to two tails of the distribution under the null
hypothesis.\smallskip\newline$\square$

\subsection{Testing Normally distributed samples}

The considerations of whether Shoshoni bead rectangles had proportions which
conformed with the golden ratio and whether glaucoma has an effect on corneal
thickness were each an example of a $t$-test, which is defined below.\bigskip
\newline\textbf{Definition 4.3\quad}$t$\emph{-test}\textbf{\medskip}\newline A
$t$\emph{-test} is used for observations, independently drawn from a normal
distribution $N(\mu,\sigma^{2})$ with unknown parameters. Given the sample
mean $\overline{X}$ and the sample variance $S^{2}$, the test statistic is
\[
T=\frac{\sqrt{n}(\overline{X}-\mu_{0})}{S}\sim t\left(  n-1\right)
\]
under the null hypothesis $H_{0}:\mu=\mu_{0}.$\newline$\square$\newpage

\noindent\textbf{Definition 4.4\quad}$Z$\emph{-test\medskip\newline}For
observations drawn from a normal distribution $N(\mu,\sigma^{2})$, but with
$\sigma^{2}$ known, we use a $Z$-test of $H_{0}:\mu=\mu_{0}$ with test
statistic
\[
Z=\frac{\sqrt{n}(\overline{X}-\mu_{0})}{\sigma}\sim N(0,1)
\]
under $H_{0}$.\newline$\square$\bigskip\newline\textbf{Definition 4.5\quad
}\emph{Paired }$t$\emph{-test\medskip}\newline Suppose that we have pairs of
random variables $\left(  X_{i},Y_{i}\right)  $ and that $D_{i}=X_{i}-Y_{i}$ ,
$i=1,\ldots\,,\,n,$ is a random sample from a normal distribution
$N(\mu,\sigma^{2})$ with unknown parameters. We use the test statistic
\[
\frac{\surd n(\overline{D}-\mu_{0})}{S_{D}}\sim t\left(  n-1\right)
\]
under the null hypothesis $H_{0}:\mu=\mu_{0}.$ Here $S_{D}^{2}$ is the sample
variance of the differences $D_{i}$.\newline$\square\bigskip$ \smallskip
\ \newline\textbf{Example 4.4 }(revisited)\quad\emph{Patients with glaucoma in
one eye}\smallskip\medskip\newline You have already seen how this operates by
forming a single sample from the differences in corneal thickness between
Glaucomatous and Normal eyes. Then the sample of differences is tested for
zero mean. Note, however, that the differences need to be normally
distributed, a point we rather glossed over earlier. We can check the validity
of this assumption with a Normal probability plot.%
%TCIMACRO{\FRAME{dhFU}{4.2756in}{3.3018in}{0pt}{\Qcb{\QTR{bf}{Figure 4.4}\quad
%Normal probability plot of differences for glaucoma data}}{}{a5hypo_f4.eps}%
%{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 4.2756in;  height 3.3018in;  depth 0pt;  original-width 7.7236in;
%original-height 5.9525in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'a5hypo_f4.eps';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=3.3018in,
width=4.2756in
]%
{a5hypo_f4.eps}%
\\
\textbf{Figure 4.4}\quad Normal probability plot of differences for glaucoma
data
\end{center}
%EndExpansion
\bigskip It's a bit rough, but it could be worse.\newline$\blacksquare
\bigskip$\newline One particularly important use of a $t$-statistic occurs
when we have two samples and we wish to compare the means under the assumption
of each sample having the same unknown variance.\bigskip\newline%
\textbf{Definition 4.6\quad}\emph{The two-sample }$t$\emph{-test\medskip
}\newline Consider two random samples $X_{1},\ldots,X_{m}$ and $Y_{1}%
,\ldots\,,Y_{n}$ which are independent, normally distributed with the same
variance. The null hypothesis is $H_{0}:\mu_{X}=\mu_{Y}$. Under $H_{0}$ we can
construct a test statistic $T$ such that
\[
T\sim t\left(  m+n-2\right)  .
\]
For the two-sample test, $T$ is constructed under $H_{0}$ as
follows.\smallskip\ \newline\emph{Step 1}:\quad Under $H_{0}$,
\[
\overline{X}-\overline{Y}\sim N\left(  0,\sigma^{2}\left(  \frac{1}{m}%
+\frac{1}{n}\right)  \right)  ,\text{ where }\sigma^{2}\text{ is the common
variance.}%
\]
\emph{Step 2}:
\[
\frac{(m-1)S_{X}^{2}}{\sigma^{2}}\sim\chi^{2}(m-1),\quad\frac{(n-1)S_{Y}^{2}%
}{\sigma^{2}}\sim\chi^{2}(n-1)
\]%
\[
\Longrightarrow\quad\frac{(m-1)S_{X}^{2}+(n-1)S_{Y}^{2}}{\sigma^{2}}\sim
\chi^{2}(m+n-2)
\]
\emph{Step 3}:\quad Thus, writing%
\[
S^{2}=\frac{(m-1)S_{X}^{2}+(n-1)S_{Y}^{2}}{m+n-2},
\]
we obtain%
\[
T=\frac{\overline{X}-\overline{Y}}{S\sqrt{\left(  \dfrac{1}{m}+\dfrac{1}%
{n}\right)  }}\;\sim t\left(  m+n-2\right)  ,
\]
under the null hypothesis, $H_{0}$.\newline$\square$\newpage

\noindent\textbf{Example 4.5\quad}\emph{Etruscan and Italian skull widths}%

\[%
\begin{tabular}
[c]{cccccccccccccc}%
\multicolumn{14}{l}{\textbf{Table 4.3}\quad Ancient Etruscan and modern
Italian skull widths}\\\hline
\multicolumn{7}{c}{Ancient Etruscan skulls} &  & \multicolumn{6}{c}{Modern
Italian skulls}\\\cline{1-7}\cline{9-14}%
141 & 147 & 126 & 140 & 141 & 150 & 142 &  & 133 & 124 & 129 & 139 & 144 &
140\\
148 & 148 & 140 & 146 & 149 & 132 & 137 &  & 138 & 132 & 125 & 132 & 137 &
130\\
132 & 144 & 144 & 142 & 148 & 142 & 134 &  & 130 & 132 & 136 & 130 & 140 &
137\\
138 & 150 & 142 & 137 & 135 & 142 & 144 &  & 138 & 125 & 131 & 132 & 136 &
134\\
154 & 149 & 141 & 148 & 148 & 143 & 146 &  & 134 & 139 & 132 & 128 & 135 &
130\\
142 & 145 & 140 & 154 & 152 & 153 & 147 &  & 127 & 127 & 127 & 139 & 126 &
148\\
150 & 149 & 145 & 137 & 143 & 149 & 140 &  & 128 & 133 & 129 & 135 & 139 &
135\\
146 & 158 & 135 & 139 & 144 & 146 & 142 &  & 138 & 136 & 132 & 133 & 131 &
138\\
155 & 143 & 147 & 143 & 141 & 149 & 140 &  & 136 & 121 & 116 & 128 & 133 &
135\\
158 & 141 & 146 & 140 & 143 & 138 & 137 &  & 131 & 131 & 134 & 130 & 138 &
138\\
150 & 144 & 141 & 131 & 147 & 142 & 152 &  & 126 & 125 & 125 & 130 & 133 & \\
140 & 144 & 136 & 143 & 146 & 149 & 145 &  & 120 & 130 & 128 & 143 & 137 &
\\\hline
\end{tabular}
\]
The width measurements are taken with the aim of comparing modern day Italians
with ancient Etruscans. The null hypothesis is therefore that the mean skull
width is the same. In what follows $X$ refers to Ancient Etruscan measurements
and $Y$ refers to Modern Italian.\newline%
\[
\overline{x}-\overline{y}=11.33,\;m=84,\;n=70.
\]
\newline Using the formula in Definition 4.6 above, the value of the test
statistic turns out to be $11.92.$ As we are just asking \textquotedblleft%
\textit{is there a difference?\textquotedblright}, we need a 2-sided
alternative hypothesis, and so we test against a $t\left(  152\right)  $
distribution and obtain
\[
P(\left\vert T\right\vert \geq11.92)=0.0000.
\]
The test provides overwhelming evidence to suggest that the two populations
are ancestrally of different origin. Of course, we need to verify the
plausibility of the data being normally distributed. This is easily done by
calculating $X_{i}-\overline{X}$ for $i=1,\ldots,m$ and $Y_{i}-\overline{Y}$
for $i=1,\ldots,n$ (so that both samples now have the same mean, namely zero)
and combining the whole lot into a single sample: then just look at a normal
probability plot. Figure 4.5 shows such a plot for the skulls data, which look
convincingly normal.%
%TCIMACRO{\FRAME{dhFU}{4.6622in}{3.6002in}{0pt}{\Qcb{\QTR{bf}{Figure 4.5}\quad
%Normal probability plot for skulls data}}{}{a5hypo_f5.eps}%
%{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 4.6622in;  height 3.6002in;  depth 0pt;  original-width 7.7236in;
%original-height 5.9525in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'a5hypo_f5.eps';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=3.6002in,
width=4.6622in
]%
{a5hypo_f5.eps}%
\\
\textbf{Figure 4.5}\quad Normal probability plot for skulls data
\end{center}
%EndExpansion
Note that
\[
P\left(  -t_{\alpha/2}\left(  m+n-2\right)  <\frac{\overline{X}-\overline
{Y}-\left(  \mu_{X}-\mu_{Y}\right)  }{S\sqrt{\left(  \dfrac{1}{m}+\dfrac{1}%
{n}\right)  }}<t_{\alpha/2}\left(  m+n-2\right)  \right)  \;=1-\alpha
\]
the confidence interval for $\mu_{X}-\mu_{Y}$ at the 95\% level is given by%
\[
\left(  \left(  \overline{X}-\overline{Y}\right)  -St_{\alpha/2}\left(
m+n-2\right)  \sqrt{\left(  \dfrac{1}{m}+\dfrac{1}{n}\right)  },\left(
\overline{X}-\overline{Y}\right)  +St_{\alpha/2}\left(  m+n-2\right)
\sqrt{\left(  \dfrac{1}{m}+\dfrac{1}{n}\right)  }\right)  .
\]
For the skull data this works out to be $(9.45,13.21)$.\smallskip\ Note that
we have a $p$-value less than 0.05 and the 95\% confidence interval does not
contain 0, the value of $\mu_{X}-\mu_{Y}$ under the null hypothesis. This is
not a coincidence - there is a link here.\newline$\blacksquare$\newpage

\subsection{Hypothesis testing and confidence intervals\smallskip}

The connection here can best be illustrated with an example. Basically when
considering random samples with mean $\mu$ and null hypothesis $\mu=\mu_{0},$
\textit{a p-value of less than }$\alpha$ is \textit{equivalent} \textit{to the
appropriate confidence interval at the }$(1-\alpha)100\%$\textit{\ \thinspace
level not containing }$\mu_{0}$.\bigskip\newline\textbf{Example 4.6}%
\quad\emph{Normal distribution\medskip}\newline Suppose that we have a normal
random sample of size $n$ with sample mean $\overline{X}$ and sample variance
$S^{2}$, and suppose also that the alternative hypothesis is\textit{\ 2-sided}%
$.$ We can either (i) test for the mean $\mu=\mu_{0}$ using a $t$-test and
calculate a $p$-value; or (ii) construct a \textit{central} confidence
interval for the mean and see whether or not it contains $\mu_{0}$. We use a
central interval because the test is two-sided.\newline

\begin{enumerate}
\item[(i)] Carry out a $t$-test,
\[
T=\frac{\sqrt{n}(\overline{X}-\mu_{0})}{S}\sim t\left(  n-1\right)  ,\text{
under }H_{0}:\mu=\mu_{0}.
\]
Let's suppose that it has observed value $t_{0}$ and corresponding $p$-value
of $p<\alpha.$ Then
\[
P(\left\vert T\right\vert \geq\left\vert t_{0}\right\vert )=p.
\]


\item[(ii)] Construct a $(1-\alpha)100\%$ confidence interval. Here remember
we make no assumptions about $\mu.$ Given that $X_{i}$ has a normal
distribution $N\mathbf{(}\mu,\sigma^{2})$ then $\dfrac{\sqrt{n}(\overline
{X}-\mu)}{S}$ has a $t\left(  n-1\right)  \ $distribution. Choose $t(>0)$ such
that
\[
P(\left\vert \frac{\sqrt{n}(\overline{X}-\mu)}{S}\right\vert \geq t)=\alpha.
\]
Then the observed confidence interval for $\mu$ is
\[
\left(  \overline{x}-t\frac{s}{\sqrt{n}},\overline{x}+t\frac{s}{\sqrt{n}%
}\right)
\]
where $\overline{x},s$ are the observed values of $\overline{X},S$. \newline
We must have
\[
t_{0}=\frac{\sqrt{n}(\overline{x}-\mu_{0})}{s}%
\]
as $t_{0}$ is the observed value of the $t$-statistic. Since $p<\alpha$ we
know
\[
\left\vert t_{0}\right\vert >t\quad\Leftrightarrow\quad t_{0}\notin
(-t,t)\quad\Leftrightarrow\quad\mu_{0}=\overline{x}+t_{0}\frac{s}{\sqrt{n}%
}\notin\left(  \overline{x}-t\frac{s}{\sqrt{n}},\overline{x}+t\frac{s}%
{\sqrt{n}}\right)  .
\]
Hence we can see that there is an equivalence between the test and the
interval.\newline$\blacksquare\medskip$
\end{enumerate}

\noindent In each of the following we can construct a test statistic for
$H_{0}:\mu=\mu_{0}$ or construct a confidence interval for $\mu.$

\begin{description}
\item
\begin{enumerate}
\item[(a)] Basic $t$-test:\quad%
\[
\dfrac{\sqrt{n}(\overline{X}-\mu)}{S}\sim t\left(  n-1\right)  .
\]


\item[(b)] Paired $t$-test:\quad$D_{i}=X_{i}-Y_{i},\quad S^{2}=\dfrac{1}%
{n-1}\sum\left(  D_{i}-\overline{D}\right)  ^{2}$%
\[
\dfrac{\sqrt{n}(\overline{D}-\mu)}{S}\;\medskip\sim t\left(  n-1\right)  .
\]


\item[(c)] Two-sample $t$-test, equal variance:$\quad S^{2}=\dfrac
{(m-1)S_{X}^{2}+(n-1)S_{Y}^{2}}{m+n-2}$\quad\
\[
\frac{\overline{X}-\overline{Y}-\left(  \mu_{X}-\mu_{Y}\right)  }%
{S\sqrt{\left(  \dfrac{1}{m}+\dfrac{1}{n}\right)  }}\sim t\left(
m+n-2\right)
\]
\newline
\end{enumerate}
\end{description}

For all of these test statistics we have, for each $H_{1}$,%
\[%
\begin{array}
[c]{lll}%
\text{2-tailed} & \text{upper tailed} & \text{lower tailed}\\
\mu\neq\mu_{0} & \mu>\mu_{0} & \mu<\mu_{0}%
\end{array}
\]
\smallskip\ \newline

\subsection{The magic 5\% significance level (or $p$-value of 0.05)}

The question arises in each example considered so far: \textit{what is the
critical level for the }$p$-\textit{value? Is there some generally accepted
level at which null hypotheses are automatically rejected?} Alas, the
literature is filled with what purports to be the definitive answer to this
question, which is so misleading and ridiculous that it needs special
mention.\medskip\newline A significance level of $p<0.05$ is often taken to be
of interest, because it is below the \textquotedblleft magic\textquotedblright%
\ level of 0.05\textbf{.} For example suppose that we had tested a new drug
(new drug versus standard drug), which under the null hypothesis of no
difference between the two drugs, gave $p=0.04.$ This says that the apparent
difference between the two drugs being due to chance is less than 1 in 20. The
$p$-value of 0.05 is the watershed used by the American control board (the
FDA, which stands for Food and Drugs Administration) which licences new drugs
from pharmaceutical companies. As a result it has been almost universally
accepted right across the board in all walks of life.\smallskip\ \newline
However this level can be, to say the least, inappropriate and possibly even
catastrophic. Suppose, for example, we were considering test data for safety
critical software for a nuclear power station, $N$ representing the number of
faults detected in the first 10 years. Would we be happy with a $p$-value on
trials which suggests that
\[
P(N\geq1)=0.05?
\]
We might be more comfortable if $p=0.0001,$ but even then, given the number of
power stations (over 1000 in Europe alone) we would be justified in worrying.
The significance level which should be used in deciding whether or not to
reject a null hypothesis ought to depend entirely on the question being asked;
it quite properly should depend upon the consequences of being
wrong.\smallskip\ At the very least we should qualify our rejection with
something like the following.%
\[%
\begin{tabular}
[c]{ll}%
$0.05<p\leq0.06$ & \textquotedblleft Weak evidence for
rejection\textquotedblright\\
$0.03<p\leq0.05$ & \textquotedblleft Reasonable evidence for
rejection\textquotedblright\\
$0.01<p\leq0.03$ & \textquotedblleft Good evidence for
rejection\textquotedblright\\
$0.005<p\leq0.01$ & \textquotedblleft Strong evidence for
rejection\textquotedblright\\
$0.001<p\leq0.005$ & \textquotedblleft Very strong evidence for
rejection\textquotedblright\\
$0.0005<p\leq0.001$ & \textquotedblleft Extremely strong evidence for
rejection\textquotedblright\\
$p\leq0.0005$ & \textquotedblleft Overwhelming evidence for
rejection\textquotedblright%
\end{tabular}
\]


\subsection{The critical region}

\noindent Suppose we have data $\mathbf{x}=x_{1},x_{2},\ldots,x_{n}%
,\ x\in\mathbb{R}_{x}$, which constitute evidence about the truth or falsehood
of a null hypothesis $H_{0}$. Suppose further that we have decided to
formulate our test as a decision rule by electing a \emph{p}-value in advance,
say $\alpha$, and rejecting the null hypothesis in situations where the data
lead to a \emph{p}-value less than or equal to $\alpha$. In such circumstances
we can decide, in advance, on a region $C_{1}\subset\mathbb{R}_{x}$ such that
$H_{0}$ is rejected if $\mathbf{x}\in C_{1}$. Should $\mathbf{x}\in C_{0}$,
the complement of $C_{1}$, $H_{0}$ is not rejected.\medskip

\noindent$C_{1}$ is called the \emph{critical region} of the test and $\alpha$
is called the \emph{significance level}.\medskip

\noindent Note that $\alpha$ is the probability of rejection of $H_{0}$ given
that it is true. In other words
\[
P(\mathbf{x}\in C_{1}\mid H_{0})=\alpha.
\]
\noindent\textbf{Example 4.4 }(revisited)\quad\emph{Patients with glaucoma in
one eye}\smallskip\medskip\newline

The significance level is set at 0.05 and $H_{0}$ is rejected if $t\leq-2.365$
or $t\geq2.365$. Here $t=-1.053$ and the null hypothesis is not rejected.%
%TCIMACRO{\FRAME{dhFU}{3.1687in}{2.073in}{0pt}{\Qcb{\QTR{bf}{Figure 4.6} The
%critical region}}{}{a5hypo_f6.eps}{\special{ language "Scientific Word";
%type "GRAPHIC";  maintain-aspect-ratio TRUE;  display "USEDEF";
%valid_file "F";  width 3.1687in;  height 2.073in;  depth 0pt;
%original-width 4.4858in;  original-height 2.9222in;  cropleft "0";
%croptop "1";  cropright "1";  cropbottom "0";
%filename 'a5hypo_f6.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=2.073in,
width=3.1687in
]%
{a5hypo_f6.eps}%
\\
\textbf{Figure 4.6} The critical region
\end{center}
%EndExpansion
$\blacksquare$

\subsection{\noindent Errors in hypothesis testing}

\noindent There are two types of possible error.

\noindent A \emph{Type I error} is the error of rejecting the null hypothesis
when it is, in fact, true.

\noindent A \emph{Type II error} is the error of not rejecting the null
hypothesis when it is, in fact, false.
\[%
\begin{tabular}
[c]{c|cc}
& $H_{0}~$not$~$rejected & $H_{0}~$rejected\\\hline
$H_{0}~$true & no$~$error & Type$~$I$~$error\\
$H_{0}~$false & Type$~$II$~$error & no$~$error
\end{tabular}
\
\]
Thus
\[%
\begin{array}
[c]{rcl}%
P(\text{Type~I~error)} & = & P(x\in C_{1}\mid H_{0})=\alpha\\
P(\text{Type~II~error)} & = & P(x\in C_{0}\mid H_{1})=\beta.
\end{array}
\]
The probability that $H_{0}$ is correctly rejected, $P(x\in C_{1}\mid
H_{1})=1-\beta$ is called the \emph{power} of the test.\bigskip

\noindent\textbf{Example 4.7 }\medskip\emph{Do air bags save lives?}

\noindent Suppose that deaths in crashes involving a particular make of car
have been at an average rate of 6 per week and that the company has introduced
air bags. They want to use the figures over the next year (\emph{i.e.} 52
weeks) to test their effectiveness. Assume the data are from a Poisson
distribution with mean $\mu$. The company plans to test
\[
H_{0}:\mu=6\quad\text{against}\mathrm{\quad}H_{1}:\mu<6\mathrm{,}%
\]
using a significance level of 0.05.
\[
Y=\sum_{i=1}^{52}X_{i}\sim Poisson(52\mu)
\]
and we use a critical region of the form
\[
C_{1}=\left\{  y:y\leq k\right\}  .
\]
Now the distribution of $Y$ may be approximated by $N(52\mu,52\mu)$ or, under
$H_{0}$, $N(312,312).$%
\[%
\begin{array}
[c]{rcl}%
0.05 & = & P(Y\leq k)\\
& \simeq & P\left(  Z\leq\dfrac{k-312}{\sqrt{312}}\right)
\end{array}
\]
where $Z\sim N(0,1)$, so that
\[
\frac{k-312}{\sqrt{312}}\simeq-1.645
\]
giving $k=283$ to the nearest integer.

\noindent The power of the test is $P(Y\leq283)$ where $Y\sim Poisson(52\mu)$.
Thus
\[
\text{Power}\mathrm{~}\simeq P\left(  Z\leq\frac{283-52\mu}{\sqrt{52\mu}%
}\right)  =\Phi\left(  \frac{283-52\mu}{\sqrt{52\mu}}\right)  .
\]
Note that at $\mu=6$ the power has value 0.05 and the power increases as $\mu$
decreases, approaching 1 as $\mu$ approaches 0.%
%TCIMACRO{\FRAME{dhFU}{3.2846in}{2.0643in}{0pt}{\Qcb{\QTR{bf}{Figure 4.7} The
%power function}}{}{a5hypo_f7.eps}{\special{ language "Scientific Word";
%type "GRAPHIC";  maintain-aspect-ratio TRUE;  display "USEDEF";
%valid_file "F";  width 3.2846in;  height 2.0643in;  depth 0pt;
%original-width 4.6518in;  original-height 2.9101in;  cropleft "0";
%croptop "1";  cropright "1";  cropbottom "0";
%filename 'a5hypo_f7.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=2.0643in,
width=3.2846in
]%
{a5hypo_f7.eps}%
\\
\textbf{Figure 4.7} The power function
\end{center}
%EndExpansion
$\blacksquare$

\subsection{The Neyman-Pearson Lemma}%

%TCIMACRO{\FRAME{dhFU}{1.3872in}{2.1776in}{0pt}{\Qcb{Jerzy Neyman (1894 -
%1981)}}{}{neyman.gif}{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 1.3872in;  height 2.1776in;  depth 0pt;  original-width 4.5316in;
%original-height 7.1667in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'neyman.gif';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
natheight=7.166700in,
natwidth=4.531600in,
height=2.1776in,
width=1.3872in
]%
{neyman.gif}%
\\
Jerzy Neyman (1894 - 1981)
\end{center}
%EndExpansion
\noindent\textbf{Lemma\medskip\ 4.1\quad}\emph{The Neyman-Pearson Lemma}

\noindent Let $\mathbf{X}=X_{1},\ldots,X_{n}$ be a random sample from a
distribution with parameter $\theta$, where $\theta\in\Theta=\left\{
\theta_{0},\theta_{1}\right\}  $, and let $L(\theta;\mathbf{x})$ be the
likelihood function. If there exists a test at significance level $\alpha$
such that, for some positive constant $k$,

\begin{enumerate}
\item[(i)]
\[
\frac{L(\theta_{0};\mathbf{x})}{L(\theta_{1};\mathbf{x})}\leq k\quad
\text{for~each}~\mathbf{x}\in C_{1}%
\]
and

\item[(ii)]
\[
\frac{L(\theta_{0};\mathbf{x})}{L(\theta_{1};\mathbf{x})}>k\quad
\text{for~each}\mathrm{~}\mathbf{x}\in C_{0}%
\]
then this test is most powerful at significance level $\alpha$ for testing the
null hypothesis $H_{0}:\theta=\theta_{0}$ against the alternative hypothesis
$H_{1}:\theta=\theta_{1}$.\newline
\end{enumerate}

\noindent$\square\bigskip$\newline\textbf{Proof\quad}\noindent The proof is
given for sampling from continuous distributions.\medskip

\noindent Suppose there exists a critical region $C_{1}$ with the properties
in the statement of the lemma. Let $A_{1}$ be the critical region of any other
test at significance level $\alpha$. Then
\[
\int_{C_{1}}f(\mathbf{x}\mathrm{,}\theta_{0})d\mathbf{x}=\int_{A_{1}%
}f(\mathbf{x},\theta_{0})d\mathbf{x}=\alpha,
\]
where $f(\mathbf{x},\theta_{0})$ is the joint p.d.f. of the random sample
$\mathbf{X}$.\medskip

\noindent Now
\[%
\begin{array}
[c]{rcl}%
A_{1}\cup C_{1} & = & A_{1}\cup(C_{1}\cap\overline{A_{1}})\\
& = & C_{1}\cup(A_{1}\cap\overline{C_{1}}).
\end{array}
\]
It follows therefore that
\[%
\begin{array}
[c]{l}%
\int_{A_{1}}f(\mathbf{x},\theta_{1})d\mathbf{x}+\int_{C_{1}\cap\overline
{A_{1}}}f(\mathbf{x},\theta_{1})d\mathbf{x}\\
\\
=\int_{C_{1}}f(\mathbf{x},\theta_{1})d\mathbf{x}+\int_{A_{1}\cap
\overline{C_{1}}}f(\mathbf{x},\theta_{1})d\mathbf{x}%
\end{array}
\]
or
\[%
\begin{array}
[c]{l}%
\int_{C_{1}}f(\mathbf{x},\theta_{1})d\mathbf{x}-\int_{A_{1}}f(\mathbf{x}%
,\theta_{1})d\mathbf{x}\\
\\
=\int_{C_{1}\cap\overline{A_{1}}}f(\mathbf{x},\theta_{1})d\mathbf{x}%
-\int_{A_{1}\cap\overline{C_{1}}}f(\mathbf{x},\theta_{1})d\mathbf{x}%
\end{array}
\]
Now, by property (i), $f(\mathbf{x},\theta_{1})\geq\frac{1}{k}f(\mathbf{x}%
,\theta_{0})$ for each point of $C_{1}$ and hence for each point of $C_{1}%
\cap\overline{A_{1}}$. Furthermore, by property (ii), $f(\mathbf{x},\theta
_{1})<\frac{1}{k}f(\mathbf{x},\theta_{0})$ for each point of $\overline{C_{1}%
}$ and hence for each point of $A_{1}\cap\overline{C_{1}}$. Therefore
\[
\int_{C_{1}\cap\overline{A_{1}}}f(\mathbf{x},\theta_{1})d\mathbf{x}\geq
\frac{1}{k}\int_{C_{1}\cap\overline{A_{1}}}f(\mathbf{x},\theta_{0})d\mathbf{x}%
\]
and
\[
\int_{A_{1}\cap\overline{C_{1}}}f(\mathbf{x},\theta_{1})d\mathbf{x}<\frac
{1}{k}\int_{A_{1}\cap\overline{C_{1}}}f(\mathbf{x},\theta_{0})d\mathbf{x}.
\]
Substituting we obtain
\[%
\begin{array}
[c]{l}%
\int_{C_{1}}f(\mathbf{x},\theta_{1})d\mathbf{x}-\int_{A_{1}}f(\mathbf{x}%
,\theta_{1})d\mathbf{x}\\
\\
\geq\dfrac{1}{k}\left(  \int_{C_{1}\cap\overline{A_{1}}}f(\mathbf{x}%
,\theta_{0})d\mathbf{x}-\int_{A_{1}\cap\overline{C_{1}}}f(\mathbf{x}%
,\theta_{0})d\mathbf{x}\right) \\
\\
=\dfrac{1}{k}\left(  \int_{C_{1}}f(\mathbf{x},\theta_{0})d\mathbf{x}%
-\int_{A_{1}}f(\mathbf{x},\theta_{0})d\mathbf{x}\right)  =0
\end{array}
\]
which is what we set out to prove.\newline$\blacksquare\bigskip$%
\newline\noindent\textbf{Example 4.8}\quad\emph{Insect traps}\medskip
\ \newline\noindent Gilchrist (1984) refers to an experiment in which a total
of 33 insect traps were set out across sand dunes and the numbers of insects
caught in a fixed time were counted. The table gives the number of traps
containing various numbers of the taxa \emph{Staphylinoidea}.
\[%
\begin{tabular}
[c]{lrrrrrrrr}%
Count & 0 & 1 & 2 & 3 & 4 & 5 & 6 & $\geq7$\\
Frequency & 10 & 9 & 5 & 5 & 1 & 2 & 1 & 0
\end{tabular}
\
\]
\noindent Assuming the data to come from a Poisson distribution with mean
$\mu$, we wish to test the null hypothesis $H_{0}:\mu=\mu_{0}=1$ against the
alternative $H_{1}:\mu=\mu_{1}>1.$\medskip\ \newline The likelihood is
\[
L(\mu;\mathbf{x})=\frac{e^{-n\mu}\mu^{\sum x_{i}}}{\prod x_{i}!}%
\]
so the Neyman-Pearson Lemma gives
\[
\frac{e^{-n\mu_{0}}\mu_{0}^{\sum x_{i}}}{\prod x_{i}!}\left/  \frac
{e^{-n\mu_{1}}\mu_{1}^{\sum x_{i}}}{\prod x_{i}!}\right.  \leq k
\]
or
\[
\frac{e^{-n\mu_{0}}\mu_{0}^{\sum x_{i}}}{e^{-n\mu_{1}}\mu_{1}^{\sum x_{i}}%
}\leq k.
\]
Taking logs of both sides
\[
-n\mu_{0}+n\mu_{1}+\left(  \log\mu_{0}-\log\mu_{1}\right)  \sum x_{i}\leq\log
k
\]
and, rearranging,
\[
\left(  \log\mu_{0}-\log\mu_{1}\right)  \sum x_{i}\leq\log k+n\mu_{0}-n\mu
_{1}.
\]
Since $\mu_{1}>\mu_{0}$, we obtain from the Neyman-Pearson Lemma a best
critical region of the form
\[
\sum x_{i}\geq C.
\]
$\sum X_{i}\sim Poisson(33\mu)$, so, under $H_{0}$, $\sum X_{i}\sim
Poisson(33).$\medskip\ \newline In fact, the total number of insects counted
was 54 and
\[
P\left(  \sum X_{i}\geq54\mid\mu_{0}=1\right)  =0.000487.
\]
This is strong evidence for rejection.\medskip\ \newline Note that the
observed mean is $54\left/  33\right.  =1.64$, which does not appear to be all
that far from 1, but appearances can be deceptive.\newline$\blacksquare
$\bigskip\newline\textbf{Example 4.9}\quad\emph{Teenagers with
anorexia\medskip}\newline An experiment in the treatment of anorexia by
cognitive behavioural therapy was carried out on 29 teenage females. Weights
in kilograms before treatment and after 6 weeks of treatment were recorded and
the change in weight of each individual , namely (\emph{Weight after
treatment}$-$\emph{weight before treatment}), was calculated. The mean weight
difference of the sample was 3.007 kg with standard deviation 7.309 kg. We
want to test%
\[
H_{0}:\theta=0\quad\text{against\quad}H_{1}:\theta=\theta_{1}>0\mathrm{.}%
\]
Note that the test is one-sided because we are actually asking the question
\textquotedblleft does the therapy have a beneficial effect?\textquotedblright%
\ We assume that it either results in weight gain or makes no
difference.\medskip\newline Let us look at the question from a Neyman-Pearson
point of view. Start by assuming the data are normally distributed (we haven't
checked this, but let us proceed anyway) with mean $\theta$ and variance
$\sigma^{2}$.%
\[
X_{i}\sim N(\theta,\sigma^{2})\quad\Rightarrow\quad L\left(  \theta,\sigma
^{2};\mathbf{x}\right)  =\left(  2\pi\sigma^{2}\right)  ^{-n/2}\exp-\frac
{1}{2\sigma^{2}}\sum_{i=1}^{n}\left(  x_{i}-\theta\right)  ^{2}.
\]
\smallskip From the Neyman-Pearson lemma, the test has the form%
\[
\frac{\left(  2\pi\sigma^{2}\right)  ^{-n/2}\exp-\frac{1}{2\sigma^{2}}%
\sum_{i=1}^{n}x_{i}^{2}}{\left(  2\pi\sigma^{2}\right)  ^{-n/2}\exp-\frac
{1}{2\sigma^{2}}\sum_{i=1}^{n}\left(  x_{i}-\theta_{1}\right)  ^{2}}\leq k.
\]
Taking logs,%
\[
-\frac{1}{2\sigma^{2}}\sum_{i=1}^{n}\left[  x_{i}^{2}-\left(  x_{i}-\theta
_{1}\right)  ^{2}\right]  \leq\log k
\]
or%
\[
\sum_{i=1}^{n}\left[  x_{i}^{2}-\left(  x_{i}-\theta_{1}\right)  ^{2}\right]
\geq-2\sigma^{2}\log k.
\]
This may be written%
\[
\sum_{i=1}^{n}\theta_{1}\left(  2x_{i}-\theta_{1}\right)  \geq-2\sigma^{2}\log
k
\]
or, since $\theta_{1}>0$,%
\[
\sum_{i=1}^{n}x_{i}\geq\text{ constant}%
\]
or, equivalently,%
\[
\overline{x}\geq\text{ constant.}%
\]
\ \newline Under $H_{0}$ the random variable $\overline{X}\sim N\left(
0,\sigma^{2}/n\right)  $. Since we do not know $\sigma^{2}$ we use the
$t$-statistic, \smallskip\ \newline%
\[
\frac{\sqrt{n}(\overline{X})}{S}\sim t\left(  n-1\right)  .
\]
For a test at the 5\% level of significance, \smallskip the upper 5\% tail of
$t\left(  28\right)  $ is cut off by 1.701, so the critical region is given by%
\[
\overline{x}\geq\frac{1.701s}{\sqrt{n}}=\frac{1.701\times7.309}{\sqrt{29}%
}=2.309.
\]
\newline The observed value of $\overline{x}$ is 3.007 so we reject the null
hypothesis at the 5\% level. Note that the 2\% tail is cut off by 2.154 giving
a critical region of%
\[
\overline{x}\geq2.923
\]
so, with an observed value of 3.007, we can actually reject at the 2\%
level.\newline$\blacksquare\medskip$\newline Notice that we have said
absolutely nothing about the alternative hypothesis in the example above.
Apart from it's being positive, so that the direction of the inequality was
not altered when we divided through by it, it hasn't figured in the
calculation. We shall have more to say about this in the next section.

\subsection{Uniformly most powerful tests}

\noindent We have seen that the Neyman-Pearson test applies to a single point
null hypothesis against a single point alternative. You might think that this
is of no practical use whatsoever because just about all applications involve
\emph{composite} alternatives and even sometimes a \emph{composite} null
hypothesis as well. You saw this with Example 4.8 on insect traps, where the
alternative was a point value of $\mu_{1}>1,$ and with Example 4.9 on
anorexia, where the alternative was $\theta_{1}>0$.\medskip

\noindent But suppose we were to regard a composite alternative hypothesis as
being made up of a set of simple alternatives and we were to test each simple
hypothesis in turn according to the theorem. Could we obtain a \emph{uniformly
most powerful test}?\bigskip\newline\noindent\textbf{Definition 4.6}%
\quad\emph{Uniformly most powerful test}\textbf{\medskip}

\noindent A uniformly most powerful test at significance level $\alpha$ is a
test such that its power function $Q$ satisfies

\begin{enumerate}
\item[(i)] $Q(\theta_{0})=\alpha$;

\item[(ii)] $Q(\theta)$ is at least as large as the power of any other test at
significance level $\alpha$ for each $\theta\in\Theta_{1}$.
\end{enumerate}

\noindent This is illustrated below, where the solid curve represents the
power function of a uniformly most powerful test and the broken curve relates
to any other test at the same significance level.%
%TCIMACRO{\FRAME{dhFU}{2.8625in}{2.2157in}{0pt}{\Qcb{\QTR{bf}{Figure 4.8}\quad
%Power functions}}{}{a5hypo_f8.eps}{\special{ language "Scientific Word";
%type "GRAPHIC";  maintain-aspect-ratio TRUE;  display "USEDEF";
%valid_file "F";  width 2.8625in;  height 2.2157in;  depth 0pt;
%original-width 4.8896in;  original-height 3.7715in;  cropleft "0";
%croptop "1";  cropright "1";  cropbottom "0";
%filename 'a5hypo_f8.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=2.2157in,
width=2.8625in
]%
{a5hypo_f8.eps}%
\\
\textbf{Figure 4.8}\quad Power functions
\end{center}
%EndExpansion


\subsubsection{Tests involving one-sided alternative hypotheses}

\noindent Let us re-examine Example 4.8 involving insect traps. We obtained
the critical region
\[
\sum x_{i}\geq\ \text{constant}%
\]
where, under $H_{0}$, $\sum X_{i}\sim Poisson(33\mu_{0})$. Writing
\[
\psi_{\mu}(k)=\sum_{j=0}^{k}\frac{e^{-\mu}\mu^{j}}{j!}%
\]
\medskip we have a critical region of size $\alpha$%
\[
C_{1}=\left\{  \mathbf{x}:\sum x_{i}\geq k\right\}  ,\quad\alpha=1-\psi
_{\mu_{0}}(k).
\]
The crucial feature is that this critical region \emph{does not depend upon
the value of} $\theta_{1}$.\medskip

\noindent The test is simultaneously most powerful at significance level
$\alpha$ for testing
\[
H_{0}:\mu=\mu_{0}~\text{against}\mathrm{~}H_{1}:\mu=\mu_{0}+\delta
\]
as $\delta$ ranges over $\mathbb{R}^{+}$. In other words the test is for
$H_{0}:\mu=\mu_{0}$ against the composite alternative $H_{1}:\mu>\mu_{0}%
$.\bigskip

\noindent\textbf{Example 4.10}\quad\emph{Uniform distribution}\medskip

\noindent$\mathbf{X}=X_{1},\ldots,X_{n}$ constitute a random sample from
$U(0,\theta)$. Let us construct a test at significance level 0.1 of
$H_{0}:\theta=1$ against the composite alternative $H_{1}:\theta>1.$ We have
\[
L(\theta;x)=\left\{
\begin{array}
[c]{ll}%
\theta^{-n}, & 0<x_{i}<\theta,\quad1\leq i\leq n,\\
0, & \text{otherwise.}%
\end{array}
\right.
\]
The Neyman-Pearson lemma gives
\[
\frac{L(1;\mathbf{x})}{L(\theta_{1};\mathbf{x})}=\left\{
\begin{array}
[c]{ll}%
\theta_{1}^{n}, & 0<x_{(1)},x_{(n)}<1,\\
0, & 0<x_{(1)},\ 1<x_{(n)}<\theta_{1}.
\end{array}
\right.
\]
and a critical region $C_{1}=\left\{  \mathbf{x}:x_{(n)}\geq c\right\}  $. We
need
\[
P(\mathbf{X}\in C_{1};\theta=1)=0.1,
\]
that is,
\[
P(X_{(n)}\geq c;\theta=1)=0.1.
\]
$X_{(n)}$ has c.d.f. $F_{(n)}\left(  x\right)  =x^{n},\ x\in(0,1)$ so
\[%
\begin{array}
[c]{rcl}%
1-c^{n} & = & 0.1,\\
c & = & 0.9^{1\left/  n\right.  }.
\end{array}
\]
The test with critical region $C_{1}=\left\{  \mathbf{x}:x_{(n)}%
\geq0.9^{1\left/  n\right.  }\right\}  $ is most powerful for the test. Since
this critical region does not depend upon $\theta_{1}$, the test is uniformly
most powerful against the composite hypothesis $H_{1}:\theta>1$.\medskip\ 

\noindent The power function of this test is
\[%
\begin{array}
[c]{rcl}%
Q(\theta) & = & P(X_{(n)}\geq0.9^{1\left/  n\right.  };\theta),\quad\theta
\in\lbrack1,\infty),\\
& = & 1-F_{(n)}\left(  0.9^{1\left/  n\right.  }\right) \\
& = & 1-\left[  \left.  0.9^{1\left/  n\right.  }\right/  \theta\right]
^{n}\\
& = & 1-0.9\left/  \theta^{n}\right.  .
\end{array}
\]
The graphs of this function for $n=1$ and $n=5$ are given below. Note that the
larger the value of $n$, the better the power.%
%TCIMACRO{\FRAME{dhFU}{2.6852in}{1.6985in}{0pt}{\Qcb{\QTR{bf}{Figure 4.9}\quad
%Power functions for $n=1$ and $n=5$}}{}{a5hypo_f9.eps}%
%{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 2.6852in;  height 1.6985in;  depth 0pt;  original-width 4.4287in;
%original-height 2.7847in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'a5hypo_f9.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=1.6985in,
width=2.6852in
]%
{a5hypo_f9.eps}%
\\
\textbf{Figure 4.9}\quad Power functions for $n=1$ and $n=5$%
\end{center}
%EndExpansion
$\blacksquare$\medskip

\subsubsection{Tests involving two-sided alternative hypotheses}

\noindent Now consider the problem of testing $H_{0}:\theta=\theta_{0}$
against the two-sided alternative $H_{1}:\theta\neq\theta_{0}$.\medskip

\noindent It is easy to see that failure to specify the direction of the
alternative hypothesis makes the methods we have been using inapplicable.
There is no uniformly most powerful test. When the true value of $\theta$ is
greater than $\theta_{0}$, then a two-tailed test cannot be more powerful than
a one-tailed test which takes account of the information.\medskip

\noindent We can, however, have an \emph{unbiased} test.\medskip

\noindent A test at significance level $\alpha$ for testing $H_{0}:\theta
\in\Theta_{0}$ against $H_{1}:\theta\in\Theta_{1}$ is said to be
\emph{unbiased} if
\[
Q(\theta)\geq\alpha\quad\text{for~all}\mathrm{~}\theta\in\Theta_{1}.
\]
This means that the power is never less than the significance level; the
probability of rejection of $H_{0}$ at any element of $\Theta_{0}$ is
necessarily no greater than the probability of rejection at any element of
$\Theta_{1}$.

\subsection{Summary of hypothesis testing}

\noindent There are four main ingredients to a test.

\begin{itemize}
\item The critical region $C_{1}$.

\item The sample size $n$.

\item The significance level (or size) $\alpha=P(x\in C_{1}|H_{0})$

\item The power $Q=P(x\in C_{1}|H_{1})$.
\end{itemize}

\noindent If any two of these are known, the other two may be
determined.\bigskip\newline\textbf{Example 4.8} (revisited)\quad\emph{Sample
size calculation}\medskip\newline Suppose that, before carrying out the test
for the insect traps $H_{0}:\mu=\mu_{0}=1$ against $H_{1}:\mu=\mu_{1}>1$, we
wanted to determine a suitable sample size. Suppose further that we wanted to
specify a significance level of $\alpha=0.01$ and that we wished to ensure
that the test would be powerful enough to reject the null hypothesis by
specifying a power of 0.95 for a value of $\mu_{1}=1.5$. We know that $\sum
X_{i}\sim Poisson(n\mu)$, so, under $H_{0}$, $\sum X_{i}\sim Poisson(n)$, and
under $H_{1}$ with $\mu_{1}=1.5$ we know that $\sum X_{i}\sim Poisson(1.25n)$%
.\medskip\newline A normal approximation would give us, under $H_{0}$, $\sum
X_{i}\overset{.}{\sim}N\left(  n,n\right)  $ so that%
\[
\frac{\sum X_{i}-n}{\sqrt{n}}\overset{.}{\sim}N\left(  0,1\right)
\quad\Rightarrow\quad P\left(  \frac{\sum X_{i}-n}{\sqrt{n}}\geq2.326\right)
\simeq0.01
\]
and the critical region is%
\[
\sum x_{i}\geq n+2.326\sqrt{n}.
\]
For a power of 0.95, we require%
\[
P\left(  \sum X_{i}\geq n+2.326\sqrt{n}\mid\mu_{1}=1.5\right)  =0.95,
\]
which may be re-written%
\[
P\left(  \frac{\sum X_{i}-1.5n}{\sqrt{1.5n}}\geq\frac{-0.5n+2.326\sqrt{n}%
}{\sqrt{1.5n}}\right)  =0.95.
\]
For a standard normal distribution, $P\left(  Z\geq-1.645\right)  =0.95$, so
the approximate sample size can be calculated from%
\[
\frac{-0.5n+2.326\sqrt{n}}{\sqrt{1.5n}}\simeq-1.645
\]
giving%
\[
\sqrt{n}=8.681,\quad n=75.367,
\]
so the recommended sample size would be 76.\newline$\blacksquare$

\subsection{The Likelihood Ratio Test}

\subsubsection{The likelihood ratio}

\noindent We often want to test in situations where the adopted probability
model involves several unknown parameters. Thus we may denote an element of
the parameter space by
\[
\mathbf{\theta}=\left(  \theta_{1},\theta_{2},\ldots\theta_{k}\right)
\]
Some of these parameters may be \emph{nuisance} parameters, (\emph{e.g}.
testing hypotheses on the unknown mean of a normal distribution with unknown
variance, where the variance is regarded as a nuisance parameter). \medskip\ 

\noindent We use the \emph{likelihood ratio}, $\lambda(\mathbf{x})$, defined
as
\[
\lambda(\mathbf{x})=\frac{\sup\left\{  L(\mathbf{\theta};\mathbf{x}%
):\mathbf{\theta\in\Theta}_{0}\right\}  }{\sup\left\{  L(\mathbf{\theta
};\mathbf{x}):\mathbf{\theta\in\Theta}\right\}  },\quad\mathbf{x}\in
\mathbb{R}_{X}^{n}.
\]
The informal argument for this is as follows.\medskip\ 

\noindent For a realisation $x$, determine its best chance of occurrence under
$H_{0}$ and also its best chance overall. The ratio of these two chances can
never exceed unity, but, if small, would constitute evidence for rejection of
the null hypothesis.\medskip\ \ 

\noindent A \emph{likelihood ratio test} for testing $H_{0}:\mathbf{\theta}%
\in\mathbf{\Theta}_{0}$ against $H_{1}:\mathbf{\theta}\in\mathbf{\Theta}_{1}$
is a test with critical region of the form
\[
C_{1}=\left\{  \mathbf{x}:\lambda(\mathbf{x})\leq k\right\}  ,
\]
where $k$ is a real number between 0 and 1.\medskip\ 

\noindent Clearly the test will be at significance level $\alpha$ if $k$ can
be chosen to satisfy
\[
\sup\left\{  P\left(  \lambda(\mathbf{X})\leq k;~\mathbf{\theta}%
\in\mathbf{\Theta}_{0}\right)  \right\}  =\alpha.
\]
If $H_{0}$ is a simple hypothesis with $\mathbf{\Theta}_{0}=\left\{
\mathbf{\theta}_{0}\right\}  $, we have the simpler form
\[
P\left(  \lambda(\mathbf{X})\leq k;~\mathbf{\theta}_{0}\right)  =\alpha.
\]
To determine $k$, we must look at the c.d.f. of the random variable
$\lambda(\mathbf{X})$, where the random sample $\mathbf{X}$ has joint p.d.f.
$f_{\mathbf{X}}(\mathbf{x};\mathbf{\theta}_{0})$.\bigskip\newline%
\noindent\textbf{Example 4.11}\quad\emph{Exponential distribution}\medskip\ 

\noindent Test $H_{0}:\theta=\theta_{0}$ against $H_{1}:\theta>\theta_{0}
$.\medskip\ \newline Here $\mathbf{\Theta}_{0}=\left\{  \theta_{0}\right\}  $,
$\mathbf{\Theta}_{1}=\left[  \theta_{0},\infty\right)  $.\medskip\ \newline
The likelihood function is
\[
L(\theta;\mathbf{x})=\prod_{i=1}^{n}f(x_{i};\theta)=\theta^{n}e^{-\theta\sum
x_{i}}.
\]
The numerator of the likelihood ratio is
\[
L(\theta_{0};\mathbf{x})=\theta_{0}^{n}e^{-n\theta_{0}\overline{x}}.
\]
We need to find the supremum as $\theta$ ranges over the interval $\left[
\theta_{0},\infty\right)  $. Now
\[
l(\theta;\mathbf{x})=n\log\theta-n\theta\overline{x}%
\]
so that
\[
\frac{\partial l(\theta;\mathbf{x})}{\partial\theta}=\frac{n}{\theta
}-n\overline{x}%
\]
which is zero only when $\theta=1\left/  \overline{x}\right.  $. Since
$L(\theta;\mathbf{x})$ is an increasing function for $\theta<1\left/
\overline{x}\right.  $ and decreasing for $\theta>1\left/  \overline
{x}\right.  $,
\[
\sup\left\{  L(\theta;\mathbf{x}):\theta\in\Theta\right\}  =\left\{
\begin{array}
[c]{cc}%
\overline{x}^{-n}e^{-n}, & \text{if}\mathrm{~}1\left/  \overline{x}\right.
\geq\theta_{0}\\
\theta_{0}^{n}e^{-n\theta_{0}\overline{x}} & \text{if}~1\left/  \overline
{x}\right.  <\theta_{0}%
\end{array}
\right.  .
\]
\ 

\noindent%
%TCIMACRO{\FRAME{dhFU}{2.6368in}{3.1669in}{0pt}{\Qcb{\QTR{bf}{Figure 4.10}\quad
%Likelihood function}}{}{a5hypo_f10.eps}{\special{ language "Scientific Word";
%type "GRAPHIC";  maintain-aspect-ratio TRUE;  display "USEDEF";
%valid_file "F";  width 2.6368in;  height 3.1669in;  depth 0pt;
%original-width 5.5642in;  original-height 6.6945in;  cropleft "0";
%croptop "1";  cropright "1";  cropbottom "0";
%filename 'a5hypo_f10.EPS';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
height=3.1669in,
width=2.6368in
]%
{a5hypo_f10.eps}%
\\
\textbf{Figure 4.10}\quad Likelihood function
\end{center}
%EndExpansion
\[%
\begin{array}
[c]{rcl}%
\lambda(\mathbf{x}) & = & \left\{
\begin{array}
[c]{cc}%
\dfrac{\theta_{0}^{n}e^{-n\theta_{0}\overline{x}}}{\overline{x}^{-n}e^{-n}}, &
1\left/  \overline{x}\right.  \geq\theta_{0}\\
1, & 1\left/  \overline{x}\right.  <\theta_{0}%
\end{array}
\right. \\
&  & \\
& = & \left\{
\begin{array}
[c]{cc}%
\theta_{0}^{n}\overline{x}^{n}e^{-n\theta_{0}\overline{x}}e^{n}, & 1\left/
\overline{x}\right.  \geq\theta_{0}\\
1, & 1\left/  \overline{x}\right.  <\theta_{0}%
\end{array}
\right.
\end{array}
\]


\noindent Since
\[
\frac{d}{d\overline{x}}\left(  \overline{x}^{n}e^{-n\theta_{0}\overline{x}%
}\right)  =n\overline{x}^{n-1}e^{-n\theta_{0}\overline{x}}\left(  1-\theta
_{0}\overline{x}\right)
\]
is positive for values of $\overline{x}$ between 0 and $1\left/  \theta
_{0}\right.  $ where $\theta_{0}>0$, it follows that $\lambda(\mathbf{x})$ is
a non-decreasing function of $\overline{x}.$ Therefore the critical region of
the likelihood ratio test is of the form
\[
C_{1}=\left\{  \mathbf{x}:\sum_{i=1}^{n}x_{i}\leq c\right\}  .
\]
$\blacksquare\bigskip$

\noindent\textbf{Example} \textbf{4.12}\quad\emph{The one-sample
t-test}\medskip\ 

\noindent The null hypothesis is $H_{0}:\theta=\theta_{0}$ for the mean of a
normal distribution with unknown variance $\sigma^{2}$.\medskip\ \newline We
have
\[%
\begin{array}
[c]{rcl}%
\mathbf{\Theta} & = & \left\{  (\theta,\sigma^{2}):\theta\in\mathbb{R}%
,~\sigma^{2}\in\mathbb{R}^{+}\right\} \\
\mathbf{\Theta}_{0} & = & \left\{  (\theta,\sigma^{2}):\theta=\theta
_{0},~\sigma^{2}\in\mathbb{R}^{+}\right\}
\end{array}
\]
and
\[
f(x;\theta,\sigma^{2})=\frac1{\sqrt{2\pi\sigma^{2}}}\exp\left(  -\frac
1{2\sigma^{2}}(x-\theta)^{2}\right)  ,\quad x\in\mathbb{R}.
\]
The likelihood function is
\[
L(\theta,\sigma^{2};\mathbf{x})=(2\pi\sigma^{2})^{-n\left/  2\right.  }%
\exp\left(  -\frac1{2\sigma^{2}}\sum_{i=1}^{n}(x_{i}-\theta)^{2}\right)
\]
Since
\[
l(\theta_{0},\sigma^{2};\mathbf{x})=-\frac n2\log(2\pi\sigma^{2}%
)-\frac1{2\sigma^{2}}\sum_{i=1}^{n}(x_{i}-\theta_{0})^{2}%
\]
and
\[
\frac{\partial l}{\partial\sigma^{2}}=-\frac n{2\sigma^{2}}+\frac1{2\sigma
^{4}}\sum_{i=1}^{n}(x_{i}-\theta_{0})^{2},
\]
which is zero when
\[
\sigma^{2}=\frac1n\sum_{i=1}^{n}(x_{i}-\theta_{0})^{2}%
\]
we conclude that
\[
\sup\left\{  L(\theta_{0},\sigma^{2};\mathbf{x})\right\}  =\left(  \frac{2\pi
}n\sum_{i=1}^{n}(x_{i}-\theta_{0})^{2}\right)  ^{-n\left/  2\right.
}e^{-n\left/  2\right.  }.
\]
\ 

\noindent For the denominator, we already know from previous examples that the
m.l.e. of $\theta$ is $\overline{x}$, so
\[
\sup\left\{  L(\theta,\sigma^{2};\mathbf{x})\right\}  =\left(  \frac{2\pi
}n\sum_{i=1}^{n}(x_{i}-\overline{x})^{2}\right)  ^{-n\left/  2\right.
}e^{-n\left/  2\right.  }%
\]
and
\[
\lambda(\mathbf{x})=\left(  \frac{\sum_{i=1}^{n}(x_{i}-\theta_{0})^{2}}%
{\sum_{i=1}^{n}(x_{i}-\overline{x})^{2}}\right)  ^{-n\left/  2\right.
}\mathrm{.}%
\]
This may be written in a more convenient form. Note that
\[%
\begin{array}
[c]{rcl}%
%TCIMACRO{\dsum _{i=1}^{n}}%
%BeginExpansion
{\displaystyle\sum_{i=1}^{n}}
%EndExpansion
(x_{i}-\theta_{0})^{2} & = &
%TCIMACRO{\dsum _{i=1}^{n}}%
%BeginExpansion
{\displaystyle\sum_{i=1}^{n}}
%EndExpansion
\left(  (x_{i}-\overline{x})+(\overline{x}-\theta_{0})\right)  ^{2}\\
&  & \\
& = &
%TCIMACRO{\dsum _{i=1}^{n}}%
%BeginExpansion
{\displaystyle\sum_{i=1}^{n}}
%EndExpansion
(x_{i}-\overline{x})^{2}+n(\overline{x}-\theta_{0})^{2}%
\end{array}
\]
so that
\[
\lambda(\mathbf{x})=\left(  1+\frac{n(\overline{x}-\theta_{0})^{2}}{\sum
_{i=1}^{n}(x_{i}-\overline{x})^{2}}\right)  ^{-n\left/  2\right.  }\mathrm{.}%
\]
\ 

\noindent The critical region is
\[
C_{1}=\left\{  \mathbf{x}:\lambda(\mathbf{x})\leq k\right\}
\]
so it follows that $H_{0}$ is to be rejected when the value of
\[
\frac{\left\vert \overline{x}-\theta_{0}\right\vert }{\sqrt{\sum_{i=1}%
^{n}(x_{i}-\overline{x})^{2}}}%
\]
exceeds some constant.\medskip\ \newline Now we have already seen that
\[
\frac{\overline{X}-\theta}{S\left/  \sqrt{n}\right.  }\sim t(n-1)
\]
where
\[
S^{2}=\frac{1}{n-1}\sum_{i=1}^{n}(X_{i}-\overline{X})^{2}.
\]
Therefore it makes sense to write the critical region in the form
\[
C_{1}=\left\{  \mathbf{x}:\frac{\left\vert \overline{x}-\theta_{0}\right\vert
}{s\left/  \sqrt{n}\right.  }\geq c\right\}
\]
which is the standard form of the two-sided \emph{t}-test for a single
sample.\newline$\blacksquare$\ 

\subsubsection{The likelihood ratio statistic}

Since the function $-2\log\lambda(\mathbf{x})$ is a decreasing function, it
follows that the critical region of the likelihood ratio test can also be
expressed in the form
\[
C_{1}=\left\{  \mathbf{x}:-2\log\lambda(x)\geq c\right\}  .
\]
Writing
\[
\Lambda(\mathbf{x})=-2\log\lambda(\mathbf{x})=2\left[  l(\widehat{\theta
}:\mathbf{x})-l(\theta_{0}:\mathbf{x})\right]
\]
the critical region may be written as
\[
C_{1}=\left\{  \mathbf{x}:\Lambda(\mathbf{x})\geq c\right\}
\]
and $\Lambda(\mathbf{X})$ is called the \emph{likelihood ratio statistic}%
.\medskip\ \newline We have been using the idea that values of $\theta$ close
to $\widehat{\theta}$ are well supported by the data so, if $\theta_{0}$ is a
possible value of $\theta$, then it turns out that, for large samples,
\[
\Lambda(\mathbf{X})\overset{D}{\rightarrow}\chi_{p}^{2}%
\]
where $p=\dim(\theta)$.\medskip\newline Let us see why.\ 

\subsubsection{The asymptotic distribution of the likelihood ratio statistic}

\noindent Write
\[
l(\theta_{0})=l(\widehat{\theta})+(\widehat{\theta}-\theta_{0})l^{\prime
}(\widehat{\theta})+\frac{1}{2}(\widehat{\theta}-\theta_{0})^{2}%
l^{\prime\prime}(\widehat{\theta})+\ldots
\]
and, remembering that $l^{\prime}(\widehat{\theta})=0$, we have
\[%
\begin{array}
[c]{rcl}%
\Lambda & \simeq & (\widehat{\theta}-\theta_{0})^{2}\left[  -l^{\prime\prime
}(\widehat{\theta})\right] \\
&  & \\
& = & (\widehat{\theta}-\theta_{0})^{2}J(\widehat{\theta})\\
&  & \\
& = & (\widehat{\theta}-\theta_{0})^{2}I(\theta_{0})\dfrac{J(\widehat{\theta
})}{I(\theta_{0})}.
\end{array}
\]
But
\[
(\widehat{\theta}-\theta_{0})I(\theta_{0})^{1\left/  2\right.  }\overset
{D}{\rightarrow}N(0,1)\quad\text{and}\mathrm{\quad}\frac{J(\widehat{\theta}%
)}{I(\theta_{0})}\overset{P}{\rightarrow}1
\]
so
\[
(\widehat{\theta}-\theta_{0})^{2}I(\theta_{0})\overset{D}{\rightarrow}\chi
_{1}^{2}%
\]
or
\[
\Lambda\overset{D}{\rightarrow}\chi_{1}^{2}%
\]
provided $\theta_{0}$ is the true value of $\theta$.\ \medskip\ 

\noindent\textbf{Example 4.13}\quad\emph{Poisson distribution}\medskip
\ \newline Let $\mathbf{X}=(X_{1},\ldots,X_{n})$ be a random sample from a
Poisson distribution with parameter $\theta$, and test $H_{0}:\theta
=\theta_{0}$ against $H_{1}:\theta\neq\theta_{0}$ at significance level
0.05.\medskip\ \newline The p.m.f. is
\[
p(x;\theta)=\frac{e^{-\theta}\theta^{x}}{x!},\quad x=0,1,\ldots
\]
so that
\[
l(\theta:\mathbf{x})=-n\theta+\sum_{i=1}^{n}x_{i}\log\theta-\log\prod
_{i=1}^{n}x_{i}!
\]
and
\[
\frac{\partial l(\theta:\mathbf{x})}{\partial\theta}=-n+\frac{1}{\theta}%
\sum_{i=1}^{n}x_{i}%
\]
giving $\widehat{\theta}=\overline{x}$.\medskip\newline Therefore
\[
\Lambda=2n\left[  \theta_{0}-\overline{x}+\overline{x}\log\left(
\frac{\overline{x}}{\theta_{0}}\right)  \right]  .
\]
The distribution of $\Lambda$ under $H_{0}$ is approximately $\chi_{1}^{2}$
and $\chi_{1}^{2}(0.95)=3.84$, so the critical region of the test is
\[
C_{1}=\left\{  \mathbf{x}:2n\left[  \theta_{0}-\overline{x}+\overline{x}%
\log\left(  \frac{\overline{x}}{\theta_{0}}\right)  \right]  \geq3.84\right\}
.
\]
$\blacksquare$\ 

\subsubsection{Testing goodness-of-fit for discrete distributions}

\textbf{Example 4.14}\quad\emph{Pielou's data on Armillaria root rot \medskip
in Douglas fir trees}\newline You have already seen the data below as Data set
4.4. They\textbf{\ }were collected by the ecologist E.C. Pielou, who was
interested in the pattern of healthy and diseased trees. The subject of her
research was \emph{Armillaria} root rot in a plantation of Douglas firs. She
recorded the lengths of 109 runs of diseased trees.
\[%
\begin{tabular}
[c]{lrrrrrrr}%
\multicolumn{8}{l}{\textbf{Table 4.4}\quad Run lengths of diseased
trees}\\\cline{1-7}%
Run length & 1 & 2 & 3 & 4 & 5 & 6 & \\
Number of runs & 71 & 28 & 5 & 2 & 2 & 1 & \\\cline{1-7}%
\end{tabular}
\]
On biological grounds, Pielou proposed a geometric distribution as a
probability model. Is this plausible?\newline$\square\medskip$\ \newline Let's
try to answer this by first looking at the general case.\medskip\ \ 

\noindent Suppose we have $k$ groups with $n_{i}$ in the $i^{th}$ group. Thus
\[%
\begin{tabular}
[c]{lllllll}\hline
Group & 1 & 2 & 3 & 4 & $\cdots$ & $k$\\
Number & $n_{1}$ & $n_{2}$ & $n_{3}$ & $n_{4}$ & $\cdots$ & $n_{k}$\\\hline
\end{tabular}
\]
where $\sum_{i}n_{i}=n$.\medskip\ \newline Suppose further that we have a
probability model such that $\pi_{i}(\theta),\ i=1,2,\ldots,k,$ is the
probability of being in the $i^{th}$ group. Clearly $\sum_{i}\pi_{i}%
(\theta)=1$.\medskip\ \newline The likelihood is
\[
L(\theta)=n!\prod_{i=1}^{k}\frac{\pi_{i}(\theta)^{n_{i}}}{n_{i}!}%
\]
and the log-likelihood is
\[
l(\theta)=\sum_{i=1}^{k}n_{i}\log\pi_{i}(\theta)+\log n!-\sum_{i=1}^{k}\log
n_{i}!
\]
Suppose $\widehat{\theta}$ maximises $l(\theta)$, being the solution of
$l^{\prime}(\widehat{\theta})=0$.\medskip\ \ 

\noindent The general alternative is to take $\pi_{i}$ as unrestricted by the
model and subject only to $\sum_{i}\pi_{i}=1$. Thus we maximise
\[
l(\mathbf{\pi})=\sum_{i=1}^{k}n_{i}\log\pi_{i}+\log n!-\sum_{i=1}^{k}\log
n_{i}!\mathrm{\quad}\text{with}\mathrm{\quad}g(\mathbf{\pi})=\sum_{i}\pi
_{i}=1.
\]
Using Lagrange multiplier $\gamma$ we obtain the set of $k$ equations
\[
\frac{\partial l}{\partial\pi_{i}}-\gamma\frac{\partial g}{\partial\pi_{i}%
}=0,\quad1\leq i\leq k,
\]
or
\[
\frac{n_{i}}{\pi_{i}}-\gamma=0,\quad1\leq i\leq k.
\]
Writing this as
\[
n_{i}-\gamma\pi_{i}=0,\quad1\leq i\leq k
\]
and summing over $i$ we find $\gamma=n$ and
\[
\widehat{\pi}_{i}=\frac{n_{i}}{n}.
\]
The likelihood ratio statistic is
\[%
\begin{array}
[c]{rcl}%
\Lambda & = & 2\left[
%TCIMACRO{\dsum \limits_{i=1}^{k}}%
%BeginExpansion
{\displaystyle\sum\limits_{i=1}^{k}}
%EndExpansion
n_{i}\log\dfrac{n_{i}}{n}-\sum_{i=1}^{k}n_{i}\log\pi_{i}(\widehat{\theta
})\right] \\
&  & \\
& = & 2%
%TCIMACRO{\dsum \limits_{i=1}^{k}}%
%BeginExpansion
{\displaystyle\sum\limits_{i=1}^{k}}
%EndExpansion
n_{i}\log\left(  \dfrac{n_{i}}{n\pi_{i}(\widehat{\theta})}\right)  .
\end{array}
\]
\ 

\noindent\textbf{General statement of asymptotic result for the likelihood
ratio statistic}\medskip\ 

\noindent Testing $H_{0}:\theta\in\Theta_{0}\subset\Theta$ against
$H_{1}:\theta\in\Theta$, the likelihood ratio statistic
\[
\Lambda=2\left[  \sup_{\theta\in\Theta}l(\theta)-\sup_{\theta\in\Theta_{0}%
}l(\theta)\right]  \overset{D}{\rightarrow}\chi_{p}^{2},
\]
where
\[
p=\dim\Theta-\dim\Theta_{0}%
\]
\newline\ 

\noindent In the case above where we are looking at the fit of a one-parameter
distribution
\[
\Lambda=2\sum_{i=1}^{k}n_{i}\log\left(  \frac{n_{i}}{n\pi_{i}(\widehat{\theta
})}\right)  ,
\]
the restriction $\sum_{i=1}^{k}\pi_{i}=1$ means that $\dim\Theta=k-1$. Clearly
$\dim\Theta_{0}=1$ so $p=k-2$ and
\[
\Lambda\overset{D}{\rightarrow}\chi_{k-2}^{2}.
\]
\ 

\noindent\textbf{Example 4.14 }(revisited)\quad\emph{Pielou's data on
Armillaria root rot \medskip in Douglas fir trees}\ \newline The data are
\[%
\begin{tabular}
[c]{lrrrrrr}\hline
Run length & 1 & 2 & 3 & 4 & 5 & 6\\
Number of runs & 71 & 28 & 5 & 2 & 2 & 1\\\hline
\end{tabular}
\
\]
and Pielou proposed a geometric model with p.m.f.
\[
p(x)=(1-\theta)^{x-1}\theta,\quad x=1,2,\ldots
\]
where $x$ is the observed run length. Thus, if $x_{j},\ 1\leq j\leq n,$ are
the observed run lengths, the log-likelihood for Pielou's model is
\[
l(\theta)=\sum_{j=1}^{n}(x_{j}-1)\log(1-\theta)+n\log\theta
\]
and, maximising,
\[
\frac{\partial l(\theta)}{\partial\theta}=-\frac{\sum_{j=1}^{n}x_{j}%
-n}{(1-\theta)}+\frac{n}{\theta}%
\]
which gives
\[
\widehat{\theta}=\frac{1}{\overline{x}}.
\]
By the invariance property of m.l.e.'s
\[
\pi_{i}(\widehat{\theta})=(1-\widehat{\theta})^{i-1}\widehat{\theta}%
=\frac{\left(  \overline{x}-1\right)  ^{i-1}}{\overline{x}^{i}}.
\]
\ 

\noindent The data give $\overline{x}=1.523$. We can therefore use the
expression for $\pi_{i}(\widehat{\theta})$ to calculate
\[
\Lambda=2\sum_{i=1}^{k}n_{i}\log\left(  \frac{n_{i}}{n\pi_{i}(\widehat{\theta
})}\right)  =3.547.
\]
There are six groups, so $p=6-1-1=4.$\medskip\ \newline The approximate
distribution of $\Lambda$ is therefore $\chi_{4}^{2}$ and
\[
P(\Lambda\geq3.547)=0.471.
\]
There is no evidence against Pielou's conjecture that a geometric distribution
is an appropriate model.\newline$\blacksquare$\bigskip\newline\textbf{Example
4.15}\quad\emph{Flying bomb hits on London\medskip}\newline Data set 4.5 gave
the number of flying bomb hits recorded in each of 576 small areas of
$\frac{1}{4}km^{2}$ in the south of London during World War II.
\[%
\begin{tabular}
[c]{lccccccc}%
\multicolumn{8}{l}{\textbf{Table 4.5}\quad Flying bomb hits on London}\\\hline
Number of hits in an area & 0 & 1 & 2 & 3 & 4 & 5 & $\geq6$\\
Frequency & 229 & 211 & 93 & 35 & 7 & 1 & 0\\\hline
\end{tabular}
\
\]
Propaganda broadcasts claimed that the weapon could be aimed accurately. If,
however, this was not the case, the hits should be randomly distributed over
the area and should therefore be fitted by a Poisson distribution. Is this the
case?\newline$\square$\bigskip\newline The first thing to do is to calculate
the m.l.e. of the Poisson parameter. The likelihood function for a sample of
size $n$ is%
\[
L\left(  \theta\right)  =%
%TCIMACRO{\dprod \limits_{i=1}^{n}}%
%BeginExpansion
{\displaystyle\prod\limits_{i=1}^{n}}
%EndExpansion
\frac{\theta^{x_{i}}e^{-\theta}}{x_{i}!},
\]
so that the log-likelihood is%
\begin{align*}
l\left(  \theta\right)   & =\sum_{i=1}^{n}x_{i}\log\theta-n\theta-\sum
_{i=1}^{n}\log x_{i}!\\
\frac{\mathrm{d}l}{\mathrm{d}\theta}  & =\frac{\sum_{i=1}^{n}x_{i}}{\theta
}-n=0
\end{align*}
and%
\[
\widehat{\theta}=\overline{x}=\frac{535}{576}=0.928.
\]
Using the Poisson probability mass function with $\theta=0.929$ we therefore
obtain%
\[%
\begin{tabular}
[c]{cccccccc}%
$i$ & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $\geq6$\\
$\pi_{i}\left(  \widehat{\theta}\right)  $ & $0.3949$ & $0.3669$ & $0.1704$ &
$0.0528$ & $0.0123$ & $0.0023$ & $0.0004$%
\end{tabular}
\]
and hence%
\[
\Lambda=2\sum_{i=1}^{k}n_{i}\log\left(  \frac{n_{i}}{n\pi_{i}(\widehat{\theta
})}\right)  =1.4995.
\]
This is tested against $\chi^{2}(\nu)$ where $\nu=k-2=7-2=5.$ This gives
$P\left(  \Lambda\geq1.4995\right)  =0.913$. Clearly there is not a shred of
evidence in favour of rejection.\newline$\blacksquare$

\subsubsection{The approximate $\chi^{2}$ distribution}

The tests carried out in Examples 4.14 and 4.15 are not, strictly speaking,
correct. The reason for this is that the $\chi^{2}$-distribution we have used
to calculate the $p$-values is an approximation, and the quality of that
approximation depends upon the sample size. Happily there is a general rule of
thumb you can use.\bigskip\newline\textbf{Rule of thumb for the }$\chi^{2}%
$\textbf{\ approximation\medskip\newline}An approximate $\chi^{2}%
$-distribution may be used for testing count data provided that the expected
value of each cell in the table is at least 5. If the expected value of a cell
is less than 5, it should be pooled with an adjacent cell or cells to obtain a
suitable value.\newline$\square$\newpage

\noindent\textbf{Example 4.14 }(revisited)\quad\emph{Pielou's data on
Armillaria root rot \medskip in Douglas fir trees}\ \newline Look at the table
with the expected values written in.%
\[%
\begin{tabular}
[c]{lccccccc}\hline
Run length & 1 & 2 & 3 & 4 & 5 & 6 & $\geq$7\\
Number of runs $n_{i}$ & 71 & 28 & 5 & 2 & 2 & 1 & 0\\
Expected number of runs $n\pi_{i}(\widehat{\theta})$ & 71.569 & 24.577 &
8.440 & 2.898 & 0.995 & 0.342 & 0.218\\\hline
\end{tabular}
\
\]
Clearly we need to pool cells to obtain%
\[%
\begin{tabular}
[c]{lccc}\hline
Run length & 1 & 2 & $\geq3$\\
Number of runs $n_{i}$ & 71 & 28 & 10\\
Expected number of runs $n\pi_{i}(\widehat{\theta})$ & 71.569 & 24.577 &
12.893\\\hline
\end{tabular}
\
\]
The test statistic is now re-calculated to obtain $\Lambda=1.087$, which is
tested as $\chi^{2}\left(  1\right)  $ to give a $p$-value of $0.297$. The
conclusion that there is no evidence against Pielou's conjecture that the
underlying distribution is geometric is unaltered.\newline$\blacksquare
\bigskip$\newline\textbf{Example 4.15} (revisited)\quad\emph{Flying bomb hits
on London\medskip}\newline Including the expected values in the table for
flying bomb hits, we obtain the table below.%
\[%
\begin{tabular}
[c]{lccccccc}\hline
Number of hits in an area & 0 & 1 & 2 & 3 & 4 & 5 & $\geq6$\\
Frequency & 229 & 211 & 93 & 35 & 7 & 1 & 0\\
Expected frequency & 227.462 & 211.334 & 98.150 & 30.413 & 7.027 & 1.325 &
0.230\\\hline
\end{tabular}
\
\]
After pooling, we obtain%
\[%
\begin{tabular}
[c]{lccccc}\hline
Number of hits in an area & 0 & 1 & 2 & 3 & $\geq4$\\
Frequency & 229 & 211 & 93 & 35 & 8\\
Expected frequency & 227.462 & 211.334 & 98.150 & 30.413 & 8.582\\\hline
\end{tabular}
\
\]
The test statistic is now re-calculated to obtain $\Lambda=1.101$, which is
tested as $\chi^{2}\left(  3\right)  $ to give a $p$-value of $0.777$. Again
we find no evidence for rejection of the null hypothesis. We have therefore
found no evidence that V1 flying bomb could be aimed with any degree of
precision.\newline$\blacksquare$

\subsubsection{Two-way contingency tables}

Data are obtained by cross-classifying a fixed number of individuals according
to two criteria. They are therefore displayed as $n_{ij}$ in a table with $r$
rows and $c$ columns as follows.
\[%
\begin{tabular}
[c]{ccc|c}%
$n_{11}$ & $\cdots$ & $n_{1c}$ & $n_{1.}$\\
$\vdots$ & $\ddots$ & $\vdots$ & $\vdots$\\
$n_{r1}$ & $\cdots$ & $n_{rc}$ & $n_{r.}$\\\hline
$n_{.1}$ & $\cdots$ & $n_{.c}$ & $n$%
\end{tabular}
\]
\noindent The aim is to investigate the independence of the two
classifications.\bigskip\newline\medskip\textbf{Example 4.16}\quad\emph{A
famous and historic data set}\newline These are Pearson's 1909 data on crime
and drinking. The data were introduced in Data set 4.6.%

%TCIMACRO{\FRAME{dhF}{2.7302in}{2.2943in}{0pt}{}{}{pearson.gif}%
%{\special{ language "Scientific Word";  type "GRAPHIC";
%maintain-aspect-ratio TRUE;  display "USEDEF";  valid_file "F";
%width 2.7302in;  height 2.2943in;  depth 0pt;  original-width 5.8747in;
%original-height 4.9268in;  cropleft "0";  croptop "1";  cropright "1";
%cropbottom "0";  filename 'pearson.GIF';file-properties "XNPEU";}}}%
%BeginExpansion
\begin{center}
\includegraphics[
natheight=4.926800in,
natwidth=5.874700in,
height=2.2943in,
width=2.7302in
]%
{pearson.gif}%
\end{center}
%EndExpansion%
\[%
\begin{tabular}
[c]{lll}%
\multicolumn{3}{l}{\textbf{Table 4.6}\quad Crime and drinking}\\\hline
\emph{Crime} & \emph{Drinker} & \emph{Abstainer}\\\hline
Arson & \multicolumn{1}{c}{50} & \multicolumn{1}{c}{43}\\
Rape & \multicolumn{1}{c}{88} & \multicolumn{1}{c}{62}\\
Violence & \multicolumn{1}{c}{155} & \multicolumn{1}{c}{110}\\
Stealing & \multicolumn{1}{c}{379} & \multicolumn{1}{c}{300}\\
Coining & \multicolumn{1}{c}{18} & \multicolumn{1}{c}{14}\\
Fraud & \multicolumn{1}{c}{63} & \multicolumn{1}{c}{144}\\\hline
\end{tabular}
\]
Is crime drink related?\newline$\square$\bigskip\newline

\noindent Suppose the $k^{th}$ individual goes into cell $(X_{k}%
,Y_{k}),\ k=1,2,\ldots,n,$ and that individuals are independent. Let
\[
P\left(  (X_{k},Y_{k})=(i,j)\right)  =\theta_{ij},\quad i=1,2,\ldots,r;\quad
j=1,2,\ldots,c,
\]
where $\sum_{ij}\theta_{ij}=1$. The null hypothesis of independence of
classifiers can be written $H_{0}:\theta_{ij}=\phi_{i}\rho_{j}$.\medskip\ 

\noindent This is on \emph{Problem Sheet 6} so here are a few hints.\medskip

\noindent The likelihood function is
\[
L(\mathbf{\theta})=n!\prod_{i,j}\frac{\theta_{ij}^{n_{ij}}}{n_{ij}!}%
\]
so the log-likelihood is
\[
l(\mathbf{\theta})=\sum_{i,j}n_{ij}\log\theta_{ij}+\log n!-\sum_{i,j}\log
n_{ij}!
\]
Under $H_{0}$, put $\theta_{ij}=\phi_{i}\rho_{j}$ and maximise with respect to
$\phi_{i}$ and $\rho_{j}$ subject to $\sum_{i}\phi_{i}=$ $\sum_{j}\rho_{j}=1$.
You will obtain
\[
\widehat{\phi}_{i}=\frac{n_{i.}}n,\quad\widehat{\rho}_{j}=\frac{n_{.j}}n
\]
Under $H_{1}$, maximise with respect to $\theta_{ij}$ subject to $\sum
_{ij}\theta_{ij}=1$. You will obtain
\[
\widehat{\theta}_{ij}=\frac{n_{ij}}n
\]
and, finally
\[
\Lambda=2\sum_{i=1}^{r}\sum_{j=1}^{c}n_{ij}\log\left(  \frac{n_{ij}n}%
{n_{i.}n_{.j}}\right)  .
\]


\noindent\medskip

\noindent\textbf{Example 4.16} (continued)\quad\emph{A famous and historic
data set\medskip}\newline For these data, $\Lambda=50.52$.\medskip

\noindent Under $H_{0}$, $\Lambda\sim\chi_{p}^{2}$, where $p=\dim\Theta
-\dim\Theta_{0}$. In the notation used earlier, there are apparently 6 values
of $\phi_{i}$ to estimate, but in fact there are only 5 values because
$\sum_{i}\phi_{i}=1$. Similarly there are $2-1=1$ values of $\rho_{j}$. Thus
$\dim\Theta_{0}=6.$

\noindent Because $\sum_{ij}\theta_{ij}=1$, $\dim\Theta=12-1=11$ so,
therefore, $p=11-6=5$.\medskip

\noindent Testing against a $\chi^{2}$-distribution with 5 degrees of freedom,
note that the 0.9999 quantile is 25.75 and we can reject at the 0.0001 level
of significance. There is overwhelming evidence that crime and drink are
related.\newline$\blacksquare$\bigskip

\noindent\textbf{Degrees of freedom}\medskip

\noindent It is clear from the above that, when testing contingency tables,
the number of degrees of freedom of the resulting $\chi^{2}$-distribution is
given, in general, by
\[%
\begin{array}
[c]{rcl}%
p & = & rc-1-(r-1)-(c-1)\\
& = & rc-r-c+1\\
& = & (r-1)(c-1).
\end{array}
\]
\newpage\ 

\subsubsection{Pearson's statistic}

For testing independence in contingency tables, let $O_{ij}$ be the observed
number in cell $(i,j),$ $i=1,2,\ldots,r;\quad j=1,2,\ldots,c,$ and $E_{ij}$ be
the expected number in cell $(i,j).$ Pearson's statistic is
\[
P=\sum_{i,j}\frac{\left(  O_{ij}-E_{ij}\right)  ^{2}}{E_{ij}}\sim
\chi_{(r-1)(c-1)}^{2}.
\]
The expected number $E_{ij}$ in cell $(i,j)$ is calculated under the null
hypothesis of independence.\medskip\ \newline If $n_{i.}$ is the total for the
$i^{th}$ row and the overall total is $n$, then the probability of an
observation being in the $i^{th}$ row is estimated by
\[
P(i^{th}~\text{row})=\frac{n_{i.}}{n}.
\]
Similarly
\[
P(j^{th}~\text{column})=\frac{n_{.j}}{n}%
\]
and
\[%
\begin{array}
[c]{rcl}%
E_{ij} & = & n\times P(i^{th}~\text{row})\times P(j^{th}~\text{column})\\
&  & \\
& = & =\dfrac{n_{i.}n_{.j}}{n}.
\end{array}
\]
\medskip\ \ 

\noindent\textbf{Example 4.16} (revisited)\quad\emph{A famous and historic
data set\medskip}\newline

\noindent These are the data on crime and drinking with the row and column
totals.
\[%
\begin{tabular}
[c]{llll}\hline
\emph{Crime} & \emph{Drinker} & \emph{Abstainer} & \emph{Total}\\\hline
Arson & \multicolumn{1}{r}{50} & \multicolumn{1}{r}{43} &
\multicolumn{1}{r}{93}\\
Rape & \multicolumn{1}{r}{88} & \multicolumn{1}{r}{62} &
\multicolumn{1}{r}{150}\\
Violence & \multicolumn{1}{r}{155} & \multicolumn{1}{r}{110} &
\multicolumn{1}{r}{265}\\
Stealing & \multicolumn{1}{r}{379} & \multicolumn{1}{r}{300} &
\multicolumn{1}{r}{679}\\
Coining & \multicolumn{1}{r}{18} & \multicolumn{1}{r}{14} &
\multicolumn{1}{r}{32}\\
Fraud & \multicolumn{1}{r}{63} & \multicolumn{1}{r}{144} &
\multicolumn{1}{r}{207}\\\hline
\emph{Total} & \multicolumn{1}{r}{753} & \multicolumn{1}{r}{673} &
\multicolumn{1}{r}{1426}\\\hline
\end{tabular}
\
\]
The $E_{ij}$ are easily calculated.
\[
E_{11}=\frac{93\times753}{1426}=49.11,{~}\text{and~so~on.}%
\]
Pearson's statistic turns out to be $P=49.73$, which is tested against a
$\chi^{2}$-distribution with $(6-1)\times(2-1)=5$ degrees of freedom and the
conclusion is, of course, the same as before.\newline$\blacksquare$\medskip\ \ 

\subsubsection{Pearson's statistic and the likelihood ratio statistic}%

\[%
\begin{array}
[c]{rcl}%
P & = &
%TCIMACRO{\dsum _{i,j}}%
%BeginExpansion
{\displaystyle\sum_{i,j}}
%EndExpansion
\dfrac{\left(  O_{ij}-E_{ij}\right)  ^{2}}{E_{ij}}\\
&  & \\
& = &
%TCIMACRO{\dsum _{i,j}}%
%BeginExpansion
{\displaystyle\sum_{i,j}}
%EndExpansion
\dfrac{\left(  n_{ij}-\frac{n_{i.}n_{.j}}{n}\right)  ^{2}}{\frac{n_{i.}n_{.j}%
}{n}}%
\end{array}
\]
Consider the Taylor expansion of $x\log(x/a)$ about $x=a$.
\[
x\log\left(  \frac{x}{a}\right)  =(x-a)+\frac{(x-a)^{2}}{2a}-\frac{(x-a)^{3}%
}{6a^{2}}+\cdots
\]
Now put $x=n_{ij}$ and $a=\dfrac{n_{i.}n_{.j}}{n}$ so that
\[
n_{ij}\log\left(  \frac{n_{ij}n}{n_{i.}n_{.j}}\right)  =\left(  n_{ij}%
-\frac{n_{i.}n_{.j}}{n}\right)  +\frac{\left(  n_{ij}-\frac{n_{i.}n_{.j}}%
{n}\right)  ^{2}}{2\frac{n_{i.}n_{.j}}{n}}+\cdots
\]
Thus
\[%
\begin{array}
[c]{l}%
%TCIMACRO{\dsum _{i,j}}%
%BeginExpansion
{\displaystyle\sum_{i,j}}
%EndExpansion
n_{ij}\log\left(  \dfrac{n_{ij}n}{n_{i.}n_{.j}}\right) \\
\\
=n-n%
%TCIMACRO{\dsum _{i}}%
%BeginExpansion
{\displaystyle\sum_{i}}
%EndExpansion
\dfrac{n_{i.}}{n}%
%TCIMACRO{\dsum _{j}}%
%BeginExpansion
{\displaystyle\sum_{j}}
%EndExpansion
\dfrac{n_{.j}}{n}+\frac{1}{2}%
%TCIMACRO{\dsum _{i,j}}%
%BeginExpansion
{\displaystyle\sum_{i,j}}
%EndExpansion
\dfrac{\left(  O_{ij}-E_{ij}\right)  ^{2}}{E_{ij}}+\cdots\simeq\frac{1}{2}P
\end{array}
\]
or
\[
\Lambda\simeq P
\]
\textbf{Example 4.17\quad}\emph{Snoring and heart disease\medskip}\newline You
saw the data in the table below in Data set 4.7.
\[%
\begin{tabular}
[c]{lccccc}%
\multicolumn{6}{l}{\textbf{Table 4.7}\quad Snoring frequency and heart
disease}\\\hline
Heart & Non- & Occasional & Snore nearly & Snore every & \\
disease & snorers & snorers & every night & night & Total\\\hline
Yes & 24 & 35 & 21 & 30 & 110\\
No & 1355 & 603 & 192 & 224 & 2374\\
Total & 1379 & 638 & 213 & 254 & 2484\\\hline
\end{tabular}
\
\]
Is there an association between snoring frequency and heart disease?\medskip
\newline You might like to practise on this data set by calculating both
$\Lambda=2\sum_{i=1}^{r}\sum_{j=1}^{c}n_{ij}\log\left(  \dfrac{n_{ij}n}%
{n_{i.}n_{.j}}\right)  $ and $P=%
%TCIMACRO{\dsum _{i,j}}%
%BeginExpansion
{\displaystyle\sum_{i,j}}
%EndExpansion
\dfrac{\left(  O_{ij}-E_{ij}\right)  ^{2}}{E_{ij}}$. You should get%
\[
\Lambda=65.904\quad\text{and}\quad P=72.782.
\]
Each is approximately distributed $\chi^{2}\left(  3\right)  $ and in each
case the $p$-value is $0$. The conclusion is that there is an association
between snoring and heart disease.\newline$\blacksquare$


\end{document}