% This is a simple LaTex sample document that gives a submission format
%   for IEEE PAMI-TC conference submissions.  Use at your own risk.

% Make two column format for LaTex 2e.
\documentclass[11pt,twocolumn]{article} %,twocolumn
\usepackage[dvips]{graphicx,graphics,color}
\usepackage{times,amsmath,amsfonts}


\setlength{\textheight}{10in} \setlength{\textwidth}{6.875in}
\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0in} \setlength{\headsep}{0in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.2in}  % Centers text.
\setlength{\evensidemargin}{-.2in}

% Add the period after section numbers.  Adjust spacing.

\newcommand{\bqn}{\begin{eqnarray}}
\newcommand{\eqn}{\end{eqnarray}}
\newcommand{\bq}{\begin{eqnarray*}}
\newcommand{\eq}{\end{eqnarray*}}

\begin{document}

% Don't want date printed
%\date{January 23, 2003}

% Make title bold and 14 pt font (Latex default is non-bold, 16pt)
\title{Stat 312: Lecture 09\\
Confidence intervals from normal population}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
% For two authors (default example)
\maketitle
\thispagestyle{empty}

\begin{enumerate}

\item Fat content of 10 randomly selected hotdogs is given by
\begin{verbatim}
> x<-c(25.2,21.3,22.8,17.0,29.8,
21.0,25.5,16.0,20.9,19.5)
\end{verbatim}
We are interested in constructing a 95$\%$ CI for the population
mean fat content. Since the sample size is small, we can not apply
large sample size results. Let us check the normality of data first
using {\tt qqnorm(x)}.

\begin{figure}[t]
\centering
\includegraphics[width=70mm]{lecture09-1.ps}
\caption{Normal probability plot showing normality of
data.}\label{fig:sq}
\end{figure}

So we can assume our data to follow a normal distribution but the
variance is unknown.

\item If $X_i \sim N(\mu,\sigma^2)$,

$$T \sim \frac{\bar X -\mu}{S/\sqrt{n}} \sim t_{n-1},$$
a t distribution with $n-1$ degrees of freedom. As $n \to \infty$,
$t_{n} \to N(0,1)$ so for large sample size $n$, we can approximate
$t$ distribution with $N(0,1)$. Let us plot $t$ distributions and
compare them with $N(0,1)$.
\begin{verbatim}
> y<- -50:50/10
> par(mfrow=c(2,2))
> plot(y,dt(y,1),type='l')
> plot(y,dt(y,100),type='l')
> plot(y,dt(y,100000000),type='l')
> plot(y,dnorm(y,0,1),type='l')
\end{verbatim}
\begin{figure}[t]
\centering
\includegraphics[width=75mm]{lecture09-2.ps}
\caption{From left to right $t_1, t_{100}, t_{10000000}$ and
$N(0,1)$.}
\end{figure}




\item Critical value $t_{\alpha,n}$ is defined as the point that gives
$P(T > t_{\alpha,n}) = \alpha$. We can construct CI based on
$$P(-t_{\alpha/2,n-1} < T < t_{\alpha/2,n-1})=1-\alpha.$$
$100(1-\alpha)\%$ CI for $\mu$ is
$$\bar x \pm t_{\alpha/2}s/\sqrt{n}.$$
\begin{verbatim}
> qt(.975, df = c(1:10,20,100,1000,10000))
 [1] 12.706205  4.302653  3.182449
 [4]  2.776445  2.570582  2.446912
 [7]  2.364624  2.306004  2.262157
[10]  2.228139  2.085963  1.983972
[13]  1.962339  1.960201
> qnorm(0.975)
[1] 1.959964

>
> sd(x)
[1] 4.13414
> mean(x)+qt(0.975,9)*sd(x)/sqrt(10)
[1] 24.85739
> mean(x)-qt(0.975,9)*sd(x)/sqrt(10)
[1] 18.94261

> t.test(x)
        One Sample t-test
data:  x t = 16.7517, df = 9, p-value = 4.308e-08 alternative
hypothesis: true mean is not equal to 0 95 percent confidence
interval:
 18.94261 24.85739
sample estimates: mean of x
     21.9
\end{verbatim}
\end{enumerate}
{\em Review Problems.} Exercise 7.29., 7.33.

{\bf Homework III.} Due Oct 19 9:30am. Exercise 7.22.,7.26.,4.82.,
4.88. part (a) only., 7.32., 7.44., 7.46.


\end{document}
