\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 Testing hypotheses} \pz

Our focus in these last weeks of class will be almost exclusively on 
confidence intervals and hypothesis testing.  \pz  Last time we
slowly developed the language and methods of basic hypothesis testing. \pz
We will review these now but be more direct. \pb

\noindent{\bf General setup}: Suppose you are studying some random
variable of some population.  \pz
Suppose someone else makes a guess that the mean
\[
\mu =\mu_{0}
\]
for some number $\mu_{0}$. \pause   (And suppose that you \emph{know} the standard
deviation, $\sigma$ for the population.  We'll remove this assumption
when we study  \S  16).\pause 

You suspect that $\mu_{0}$ is incorrect;  that is that 
\[
\mu \ne \mu_{0}.
\]\pause 
Your audience will be convinced, if you can show that 
\[
P (\mu = \mu_{0}) < \alpha. \pz
\]
($\alpha$ is typically .05 or .1 or .01).  \pz  Our setup is now:\begin{itemize}
\item  {$H_{0}: \mu =\mu_{0}$}.   {Null hypothesis.}
\item  {$H_{a}: \mu \ne \mu_{0}$}.  {Alternative hypothesis.}
\item  {Significance level $\alpha$.}
\end{itemize}\pause 

To try to convince an audience that $H_{0}$ is wrong (to
{\em reject the null hypothesis}) we do the following:
\begin{enumerate}
\item [a.] Take a SRS from population of size $n$.\pause 
\item [b.] Calculate $\overline{x}$ (our sample mean) and the
$z$-statistic 
\[
z = \frac{\overline{x}-\mu_{0}}{\sigma /\sqrt{n}}
\]\pb
\item [c.] Calculate the ``P-value:'' = the probability (assuming
$H_{0}$ is true) that $\overline{x}$ is at least this far from
$\mu_{0}$ \pause  
\begin{multline*}
= P (\mbox{sample mean} \geq \mu_{0} +|\overline{x}-\mu_{0}|) +\\
   P (\mbox{sample mean} \leq \mu_{0} -|\overline{x}-\mu_{0}|) \pz \\ 
= P (Z \geq |z|) + P (Z \leq -|z|).
\end{multline*}
\pb
\item [d.]  If $P \leq \alpha$ this is \emph{statistically significant
at level $\alpha$} and leads you to reject the null hypothesis.  If
$P > \alpha$ this is not statistically significant at that
significance level, which means that you can neither reject or accept the 
null hypothesis.\pb
\end{enumerate}

\noindent NOTE:  We are concentrating on the situation where $H_{0}$
is of form $\mu =\mu_{0}$.  $H_{a}$ can be serveral things.  Either
\begin{itemize}
\item $H_{a}: \mu \ne \mu_{0}$ (if we don't know which way $\mu$ might
be off from $\mu_{0}$).  This is called the \em{two-sided alternative}.\pause 
\item $H_{a}: \mu >\mu_{0}$ (if we suspect $\mu$ might really be
larger than $\mu_{0}$).  This is called a \em{one-sided alternative}.\pause 
\item $H_{a}:\mu <\mu_{0}$ (if we suspect $\mu$ might really be
smaller than $\mu_{0}$).  This is another one-sided alternative.
\end{itemize}

\pb 
\begin{example}
 Height of men in their 20s in the US is
$N (69.3, 2.8)$.  \pz 
We suspect that the mean height of UO undergrad men
is larger than this. \pz
\begin{itemize}
\item Hypotheses: $H_{0}:\mu =69.3$.  $H_{a}: \mu >69.3$. \pz
\item Calculate $z$-statistic:  We take a SRS of 32 undergrad men from the UO.  
We discover that $\overline{x} = 70.4$ and then that 
\[
z = \frac{70.4-69.3}{2.8/\sqrt{32}}  = 2.22. \pz
\]
\item Calculate $P$-value: $P (Z \geq 2.22) = .0132$ from table A.  \pz
\item Conclusion: If $H_{0}$ is \emph{true}, the probability that
$\overline{x} \geq 70.4$ is only .0132.  This is evidence against
$H_{0}$ \pz  This $P$-value gets smaller if
we assume that $\mu$ is even smaller than $69.3$, so in fact it
gives evidence for $H_a$. \pz


At significance level $\alpha =.05$ this is statistically significant
so we reject the null hypotheses and believe $H_{a}$ is probably true. \pz

At significance level $\alpha =.01$ this is not statistically significant
so we don't reject the null hypotheses.  (Although it may still be false.) \pz
\end{itemize}
\end{example}

\pb

{\large Relating hypothesis testing to confidence intervals} \pz

The basic calculations for hypothesis testing and confidence intervals
are the same: \pz take a simple random sample, compute its mean,
and then calculate its $z$-statistics using the Central Limit Theorem.  \pz

In fact, these two procedures are logically related \pz (seeing
how helps us better understand both concepts). \pb

\begin{fact}
If some guess for a mean $\mu_0$ is not within a $1-\alpha$
confidence interval about an observed mean $\bar{x}$ then we
may reject the null hypothesis $\mu = \mu_0$ at significance
level $\alpha$. \pz
\end{fact}

It helps to sketch a picture of what this is saying and to choose some 
concrete numbers. \pz

\begin{example}
Suppose a variable has a standard deviation of $5$ and a measured mean
of  $172.1$ from a sample size of $80$.  \pz \\
\begin{itemize}
\item Find a confidence interval with $C = 95\%$ for this variable. \pz
\item Show that the null-hypothesis of a mean equal to  $175$ can 
be rejected at level $5\%$. \pb
\end{itemize}
\end{example}

{\Large Caution: garbage in, garbage out} \pz

The most common mistakes one sees in applications of
statistics are not in the mathematics of means and deviations \pz  --
with practice one can master these methods, and there
are sophisticated computer packages to help out \pz --
but in starting with biased data, whose error is comparable to
the confidence intervals in question. \pz

\begin{example}
What if in our UO height example, two of the sample taken were
members of the basketball team over 80 inches tall? \pz 
If these outliers are thrown out, what is our new confidence level
for the hypothesis that UO men are above average height? \pz
\end{example}

One of the topics of Chapter 15 is to elaborate on problems which
can plague samples and surveys, in light of their effects on 
confidence intervals and hypothesis tests.  \pz  This material 
mostly applies common sense, not mathematics, as we did
when we looked at designing surveys and experiemens.   \pz  

We will not at all cover the material from Chapter 15 on type I and II errors
and power of tests.  \pz  This development of language is straightforward enough
so that you could learn it on your own if you encountered these terms outside
of class.  \pb


{\Large \S  16: Chapters 13 and 14 \emph{without} knowing $\sigma$} \pz

In \S 13 the method we learned for estimating our population mean $\mu$ 
had the serious drawback that we had to know the standard deviation
for our population.    We now wish to approximate $\mu$ \emph{without}
knowing the standard deviation.\pb

\noindent {\bf{Basic Idea:}} Take SRS.  Calculate the standard
deviation of our sample, $s$.  This is called the \emph{standard error}
to distinguish it from the unknown standard deviation of our
population.  \pz

Calculate the mean of our sample $\overline{x}$.  Use $s$ to estimate
$\sigma$ and then techniques we've already learned to estimate $\mu$
from $\overline{x}$.\pb

TERMINOLOGY:  We use 
\[
{\mu} = \mbox{for our (unknown) \pause  {population mean},}\pause \]
 and 
\[
{\overline{x}} = \mbox{for our \pause {sample
mean}.} \pause 
\]
We now also need to distinguish between two standard deviations.
\[
{\sigma} = \mbox{for our (unknown) \pause  {populations standard
deviation}} \pause 
\]
and
\[
{s} = \mbox{for our \pause  {sample standard deviation}.}
\] \pz

Recall that if our population has distribution $N (\mu ,\sigma)$ and we
look at samples of size $n$,  our standardized sample mean
\[
z = \frac{\overline{x}-\mu}{\sigma /\sqrt{n}}
\]
has distribution $N (0,1)$.\pause 

If we look instead at the random variable 
\[
t = \frac{\overline{x}-\mu}{ {s}/\sqrt{n}}
\]
this is called the  \emph{t-statistic}. \pz

The t-statistic looks much like the z-statistic we used when 
we assumed knowledge of the true deviation.  \pz
We give the t-statistic a distinct name because unlike
the z-statistic it is {\em not} normally distributed.  \pz
If we applied the 68-95-99.7 rule, we would get incorrect 
answers! \pz

Instead, we must understand where the t-statistic
fits on what is called
the  {\em t-distribution with $n-1$ degrees of freedom}.  This
distribution is abbreviated $t(n-1)$, \pz and looks like a
normal distribution with ``fat tails'', which arise because of the
uncertainty of not knowing the true standard deviation. \pause 
If $k$ is large, $t (k) \sim  N (0,1)$. \pause 

The critical values for t-distributions are in Table C. \pz
We can check by comparing with the last row  
that with a t-statistic you need to be more deviations
away from the mean to have the same level of confidence
as a z-statistic. \pz

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

%\begin{itemize}
%\item Look for $t^{*}$ with 95\% of $t (10)$ between $t^{*}$ and
%$-t^{*}$.  \pause 
%\item From table C, $t^{*}=2.359$.\pause
%\item So 
%\[
%-t^{*} = -2.359 \leq \frac{\overline{x}-\mu}{ {s}/\sqrt{11}} \leq 2.359 =
%t^{*}.
%\]\pause 
%Using our numbers,  $\mu$ is $\overline{x} \pm
%2.359\frac{2}{\sqrt{11}} = 27 \pm 1.4225.$
%\end{itemize}

\newpage



\end{document}

Matched pairs $t$-procedures (14.3).\pause 

Look for significance level $\alpha =.1$\pause 

Suppose our data for 18 workers is
\[
35, -67, 95, -73, 5, 50, 50, 53, -61, 68, 38, -22, -13, 17, -16, -31, 62, 95
\]\pause 
$\overline{x} = 15.833$.  $s = 53.251$.\pause 

$H_{0}: \mu =0$.  $H_{a}: \mu >0$.\pause 

$t = \frac{15.833-0}{53.251/\sqrt{18}} = 1.2615$.\pause 

$P (T \geq 1.2615)$ in the $t (17)$ distribution is between .15 and .1.\pause 
 
This fails to be significant.  So we do not reject the null hypothesis.

 