\documentclass[30pt,landscape]{foils}

\usepackage{amsmath}

\usepackage{pause}               \usepackage{background}
\usepackage{graphicx}           \usepackage{geometry}
\usepackage{hyperref}

\usepackage{pp4slide}
\geometry{headsep=3ex,hscale=0.9}

\newtheorem{example}{Example} 
\newtheorem{question}[example]{Question}
\newtheorem{definition}[example]{Definition}
\newtheorem{theorem}[example]{Theorem}
\newtheorem{fact}[example]{Fact}
\newtheorem{notation}[example]{Notation}

\newcommand{\pz}{\pause}
\newcommand{\pb}{\pagebreak}

\definecolor{bgblue}{rgb}{0.03,0.39,0.23}
\vpagecolor{bgblue}

\hypersetup{pdftitle={lecture},
  pdfsubject={A mathematics lecture},
  pdfauthor={Dev Sinha, University of Oregon},
  pdfkeywords={pdftex, acrobat},
  pdfpagemode={FullScreen},
  linkcolor={red}
}

\begin{document}


{\Large Comparing (means of) two samples} \pz

We continue adding levels of detail so our procedures may apply in 
a larger number of real-world settings.   As we have said many 
times, the best data often come from experiments, where
there are two populations being treated by different means, and then
measured and compared.   Before we used single-variable
statistics to analyze a matched-pair experiment. \pz But matched-pair
experiments have both practical and theoretical drawbacks, so we 
develop statistics which address more general experimental design. \pz

As before we should think about means and deviations, but the formulae
can now be complicated. \pz

What we want to understand: the difference of means, $\mu_1 - \mu_2$. \pz
The basic measurement we start with: the difference of observed means $\bar{x}_1 - \bar{x_2}$. \pz

In order to find confidence intervals and test hypotheses, we need to understand
standard deviations and errors. \pz  Fortunately some sharp mathematicians and
statisticians come to our rescue. \pb

\begin{theorem}
If two distributions of size $n_1$ and $n_2$ 
have standard deviations $\sigma_1$ and $\sigma_2$, then the deviation
for the observed difference is $\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}$. \pz
\end{theorem} 

We get the {\em standard error}, called $SE$, for two samples by using $s_1$ and $s_2$ in
place of $\sigma_1$ and $\sigma_2$. \pz

We may use a t-distribution to approximate statistics which approximate the difference
of means $\mu_1 - \mu_2$.  Ignoring this distinction between one- and two- variable
distributions (which are taken into account by sophisticated statistics programs) we have
the following. \pz

\begin{theorem}
The following approximations may be used when t-procedures are applicable.
\begin{itemize}
\item With probability $C\%$ the (true) difference of means $\mu_1 - \mu_2$ has values between\\
\begin{center}
$(\overline{x_1} - \overline{x_2}) - t^{*}SE $ and $(\overline{x_1} - \overline{x_2}) + t^{*} SE $, \pz \\
\end{center}
where $t^*$ is the critical value associated to the $t(n-1)$-distribution where $n$
is the smallest of $n_1$ and $n_2$. \pb

\item To test the null hypothesis, $H_{0}: \mu_1 = \mu_2$,\pz  we  calculate 
\[
t_0 = \frac{\overline{x_1}-\overline{x_2}}{SE} \pz
\]
Then $P (t \geq |t_{0}|) < \alpha$
supports the alternative hypothesis $H_{a}: \mu_1 \ne \mu_{2}$ at
level $\alpha$. \pz
\end{itemize}
\end{theorem}

To summarize, if we use the standard error $SE$ in the places the 
single-sample standard error was used, we may use the same
methods to understand the true difference of means from the
observed difference of means. \pz  (It's the same old song...) \pz


{\large Examples of hypothesis testing for two means \pz}


\begin{example}
Estimate $\mu_{1}-\mu_{2}$ giving a confidence
interval of level $95\%$ when we have: \pz
\begin{itemize}
\item A sample of size 19 from population A, with mean
$54$, and sample standard deviation $5$.\pause 
\item A sample of size 23 from population B, with mean
$49$ and sample standard deviation $4$.\pb
\end{itemize}
\end{example}


Next we give all details in doing Exercise 17.38 from the text. 
This exercise gives some IQ data for some boys and girls from
the same midwestern school district and asks if there is a statistically
significant difference between the means. \pz
After keying some numbers into a calculator, we get the following
information for our two samples: \pz

\begin{tabular}{|l|l|l|l|l|}
\hline
Population & Mean &  Sample Size & Sample mean & Sample s.d.\\
\hline
Girls & $\mu_{1}$ & $31$ & $\overline{x}_{1}=105.84$ & $s_{1}=14.27$  \\
Boys & $\mu_{2}$ & $47$ & $\overline{x}_{2}=110.96$ & $s_{2}=12.12$  \\
\hline
\end{tabular}\pb

\begin{enumerate}
\item Our null hypothesis is that boys' IQ scores are the same as girls'
IQ scores.  That is 
\[
H_{0}:\mu_{1} = \mu_{2}. \pz
\]
Our alternative hypothesis is that boys have higher IQ scores.
\[
H_{a}:\mu_{1}<\mu_{2} \mbox{ or } \mu_{1}-\mu_{2}<0.
\] \pz

We wish to test this using our data.
\item We calculate our two-sample $t$-statistic 
\[
t =
\frac{\overline{x}_{1}-\overline{x}_{2}}{\sqrt{\frac{s_{1}^{2}}{n_{1}}+
\frac{s_{2}^{2}}{n_{2}}}} = \frac{105.84 - 110.96}{\sqrt{6.569 + 3.125}}
= \frac{-5.12}{3.114} = -1.644. \pz
\]
\item We calculate our $P$-value.  Since $H_{a}$ is
$\mu_{1}-\mu_{2}<0$, we wish to look for $P (t \leq -1.644)$.  We use
$t (30)$ since $31$ is our smaller sample size.  \pz (see p. 452 for a
more accurate way to determine degrees of freedom).

From the calculator, $P (t \leq -1.644) = .0553.$ \pb

\item We draw our conclusion: If we assume $H_{0}$ is \emph{true},
then the probability of seeing samples like the ones we have is
$.0553$.   \pz This is moderately low, so our assumption that $H_{0}$ was true
is probably wrong.  So, this is moderate evidence 
that boys score higher on IQ tests than girls.  \pz  Which is in turn
evidence that small differences
in tests such as IQ tests do not accurately reflect much of  anything. \pz 

\item We can ask the calculator to \emph{do} the test for us.  This is
under \fbox{STAT}, TESTS, 4:2-SampTTest.  We get $df = 56.93$,
$t=-1.64$, $P=.053.$

We \emph{still} need to do step 4 (conclusion) above.  And we need to
do it carefully, because we've possibly lost track of what all our
numbers mean. \pb
\end{enumerate}


\begin{example}
Physicians wish to measure the effectiveness of leech therapy on
arthritis pain (I'm not making this up!  See \\
{\tt http://www.annals.org/cgi/content/full/139/9/724})\\ \pz
They took a sample of
51 patients.  They assigned a group of 24 patients to receive ``leech
therapy,'' and a control group of 27 patients to receive a
conventional pain-relief therapy (diclofenac gel).\pause

One week after the leech treatment (it was one treatment lasting a
little over an hour involving 4 to 6 leeches), the leech group had a
mean pain index of 19.3 with a standard deviation of 12.2. \pause 

After one week of the \emph{other treatment}, the control group had a
mean pain index of 42.4 with standard deviation of 19.7. \pause 

Test the null hypothesis that the effect of treatment
by leeches is the same as the effect of conventional treatments. 
\end{example}



\end{document}
 