\setcounter{ExampleCounter}{1}
What we did in the last section is rarely, if ever, done.
\paragraph{Note:} The population standard deviation is never known in practice.
\begin{itemize}
\item If the sample is large enough, using $s$ instead of $\sigma$ and using the z table is a good enough approximation.
\item For small samples ($n < 30$), this breaks down.
\end{itemize}
Instead of a CI that looks like
\[\overline{x} \pm z_{\alpha/2} \cdot \dfrac{\sigma}{\sqrt{n}}\]
we'll have one know that looks like
\[\overline{x} \pm t_{\alpha/2} \cdot \dfrac{s}{\sqrt{n}}.\]
Notice:
\begin{itemize}
\item We replaced the unknown population standard deviation $\sigma$ with the known sample standard deviation $s$.
\item We replaced $z_{\alpha/2}$ with $t_{\alpha/2}$. What is this $t$?
\end{itemize}
\vfill
\subsection{The $t$ Distribution}
The $t$ distribution is necessary when $\sigma$ is unknown and the sample size is small, but nowadays, it's used pretty much all the time (since $\sigma$ is always unknown).
When the sample size is large, the $t$ distribution is nearly indistinguishable from the normal distribution.
\pagebreak
\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}, ytick=\empty,
xticklabels={0},
enlargelimits=false, clip=false, %axis on top,
%grid = major
]
%\addplot [fill=cyan!40, draw=none, domain=-4:1] {gauss(0,1.3)} \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.3)};
%\draw [yshift=2.5cm, latex-latex](axis cs:-1,0) -- node [fill=white] {68\%} (axis cs:1,0);
\end{axis}
\end{tikzpicture}
\end{center}
The $t$ distribution:
\begin{itemize}
\item Depends on the sample size. The \textbf{degrees of freedom} of a $t$ distribution is $df=n-1$. The more degrees of freedom, the closer this is to the normal distribution.
\item The mean is 0 and the distribution is symmetric about 0.
\item The $t$ distribution is shorter than the normal distribution, with thicker tails.
\item We assume that the population is normally distributed.
\item The meaning of $t_{\alpha/2}$ is similar to the meaning of $z_{\alpha/2}$.
\end{itemize}
To find $t_{\alpha/2}$, we can use either a table or a calculator (TI-84+ and up). The table looks like this (the full table is in the appendix):
\begin{center}
\includegraphics[width=0.9\textwidth]{tDist}
\end{center}
Be careful: different books record the $t$ table in different ways; all the results will be equal, but you may need to read the table differently.
\vfill
\pagebreak
\begin{example}{Finding t}
Find $t_{\alpha/2}$ to construct a 90\% confidence interval based on a sample of 7 items.\\
Again, if 90\% of the data is in the middle, 5\% is in each of the tails, so we're looking for the 95th percentile. Since $n=7$, $df=6$, so look in the 95\% column and the 6 row:
\[t_{\alpha/2} = 1.943\]
\end{example}
\begin{example}{Finding t with a Calculator}
Find the same $t$ value using a calculator.\\
The TI-84+ and later models have a \texttt{invT} function located directly beneath \texttt{invNorm}.
Press \includegraphics[height=0.3in]{Calc2ndVars} to access the \texttt{DISTR} menu, then select \text{4: invT}. This function requires two inputs: \texttt{area} and \texttt{df}. Enter 0.95 and 6, respectively:
\begin{center}
\includegraphics[width=3in]{CalcinvT}
\end{center}
The answer is the same.
\end{example}
\vfill
\pagebreak
\subsection{Confidence Intervals with $t$}
Now that we can find $t_{\alpha/2}$, we can find $t$ confidence intervals:
\[\overline{x} \pm t_{\alpha/2} \cdot \dfrac{s}{\sqrt{n}}\]
All we have to do is
\begin{enumerate}
\item Calculate the sample mean $\overline{x}$.
\item Calculate the sample standard deviation $s$.
\item Find $t_{\alpha/2}$.
\item Put everything in the formula and crunch the numbers.
\end{enumerate}
\begin{example}{Potato Chip Bags}
A potato chip company wants to evaluate the accuracy of its potato chip bag-filling machine. Bags are labeled as containing 8 ounces of potato chips. A simple random sample of 12 bags had mean weight 8.12 ounces with a sample standard deviation of 0.1 ounce. Construct a 99\% confidence interval for the population mean weight of bags of potato chips.\\
We're already given the following:
\begin{align*}
\overline{x} &= 8.12\\
s &= 0.1\\
n &= 12\\
\end{align*}
All we have to do is find $t_{\alpha/2}$. On the table, look at the column labeled 99.5\% and the row where $df=11$: \[t_{\alpha/2} = 3.106\]
Using the calculator:
\begin{center}
\includegraphics[width=2.5in]{CalcinvTEx}
\end{center}
Therefore the confidence interval is
\begin{align*}
8.12 &\pm (3.106) \cdot \left(\dfrac{0.1}{\sqrt{12}}\right)\\
&= 8.12 \pm 0.09 = (8.03, 8.21)
\end{align*}
\end{example}
\vfill
\pagebreak
\subsection{Using Your Calculator}
The process for finding a $t$ interval is identical to that for finding a $z$ interval, except that you need to select \texttt{8: TInterval} in the \texttt{STAT} \texttt{TESTS} menu.
\begin{example}{Movie Lengths}
A random sample of 45 Hollywood movies made since the year 2000 had a mean length of 111.7 minutes, with a standard deviation of 13.8 minutes. Construct a 92\% confidence interval for the population mean.\\
On your calculator, press \texttt{STAT} and scroll over to \texttt{TESTS}. Scroll down or press the 8 key to select \texttt{8: TInterval}.
\begin{center}
\includegraphics[width=3in]{CalcTIntervalEx}
\end{center}
Enter the given information and click \texttt{Calculate}.
\begin{center}
\includegraphics[width=3in]{CalcTIntervalEx2}
\end{center}
Therefore, the 92\% confidence interval is
\[(108.01, 115.39).\]
\end{example}
\vfill
\pagebreak
\begin{example}{Cereal Box Weights}
Boxes of cereal are labeled as containing 14 ounces. Following are the weights, in ounces, of a sample of 12 boxes. It is reasonable to assume that the population is approximately normal.
\begin{center}
\begin{tabular}{c c c c c c}
14.02 & 13.97 & 14.11 & 14.12 & 14.10 & 14.02\\
14.15 & 13.97 & 14.05 & 14.04 & 14.11 & 14.12
\end{tabular}
\end{center}
Construct a 95\% confidence interval. Based on this confidence interval, are the boxes labeled correctly?\\
This time, we're given data, so enter that and then go to the \texttt{TInterval} menu, but select \texttt{DATA}.
\begin{center}
\includegraphics[width=3in]{CalcTIntervalEx3}
\end{center}
Click \texttt{Calculate}, and you'll see that the confidence interval is \[(14.026, 14.104).\]
Therefore, since this interval does not contain 14, the boxes are not being filled properly.
\end{example}
\begin{example}{Online Course Satisfaction}
A sample of 263 students who were taking online courses were asked to describe their overall impression of online learning on a scale of 1--7, with 7 representing the most favorable impression. The average score was 5.53, and the standard deviation was 0.92. Construct a 99\% confidence interval for the population mean score.\\
This is an example where the population is so large that we could easily use \texttt{ZInterval}, and our results would be fine. However, to avoid confusion (and since it's no extra work), we'll use \texttt{TInterval} whenever the population standard deviation is unknown.
Enter these statistics under the \texttt{TInterval} menu and click \texttt{Calculate}, and you'll get the following confidence interval:
\[(5.3828, 5.6772).\]
\end{example}
\vfill
\pagebreak