\setcounter{ExampleCounter}{1}
This is where you may have run across the term \emph{margin of error} before: political polls often give a percentage of voters in each category, and then state something like a margin of error of three percent.  This means, of course, that the percentages could be three percent higher or lower than what is reported.\\

In this section, we'll deal with confidence intervals for proportions like that.  In each example, there will be a sample size, and a number within that sample that respond one way.  We want to know what this tells us about what proportion of the population would respond that way.

\begin{itemize}
\item The sample size is $n$.
\item The number of people who respond in the desired way is $x$.
\item The sample proportion is $\hat{p}$, which is a point estimate for the population proportion $p$:
\[\hat{p} = \dfrac{x}{n}\]
\item We assume that the sampling distribution is normal with mean $p$ (the true value) and standard deviation 
\[\sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}\]
\item We assume that the population is at least 20 times larger than the sample, and the sample contains at least 10 people in each category (yes and no).
\end{itemize}

The confidence interval, just like before, is
\begin{align*}
\textrm{Point estimate } &\pm z_{\alpha/2} \cdot \textrm{ Standard deviation of the sampling distribution}\\
\hat{p} &\pm z_{\alpha/2} \cdot \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}
\end{align*}

The formula is more complicated than before, but the problems are actually simpler, since there's less to keep track of (all we really need is $x$ and $n$).
\vfill
\pagebreak

\begin{example}{Android Loyalty}
The Nielsen Company surveyed 225 owners of Android phones and found that 160 of them planned to get another Android as their next phone.
\begin{enumerate}[(a)]
\item Construct a 95\% confidence interval for the proportion of Android users who plan to get another Android. 

\begin{align*}
x &= 160\\
n &= 225\\
\longrightarrow \hat{p} &= 0.711
\end{align*}

For a 95\% CI, the z value is \[z_{\alpha/2} = 1.96,\] so the confidence interval is
\begin{align*}
0.711 &\pm 1.96 \cdot \sqrt{\dfrac{(0.711)(0.299)}{225}}\\
&= 0.711 \pm 0.59 = (0.652, 0.770)
\end{align*}

\item Assume that an advertisement claimed that 70\% of Android users plan to get another Android.  Does the confidence interval contradict this claim?\\

No.
\end{enumerate}
\end{example}
\vfill

\subsection{Using Your Calculator}
Press the \includegraphics[height=0.3in]{CalcStatButton} button and scroll over to the \texttt{TESTS} menu.  Scroll down to \texttt{A: 1-PropZInt}.
\begin{center}
\includegraphics[width=2.5in]{Calc1PropZInt}
\end{center}
When you press enter and see the menu, all you have to enter is $x$, $n$, and the confidence level.
\pagebreak

\begin{center}
\includegraphics[width=2.5in]{Calc1PropZInt2}
\end{center}


\begin{example}{Working from Home}
According to the U.S Census Bureau, 43\% of men who worked at home were college graduates.  In a sample of 500 women who worked at home, 162 were college graduates.  Construct a 98\% confidence interval for the proportion of women who work at home who are college graduates.  Is it reasonable to believe that this is the same as the proportion for men?\\

Enter the \texttt{1-PropZInt} menu:
\begin{center}
\includegraphics[width=2.5in]{Calc1PropZIntEx}
\end{center}

When you press \texttt{Calculate}, you'll see
\begin{center}
\includegraphics[width=2.5in]{Calc1PropZIntEx2}
\end{center}

The confidence interval, then, is 
\[(0.27531, 0.37269).\]
Therefore, we conclude that no, the proportion for women must be lower than the proportion for men (43\%).
\end{example}
\vfill
\pagebreak

\begin{example}{ISP Quality Control}
An Internet service provider sampled 540 customers, and found that 75 of them experienced an interruption in high-speed service during the previous month.  Construct a 90\% confidence interval for the proportion of all customers who experienced an interruption.  The company's quality control manager claims that no more than 10\% of its customers experienced an interruption during the previous month.  Does the confidence interval contradict this claim?\\

In this example,
\begin{align*}
x &= 75\\
n &= 540
\end{align*}

Using the calculator, you can find that the confidence interval is
\[(0.11441, 0.16337).\]
Therefore, this confidence interval contradicts the manager's claim.
\end{example}
\vspace{0.5in}

\begin{example}{Health Insurance}
In 2008, the General Social Survey asked 182 people whether they received health insurance as a benefit from their employer.  A total of 60 people said they did.  Construct a 95\% confidence interval for the proportion of people who receive health insurance from their employer.\\

In this example,
\begin{align*}
x &= 60\\
n &= 182
\end{align*}

Note that \[\hat{p} = \dfrac{60}{182} = 0.32967.\]

Using the calculator, you can find that the confidence interval is
\[(0.26137, 0.39797).\]
The true proportion, then, was between 26\% and 40\%.
\end{example}
\vfill
\pagebreak

\subsection{Calculating Sample Size}

\paragraph{Note:} A larger sample leads to a smaller margin of error.

What if you have a specific margin of error in mind?  What sample size do you need?

\begin{example}{Find Sample Size}
Suppose a polling company wants to ensure that their next political poll has a margin of error of three percentage points or less, using a 95\% confidence level.  How many voters should the company poll to make this happen?\\

Remember, the margin of error is
\[z_{\alpha/2} \cdot \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}.\]

For a 95\% confidence interval, the z value is 
\[z_{\alpha/2} = 1.96.\]

What about $\hat{p}$?  We don't know the sample proportion, because we haven't done the poll yet.  Therefore, we go to the worst case scenario: the margin of error is largest when $\hat{p}(1-\hat{p})$ is largest, and this happens when $\hat{p}=0.5$, so that's what we'll assume (if it isn't, our margin of error will just be smaller than three percentage points).

\begin{align*}
0.03 &= z_{\alpha/2} \cdot \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}\\
0.03 &= 1.96 \cdot \sqrt{\dfrac{0.5(0.5)}{n}}\\
\dfrac{0.03}{1.96} &= \sqrt{\dfrac{0.25}{n}}\\
\dfrac{0.03^2}{1.96^2} &= \dfrac{0.25}{n}\\
n \cdot \dfrac{0.03^2}{1.96^2} &= 0.25\\
n &= 0.25 \cdot \dfrac{1.96^2}{0.03^2}\\
\\
n &= 1067.11
\end{align*}

Therefore, the sample size should be at least 1068.  Incidentally, this is why you often see poll results with a margin of error of 3\%, because 1000 people is a nice round number to poll.
\end{example}
\vfill
\pagebreak

\begin{center}
\includegraphics[width=0.9\textwidth]{xkcdMarginOfError}\\
\hfill xkcd.com
\end{center}

\vfill
\pagebreak
