\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 Sampling to determine proportion of a population
having some property}  \pz

So far we have focused on using the mean (and deviation) of a sample
to extrapolate some information about the mean of an entire 
population.  \pz   These techniques are applicable in many settings, but
(in case you didn't notice) they still don't let us how the confidence
intervals of opinion polls work, for example.  \pz   Fortunately, it doesn't take
much reworking of our tools so far to address this setting.   \pz

So for example, we might be interested in the question:
what proportion of the population is left-handed?     \pz
\begin{itemize}
\item Take sample from class.  Not truly random, but probably random
enough for a question like this. \pz  Let $\hat{p}$ be the proportion of
left-handed people.   \pz
\item How well does this approximate the proportion $p$ in 
the general population?   \pb
\end{itemize}

Left-handedness is a categorical variable, with only two values (YES
and NO).  \pz So it \emph{can't} be normally distributed.   
What can a histogram look like?   \pz


But consider samples of size $10$, for example.  If we look at what
\emph{proportion} of a sample is left-handed,  we have 11 possible
values: $0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1$.   \pz

As the size of the sample increases, the number of possible values for
the proportion of left-handed people also increases.    We have the
following variant of the central limit theorem:  \pz

\begin{theorem}
Let $X$ be some random variable of a large population which
has values YES and NO.    Take SRS of size $n$ from our population, and
let $\hat{p}$ be the proportion of the sample which is ``YES.''  \pz
\begin{itemize}
\item For large $n$, the sampling distribution of $\hat{p}$ is approximately
normal;  $N (p,\sigma )$ where  \pz
\item $p$ is the proportion of the entire population which is
``YES'' and \pz
\item 
\[
\sigma = \sqrt{\frac{p (1-p)}{n}}.  
\] \pz
\end{itemize}
\end{theorem}

\begin{example}
Suppose that two-thirds of college students have cheated
on an exam.  \pz  What is the probability that in a random sample
(taken discretely) of 20 students, 15 or more would have cheated?   \pz
What is the probability that 10 or more have cheated?  \pb
\end{example}  


Getting back to statistical inference, 
we would like to do inference aimed at estimating $p$ from $\hat{p}$. \pz
The normalized $z$-statistic, which is behind the scenes of both
confidence intervals and hypothesis testing, would be
$z = \frac{\hat{p}-p}{\sigma}$  \pz
where $\sigma = \sqrt{p (1-p)/n}$ as in the theorem.  \pz
If $n$ is large, then $\hat{p}$ was approximately normal.    Thus $z$
will be approximately \emph{standard} normal.   \pz

In practice, we won't know $p$.   \pz  We use $\hat{p}$ in place of $p$ to get
the standard error in place of
the standard deviation.  \pz   So we set $s = \sqrt{\hat{p} (1-\hat{p})/n}$, and
then  $z =  \frac{\hat{p}-p}{s}$.  \pz
To get a confidence interval with certainty $C\%$, we choose $z^{*}$ a critical value
for $C$,  and then with confidence $C\%$ we know
$p$ is between $\hat{p} - z^{*} \times s$ and $\hat{p} + z^{*} \times s$.  \pz

\begin{example}
Use an in-class survey to estimate the percentage of left-handers with 90
and 95 percent confidence.   \pz
\end{example}
\newpage

To do inference, we need to know we are reasonably close to a normal
distribution.  Here are some conditions:   \pz

\begin{itemize}
\item Our sample is a SRS.   \pz
\item The population is at least 10 times the sample size.  \pz
\item The sample size is ``large enough.''  (At least 15 successes and
15 failures.)   \pz
\end{itemize}

Unfortunately, even for relatively large $n$, this can be not so close
to Normal.    Fix (recommended to always use):  the ``Plus four''
confidence interval.  \pz
Let $\overline{p} = \frac{\mbox{successes} + 2}{n+4}.$  \pz

Then the C\% confidence interval is  between
$\overline{p} - z^{*} \sqrt{\frac{\overline{p} (1-\overline{p})}{n+4}}$ and
$\overline{p} + z^{*} \sqrt{\frac{\overline{p} (1-\overline{p})}{n+4}}$.  \pz

\begin{example}
Redo our estimate for left-handers using the ``plus four'' confidence
interval.  \pz
\end{example}

\begin{example}
Establish some confidence intervals (both the usual and plus four)  
for polls found at:\\  
{\tt http://www.usatoday.com/news/polls/tables/live/2005-02-28-poll.htm}  \pb
\end{example}

\begin{example}
Find some polls on the web which publish their sample size and margin of error,
and determine with what certainty the number being measured is within
that margin or error.  \pb
\end{example}

{\large Hypothesis testing for population proportions}  \pz

\noindent {\bf  Example: Opinions about healthcare} \pz

A large poll conducted  in 2001 showed that 39\% of Americans
favored universal health care.  
Recently a poll of 
400 people found that 50\% favored universal health care.  \pz
We'd like to determine, based on this, if  more people 
now favor universal health care.  \pb

\begin{enumerate}
\item Let $p$ be the (true) proportion of people i favor
universal health care.   \pz  (We'll assume the 2001 poll is accurate so that the
proportion of people then favoring universal health care is $p_{0} =39\%$). \pz

So $H_{0}$ is  \pz$ ``p = p_{0}$'',   \pz  and $H_{a}$ is \pz  ``$  p> p_{0}$''.    \pz
 In English: Our ``null hypothesis'' is that 39\% of people now 
 support universal health care. \pz  Our ``test'' is to determine if
it is likely that \emph{more} than 39\% of people now
support universal health care.  \pb

\item We pretend that $H_{0}$ is true (that is that $p=p_{0}$), and we
calculate our $z$-statistic based on that: \pz
\[
z = \frac{\hat{p}-p_{0}}{\sqrt{\frac{p_{0} (1-p_{0})}{n}}}   = \pz
\frac{.5-.39}{\sqrt{\frac{.39 (1-.39)}{400}}}   = \frac{.11}{.0243875} = 4.51. \pz
\]  

\item We calculate our $P$-value.  \pz
\[
P (Z\geq 4.51) = .00000324. \pz
\]

This $P$-value is:  \pz {the probability of picking a sample of 400 so
that at least 200 of them favor universal health care if in the population 
only 39\% favor it.}   \pz
\item Conclusion:   {If only 39\% of people now
support universal health care, then the probability of
getting 50\% in favor of universal health care by taking a random sample of 400
people would be only $.00000324$.}   \pz


This is strong evidence that $H_{0}$ is false, and that more than 39\%
of people now support universal health care.  \pz  So we reject the
null hypothesis at almost any sensible significance level.   \pb
\end{enumerate}

{\Large Notes on applying z-test for proportions, and more examples}  \pz

In order for these confidence intervals and hypothesis tests to be valid... \pz
\begin{enumerate}
\item We need our sample to be large enough so that both $np_{0}$ and
$n(1-p_{0})$ are larger than $10$.  \pz

\item What else do we need to know about our sample?   \pz
 It needs to be an SRS.  This is hard, and is
usually the biggest reason to be skeptical about polls.  \pz
\end{enumerate}

\begin{example}
Suppose we take a SRS of 90 people under the age of 22, and discover 11 of them
have at some point had an STI.   Use this to estimate the proportion of the total
population which have had an STI?   \pz  (Note: half of the top ten most frequently   
reported diseases in the U.S., accounting for over four-fifths of all cases, are STI's).  \pz
\end{example}

\begin{example}
In a certain population, we expect 46\% of the
population to get a cold in a 3 month period.  \pz We give 264 volunteers
1000 mgs of vitamin C per day for 3 months.  At the end of the period
119 people (45\%) have gotten colds.  So the proportion of our sample
that have gotten colds is 
$\hat{p} = .45$.  \pz

Let $p$ be the proportion of people being treated with vitamin C
who will get colds.  We would like to know if there is evidence that
$p$ is smaller than $.46$. \pz
\end{example}  


\end{document}
 