\setcounter{ExampleCounter}{1}
We'll do these four steps in every example in this section:
\paragraph{Step 1:} State the hypotheses.
\paragraph{Step 2:} Calculate the test statistic.
\paragraph{Step 3:} Calculate the p value.
\paragraph{Step 4:} Draw a conclusion.

We'll show three types of examples:
\begin{enumerate}
\item Testing a claim about the population mean, when the population standard deviation is given.
\item Testing a claim about the population mean, when the population standard deviation is unknown.
\item Testing a claim about the population proportion.
\end{enumerate}

Then we'll mix up a bunch of examples in order to get practice with deciding what kind of problem we're up against.

\paragraph{Note:} If no significance level is given, use $\alpha = 0.05$ as a rule of thumb.
\vfill
\pagebreak

\begin{center}
\includegraphics[width=0.6\textwidth]{xkcdSignificant}
\end{center}
\hspace{3.5in} xkcd.com
\vfill
\pagebreak

\subsection{Mean, Population Standard Deviation\\ Known}

\begin{example}{Facebook Time}
A study by the Web metrics firm Hitwise showed that in August 2008, the mean time spent per visit to Facebook was 19.5 minutes.  Assume the standard deviation of the population is 8 minutes.  Suppose that a simple random sample of 100 visits in August 2009 has a sample mean of 21.5 minutes.  A social scientist is interested in knowing whether the mean time of Facebook visits has increased.  Conduct a hypothesis test to determine this.  Use a significance level of 0.05.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 19.5\\
H_1:\ &\mu > 19.5
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\overline{x}-\mu}{\sigma/\sqrt{n}}\\
 &= \dfrac{21.5-19.5}{8/\sqrt{100}}\\
 &= 2.50
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$\mu=19.5$,{$\overline{x}=21.5$\\$z=2.50$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(2.50,1000000,0,1)} $= 0.0062$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p$ is small ($< 0.05$), we reject the null hypothesis, so we agree that the mean time spent on Facebook has increased.
\end{example}
\vfill
\pagebreak

\begin{example}{Average Male Height}
According to the National Health Statistics Reports, the mean height for U.S. men is 69.4 inches, and the population standard deviation is 2.84.  In a sample of 300 men between the ages of 60 and 69, the mean height was 69.0 inches.  Public health officials want to determine whether the mean height for older men is less than the mean height of all men.  Conduct a hypothesis test to answer this question.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \geq 69.4\\
H_1:\ &\mu < 69.4
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\overline{x}-\mu}{\sigma/\sqrt{n}}\\
 &= \dfrac{69-69.4}{2.84/\sqrt{300}}\\
 &= -2.44
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-2,0}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\overline{x}=69$\\$z=-2.44$},$\mu=69.4$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  %\addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  \addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


%\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p/2$} (axis cs:4,0);
\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(-1000000,-2.44,0,1)} $= 0.0073$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p$ is small ($< 0.01$), we reject the null hypothesis, so we agree that the average height for older men is less than the average height of all men.
\end{example}
\vfill
\pagebreak

\begin{example}{Child Weight}
Are children heavier now than they were in the past?  The National Health and Nutrition Examination Survey taken between 1999 and 2002 reported that the mean weight of six-year-old girls in the U.S. was 49.3 pounds.  Another NHANES survey, published in 2008, reported that a sample of 193 six-year-old girls weighed between 2003 and 2006 had an average weight of 51.5 pounds.  Assume that the population standard deviation is 15 pounds.  Can you conclude that the mean weight of six-year-old girls is higher in 2006 than in 2002?  Use a significance level of 0.01.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 49.3\\
H_1:\ &\mu > 49.3
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\overline{x}-\mu}{\sigma/\sqrt{n}}\\
 &= \dfrac{51.5-49.3}{15/\sqrt{193}}\\
 &= 2.04
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$\mu=49.3$,{$\overline{x}=51.5$\\$z=2.04$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(2.04,1000000,0,1)} $= 0.0207$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.01$, we fail to reject the null hypothesis, so we cannot conclude that children are heavier than they were in the past.
\end{example}
\vfill
\pagebreak

\subsection{Mean, Population Standard Deviation\\ Unknown}

\begin{example}{Family Practitioner Salary}
The Bureau of Labor Statistics reported that in May 2009, the mean annual earnings of all family practitioners in the United States was \$168,550.  A random sample of 55 family practitioners in Missouri that month had mean earnings of \$154,590 with a standard deviation of \$42,750.  Do the data provide sufficient evidence to conclude that the mean salary for family practitioners in Missouri is less than the national average?  Use the $\alpha=0.05$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \geq \$168,550\\
H_1:\ &\mu < \$168,550
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
t &= \dfrac{\overline{x}-\mu}{s/\sqrt{n}}\\
 &= \dfrac{154,590 - 168,550}{42,750/\sqrt{55}}\\
 &= -2.422
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-2,0}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\overline{x}={154,590}$\\$t=-2.422$},$\mu={168,550}$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  %\addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  \addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


%\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p/2$} (axis cs:4,0);
\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{tcdf(-1000000,-2.422,54)} $= 0.0094$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p < 0.05$, we reject the null hypothesis, so we conclude that the mean salary for family practitioners in Missouri is lower than the national average.
\end{example}
\vfill
\pagebreak

\begin{example}{Baby Boy Weight}
The National Health Statistics Reports described a study in which a sample of 360 one-year-old baby boys were weighed.  Their mean weight was 25.5 pounds with standard deviation 5.3 pounds.  A pediatrician claims that the mean weight of one-year-old boys is greater than 25 pounds.  Do the data provide convincing evidence that the pediatrician's claim is true?  Use the $\alpha=0.01$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 25\\
H_1:\ &\mu > 25
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
t &= \dfrac{\overline{x}-\mu}{s/\sqrt{n}}\\
 &= \dfrac{25.5 - 25}{5.3/\sqrt{360}}\\
 &= 1.79
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$\mu=25$,{$\overline{x}=25.5$\\$t=1.79$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{tcdf(1.79,1000000,359)} $= 0.0371$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.01$, we fail to reject the null hypothesis, so we cannot conclude that the mean weight of one-year-old boys is greater than 25 pounds.
\end{example}
\vfill
\pagebreak

\begin{example}{Commute Time}
A 2007 Gallup poll sampled 1019 people, and asked them how long it took them to commute to work each day.  The sample mean one-way commute time was 22.8 minutes with a standard deviation of 17.9 minutes.  A transportation engineer claims that the mean commute time is greater than 20 minutes.  Do the data provide convincing evidence that the engineer's claim is true?  Use the $\alpha=0.05$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 20\\
H_1:\ &\mu > 20
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
t &= \dfrac{\overline{x}-\mu}{s/\sqrt{n}}\\
 &= \dfrac{22.8 - 20}{17.9/\sqrt{1019}}\\
 &= 4.99
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$\mu=20$,{$\overline{x}=22.8$\\$t=4.99$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{tcdf(4.99,1000000,1018)} $= 0.000000355$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p < 0.05$, we reject the null hypothesis, so we conclude that the engineer's claim is true.
\end{example}
\vfill
\pagebreak

\subsection{Proportion}

\begin{example}{Job Satisfaction}
A nationwide survey of working adults indicates that only 50\% of them are satisfied with their jobs.  The president of a large company believes that more than 50\% of employees at his company are satisfied with their jobs.  To test his belief, he surveys a random sample of 100 employees, and 54 of them report that they are satisfied with their jobs.  Can he conclude that more than 50\% of employees at the company are satisfied with their jobs?  Use the $\alpha=0.05$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &p \leq 0.5\\
H_1:\ &p > 0.5
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\hat{p}-p}{\sqrt{\dfrac{p(1-p)}{n}}}\\
 &= \dfrac{0.54-0.5}{\sqrt{\dfrac{0.5(1-0.5)}{100}}}\\
 &= 0.80
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$p=0.5$,{$\hat{p}=0.54$\\$z=0.80$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(0.80,1000000,0,1)} $= 0.2119$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.05$, we fail to reject the null hypothesis.  There is not enough evidence to conclude that the president is correct in his belief.
\end{example}
\vfill
\pagebreak

\begin{example}{Spam}
According to MessageLabs Ltd., 89\% of all email sent in July 2010 was spam.  A system manager at a large corporation believes that the percentage at his company may be 80\%.  He examines a random sample of 500 emails received at an email server and finds that 382 of the messages are spam.  Using a significance level of $\alpha=0.05$, can you conclude that the percentage of emails that are spam differs from 80\%?

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &p = 0.8\\
H_1:\ &p \neq 0.8
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\[\hat{p} = \dfrac{382}{500} = 0.764\]
\begin{align*}
z &= \dfrac{\hat{p}-p}{\sqrt{\dfrac{p(1-p)}{n}}}\\
 &= \dfrac{0.764-0.8}{\sqrt{\dfrac{0.8(1-0.8)}{500}}}\\
 &= -2.012
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-2,0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\hat{p}=0.764$\\$z=-2.012$},$p=0.8$,$z=2.012$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  \addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p/2$} (axis cs:4,0);
\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(-1000000,-2.012,0,1)} $= 0.0221$\\
Multiply this by 2: $p=0.0442$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p < 0.05$, we reject the null hypothesis.  We conclude that the percentage of spam emails at this company differs from 80\%.
\end{example}
\vfill
\pagebreak

\begin{example}{Children with Cell Phones}
A marketing manager for a cell phone company claims that more than 35\% of children aged 10--11 have cell phones.  In a 2009 survey of 5000 children aged 10--11 by Mediamark Research and Intelligence, 1805 of them had cell phones.  Can you conclude that the manager's claim is true?  Use the $\alpha=0.01$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &p \leq 0.35\\
H_1:\ &p > 0.35
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\[\hat{p} = \dfrac{1805}{5000} = 0.361\]
\begin{align*}
z &= \dfrac{\hat{p}-p}{\sqrt{\dfrac{p(1-p)}{n}}}\\
 &= \dfrac{0.361-0.35}{\sqrt{\dfrac{0.35(1-0.35)}{5000}}}\\
 &= 1.631
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$p=0.35$,{$\hat{p}=0.361$\\$z=1.631$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(1.631,1000000,0,1)} $= 0.0221$\\
Multiply this by 2: $p=0.0514$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.01$, we fail to reject the null hypothesis.  We cannot conclude that more than 35\% of children have cell phones.
\end{example}
\vfill
\pagebreak

\subsection{Using Your Calculator}
To access the hypothesis tests on the TI calculator, press \includegraphics[height=0.3in]{CalcStatButton} and scroll over to the \texttt{TESTS} menu:
\begin{center}
\includegraphics[width=3in]{CalcStatTests}
\end{center}

\begin{enumerate}
\item \textbf{Mean, Population Standard Deviation Known}
\begin{center}
Use \texttt{1: Z-Test}.\\
\vspace{0.2in}

\includegraphics[width=3in]{CalcZTestStats}\\
(enter given stats and select the appropriate alternate hypothesis)\\
\vspace{0.2in}

\includegraphics[width=3in]{CalcZTestData}\\
(enter the data into \texttt{L1} and select the appropriate alternate hypothesis)
\end{center}
\vfill
\pagebreak

\item \textbf{Mean, Population Standard Deviation Unknown}

Use \texttt{2: T-Test}, and do it the same way as the \texttt{Z-Test}.

\item \textbf{Proportion}
\begin{center}
Use \texttt{5: 1-PropZTest}.\\
\vspace{0.2in}

\includegraphics[width=3in]{Calc1PropZTest}
\end{center}
\end{enumerate}
\vfill
\pagebreak

\subsection{Assorted Examples}

\begin{example}{Time Watching TV}
In 2008, the General Social Survey asked a sample of 1324 people how much time they spent watching TV each day.  The mean number of hours was 2.98 with a standard deviation of 2.66.  A sociologist claims that people watch a mean of 3 hours of TV per day.  Do the data provide sufficient evidence to disprove the claim?  Use the $\alpha=0.01$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu = 3\\
H_1:\ &\mu \neq 3
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
t &= \dfrac{\overline{x}-\mu}{s/\sqrt{n}}\\
 &= \dfrac{2.98 - 3}{2.66/\sqrt{1324}}\\
 &= -0.274
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-1,0,1}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\overline{x}=2.98$\\$t=-0.274$},$\mu=3$,$t=0.274$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=1:4] {gauss(0,1)} \closedcycle;
  \addplot [fill=cyan!40, draw=none, domain=-4:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:1,0) -- node [fill=white] {$p/2$} (axis cs:4,0);
\draw [yshift=-0.75cm, -latex](axis cs:-1,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{tcdf(-1000000,-0.274,1323)} $= 0.392$\\
Multiply this by 2: $p=0.784$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.05$, we fail to reject the null hypothesis, so we disagree with the sociologist.
\end{example}
\vfill
\pagebreak

\begin{example}{Scale Calibration}
NIST is the National Institute of Standards and Technology.  Suppose that NIST technicians are testing a scale by using a weight known to weigh exactly 1000 grams.  They weigh this weight on the scale 50 times and read the result each time, finding a sample mean of 1000.6 grams.  If the standard deviation is known to be 2 grams, perform a hypothesis test to determine whether the scale is out of calibration.  Use a significance level of 0.05.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu = 1000\\
H_1:\ &\mu \neq 1000
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\overline{x}-\mu}{\sigma/\sqrt{n}}\\
 &= \dfrac{1000.6-1000}{2/\sqrt{50}}\\
 &= 2.12
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-2,0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$z=-2.12$,$\mu=1000$,{$\overline{x}=1000.6$\\$z=2.12$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  \addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p/2$} (axis cs:4,0);
\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(2.12,1000000,0,1)} $= 0.017$\\
Multiply this by 2: $p=0.034$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p < 0.05$, we reject the null hypothesis, so the scale is out of calibration.
\end{example}
\vfill
\pagebreak

\begin{example}{Environmental Interest}
In 2008, the General Social Survey asked 1493 U.S. adults to rate their level of interest in environmental issues.  Of these, 751 said that they were ``very interested.''  Does the survey provide convincing evidence that more than half of U.S. adults are very interested in environmental issues?  Use the $\alpha=0.05$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &p \leq 0.5\\
H_1:\ &p > 0.5
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\[\hat{p} = \dfrac{751}{1493} = 0.503\]
\begin{align*}
z &= \dfrac{\hat{p}-p}{\sqrt{\dfrac{p(1-p)}{n}}}\\
 &= \dfrac{0.503-0.5}{\sqrt{\dfrac{0.5(1-0.5)}{1493}}}\\
 &= 0.2318
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,1}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$p=0.5$,{$\hat{p}=0.503$\\$z=0.2318$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=1:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:1,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(0.2318,1000000,0,1)} $= 0.4083$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.05$, we fail to reject the null hypothesis.  We cannot conclude that more than 50\% of US adults are very interested in environmental issues.
\end{example}
\vfill
\pagebreak

\begin{example}{Tire Lifetimes}
A particular brand of tires claims that its deluxe tire averages more than 50,000 miles before it needs to be replaced.  From past studies of this tire, the standard deviation is known to be 8,000.  A survey of owners of that tire design is conducted.  From the 28 tires surveyed, the mean lifespan was 46,500 miles.  Using $\alpha=0.05$, is the data consistent with the claim?

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 50,000\\
H_1:\ &\mu > 50,000
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\overline{x}-\mu}{\sigma/\sqrt{n}}\\
 &= \dfrac{46,500-50,000}{8000/\sqrt{28}}\\
 &= -2.315
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-2,0}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\overline{x}={46,500}$\\$z=-2.315$},$\mu={50,000}$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=-2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(-2.315,1000000,0,1)} $= 0.9897$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.05$, we fail to reject the null hypothesis, so we cannot conclude that the tires last more than 50,000 miles.
\end{example}
\vfill
\pagebreak

\begin{example}{Age of Smokers}
From generation to generation, the mean age when smokers first start to smoke varies.  However, the standard deviation of that age remains constant at 2.1 years.  A survey of 40 smokers of this generation was done to see if the mean starting age is greater than 19, and the sample mean was 18.1.  Do the data support the claim at the 5\% level?

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 19\\
H_1:\ &\mu > 19
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
z &= \dfrac{\overline{x}-\mu}{\sigma/\sqrt{n}}\\
 &= \dfrac{18.1-19}{2.1/\sqrt{40}}\\
 &= -2.71
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-2,0}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\overline{x}=18.1$\\$z=-2.71$},$\mu=19$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=-2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(-2.71,1000000,0,1)} $= 0.9966$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.05$, we fail to reject the null hypothesis, so we cannot conclude that the mean starting age is greater than 19.
\end{example}
\vfill
\pagebreak

\begin{example}{Gastroplasty}
Vertical banded gastroplasty is a surgical procedure that reduces the volume of the stomach in order to produce weight loss.  In a recent study, 82 patients with Type 2 diabetes underwent this procedure, and 59 of them experienced a recovery from diabetes.  Does this study provide convincing evidence that more than 60\% of those with Type 2 diabetes who undergo this surgery will recover from diabetes?  Use the $\alpha=0.05$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &p \leq 0.6\\
H_1:\ &p > 0.6
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\[\hat{p} = \dfrac{59}{82} = 0.7195\]
\begin{align*}
z &= \dfrac{\hat{p}-p}{\sqrt{\dfrac{p(1-p)}{n}}}\\
 &= \dfrac{0.7195-0.6}{\sqrt{\dfrac{0.6(1-0.6)}{82}}}\\
 &= 2.21
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$p=0.6$,{$\hat{p}=0.72$\\$z=2.21$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(2,21,1000000,0,1)} $= 0.0136$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p < 0.05$, we reject the null hypothesis.  We conclude that more than 60\% of those with Type 2 diabetes who undergo this surgery will recover from diabetes (note that if we used $\alpha = 0.01$, the conclusion would be reversed).
\end{example}
\vfill
\pagebreak

\begin{example}{Sick Days}
The mean number of sick days an employee takes per year is believed to be about ten.  Members of a personnel department do not believe this figure.  They randomly survey eight employees, and the number of sick days they took for the past year are as follows:
\begin{center}
12,\ 4,\ 15,\ 3,\ 11,\ 8,\ 6,\ 8.
\end{center}
Should the personnel team believe that the mean number is ten?\\

Note:
\begin{align*}
\overline{x} &= 8.375\\
s = 4.104
\end{align*}

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu = 10\\
H_1:\ &\mu \neq 10
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
t &= \dfrac{\overline{x}-\mu}{s/\sqrt{n}}\\
 &= \dfrac{8.375 - 10}{4.104/\sqrt{8}}\\
 &= -1.12
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={-1,0,1}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={{$\overline{x}=8.375$\\$t=-1.12$},$\mu=10$,$z=1.12$},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=1:4] {gauss(0,1)} \closedcycle;
  \addplot [fill=cyan!40, draw=none, domain=-4:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:1,0) -- node [fill=white] {$p/2$} (axis cs:4,0);
\draw [yshift=-0.75cm, -latex](axis cs:-1,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{tcdf(-1000000,-1.12,7)} $= 0.1498$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.05$, we fail to reject the null hypothesis, so we disagree with the members of the personnel department.
\end{example}
\vfill
\pagebreak

\begin{example}{Cable TV Channel}
A telecom company provided its cable TV subscribers with free access to a new sports channel for a period of one month.  It then chose a sample of 400 television viewers and asked them whether they would be willing to pay an extra \$10 per month to continue to access the channel.  A total of 25 of the 400 replied that they would be willing to pay.  The marketing director of the company claims that more than 5\% of all its subscribers would pay for the channel.  Can you conclude that the director's claim is true?  Use the $\alpha=0.01$ level of significance.

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &p \leq 0.05\\
H_1:\ &p > 0.05
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\[\hat{p} = \dfrac{25}{400} = 0.0625\]
\begin{align*}
z &= \dfrac{\hat{p}-p}{\sqrt{\dfrac{p(1-p)}{n}}}\\
 &= \dfrac{0.0625-0.05}{\sqrt{\dfrac{0.05(1-0.05)}{400}}}\\
 &= 1.147
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,1}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$p=0.05$,{$\hat{p}=0.0625$\\$z=1.147$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=1:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:1,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p/2$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{normalcdf(1.147,1000000,0,1)} $= 0.1257$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p > 0.01$, we fail to reject the null hypothesis.  We disagree with the director's claim.
\end{example}
\vfill
\pagebreak

\begin{example}{Trout IQ}
A Nissan ad read, ``The average man's IQ is 107.  The average brown trout's IQ is 4.  So why can't a man catch a brown trout?''  Suppose you believe that the brown trout's mean IQ is greater than four.  You catch 12 brown trout, and a fish psychologist determines that their IQs are
\begin{center}
5,\ 4,\ 7,\ 3,\ 6,\ 4,\ 5,\ 3,\ 6,\ 3,\ 8,\ 5.
\end{center}
Conduct a hypothesis test of your belief.\\

Note:
\begin{align*}
\overline{x} &= 4.92\\
s &= 1.62
\end{align*}

\paragraph{Step 1:} State the hypotheses.
\begin{align*}
H_0:\ &\mu \leq 4\\
H_1:\ &\mu > 4
\end{align*}

\paragraph{Step 2:} Calculate the test statistic.  
\begin{align*}
t &= \dfrac{\overline{x}-\mu}{s/\sqrt{n}}\\
 &= \dfrac{4.92 - 4}{1.62/\sqrt{12}}\\
 &= 1.967
\end{align*}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
  no markers, domain=-4:4, samples=100,
  axis lines*=none, xlabel=$x$,
  hide y axis,
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  height=5cm, width=12cm,
  xtick={0,2}, 
  ytick=\empty,
  xticklabel style={align=right},
  xticklabels={$\mu=4$,{$\overline{x}=4.92$\\$t=1.967$}},
  enlargelimits=false, clip=false, %axis on top,
  %grid = major
  ]
  \addplot [fill=cyan!40, draw=none, domain=2:4] {gauss(0,1)} \closedcycle;
  %\addplot [fill=cyan!40, draw=none, domain=-4:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=-2:-1] {gauss(0,1)} \closedcycle;
  %\addplot [fill=yellow!20, draw=none, domain=1:2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=-3:-2] {gauss(0,1)} \closedcycle;
  %\addplot [fill=green!20, draw=none, domain=2:3] {gauss(0,1)} \closedcycle;
  \addplot [very thick,cyan!40!black] {gauss(0,1)};


\draw [yshift=-0.75cm, -latex](axis cs:2,0) -- node [fill=white] {$p$} (axis cs:4,0);
%\draw [yshift=-0.75cm, -latex](axis cs:-2,0) -- node [fill=white] {$p$} (axis cs:-4,0);
\end{axis}

\end{tikzpicture}
\end{center}

\paragraph{Step 3:} Calculate the p value that corresponds to this area.  Use the table or calculator.
\begin{center}
\texttt{tcdf(1.967,1000000,11)} $= 0.0375$
\end{center}

\paragraph{Step 4:} Draw a conclusion.\\

Since $p < 0.05$, we reject the null hypothesis, so we conclude that the average IQ of brown trout is greater than 4.
\end{example}
\vfill
\pagebreak


