\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 One-sample t-statistics}\pz

We are working in our basic framework: \pz there is some measurement
we'd like to understand over a large population; \pz sometimes there is
some guess about that measurement we would like to test; \pz so we
take great pains to obtain a random sample; \pz the question is then 
``what can we deduce about the entire population from just knowing 
this sample?''  \pz This is the basic question of study in statistics. \pb

Suppose the measurement we are interested is some mean and
we take a sample of size $n$. \pz
In one-sample t-statistics we compute the sample mean - call it $\bar{x}$. \pz
We compute the deviation of the sample, which is called the 
{\em standard error} - call it $s$.  \pz  We use $\bar{x}$ and $s$ to
compute confidence intervals or test hypothesis in pretty much the same 
manner as we did before with $s$ playing the role of $\sigma$ and,
most importantly, using the appropriate t-distribution (for size $n$) to convert
between deviations and probabilities.  \pb

\begin{itemize}
\item With probability $C\%$ the (true) mean $\mu$ has values between
$\overline{x} - t^{*}\frac{\sigma}{\sqrt{n}}$ and $\overline{x} + t^{*}\frac{\sigma}{\sqrt{n}}$, \pz
where $t^*$ is the critical value associated to the $t(n-1)$-distribution
such that there is a $C\%$ chance of finding a value between $-t^*$ and $t^*$. \pz

\item To test the null hypothesis, $H_{0}: \mu  = \mu_{0}$,\pz  we  calculate 
\[
t_0 = \frac{\overline{x}-\mu_{0}}{s /\sqrt{n}} \pz
\]
Then $P (t \geq |t_{0}|) < \alpha$
supports the alternative hypothesis $H_{a}: \mu \ne \mu_{0}$ at
level $\alpha$. \pz
\end{itemize}

\begin{example}
Use $t$-statistics to estimate population mean with confidence 95\% if we
have an SRS of size $n=11$ with $\overline{x}=27$ and $s=2$.\pause 
\end{example}

\begin{example}
With data as above, say whether or not the null-hypothesis of $\mu = 30$
can be rejected. \pz
\end{example}

We can translate other kinds of problems, such as finding sufficient 
sample sizes, immediately as well. \pz

\begin{example}
With data as above, how big a sample size is needed to 
achieve a margin of error of $0.2$ with a confidence level of $99\%$?\pb
\end{example}

{\large Matched pairs t-procedures} \pz

As we saw earlier in the quarter, experiments are more convincing than 
surveys, so it is helpful to see the use of t-statistics in this setting. \pz
In a {\em matched-pairs} experiment, similar subjects are matched up and
then at random given two different treatments, with the results then 
measured and compared. \pb

\begin{example}
Suppose a matched-pairs experiment is set up comparing two diets: 
the SeeFood diet and the HiPhat diet. \pz  Matched pairs each go
on one of these diets and the difference in weight loss  is 
taken in each pair.  \pz  The data over 18 matched pairs is as follows: \pz
\begin{multline*}
3.5, -6.7, 9.5, -7.3,  0.5, 5.0, 5.0, 5.3, -6.1, 6.8, \\
3.8, -2.2, -1.3, 1.7, -1.6, -3.1, 6.2, 9.5
\end{multline*} \pause 
(Here a value of 3.5 means that in the first pair the SeeFood person ``lost'' 3.5 pounds
more than the HiPhat person \pz (it could be that the SeeFood person gained 5
pounds while the HiPhat person gained 8.5 pounds)). \pz
Test the hypothesis that SeeFood leads to more weight loss than HiPhat
at level $\alpha = 5\%$.  \pz  (To get started: $\overline{x} = 1.58$.  $s = 5.32$.)\pb
\end{example}

{\large When t-procedures are applicable} \pz

In learning basic methods of confidence intervals and hypothesis tests,
we assumed that the sample taken was big enough that the Central
Limit Theorem implied a normal sampling distribution. \pz Now that
we are doing t-procedures, which are more realistic, we should address 
when they are applicable in practice. \pb

\begin{fact}
\begin{itemize}
\item If the sample size is less than 15, you can use t-procedures if the data
is close to Normal \pz (symmetric, \pz single peak, \pz no outliers) \pz. 
\item If the sample size is over 15, t-procedures can be used except
when there are outliers or when the distribution is strongly skewed. \pz
\item If the sample size is (roughly) over 40, t-procedures can always
be used. \pz
\end{itemize}
And most importantly, the sample must be random!! \pb
\end{fact}



\begin{example}
Produce three different data shapes and sizes where t-procedures may be used, and
three different data shapes and size where they may not be used. \pb
\end{example}

{\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.  \pz  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. \pz  Above 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

\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}

\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}
 