% 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}
\usepackage{times,amsmath,amsfonts}

% Use following instead for LaTex 2.09 (may need some other mods as well).
% \documentstyle[times,twocolumn]{article}

% Set dimensions of columns, gap between columns, and paragraph indent
\setlength{\textheight}{9.2in} \setlength{\textwidth}{6.875in}
%\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{0in}
\setlength{\headheight}{0in} \setlength{\headsep}{-1in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.1875in}  % Centers text.
\setlength{\evensidemargin}{-.1875in}

% Add the period after section numbers.  Adjust spacing.
\newcommand{\Section}[1]{\vspace{-8pt}\section{\hskip -1em.~~#1}\vspace{-3pt}}
\newcommand{\SubSection}[1]{\vspace{-3pt}\subsection{\hskip -1em.~~#1}
        \vspace{-3pt}}
\newcommand{\bqn}{\begin{eqnarray}}
\newcommand{\eqn}{\end{eqnarray}}
\newcommand {\diff}[1] {\frac{\partial}{\partial #1}}
\newcommand{\jacob}[3]{\frac{\partial^2 #3}{\partial #1 \partial #2}}
\newcommand{\der}[2]{\frac{\partial #2}{\partial #1}}
\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 6\\
 Confidence Intervals II.}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
% For two authors (default example)
\maketitle
\thispagestyle{empty}
\section*{Concepts}
\begin{enumerate}
\item  Let $X_i \sim N(\mu,\sigma^2)$ with known $\sigma^2$ and unknown $\mu$. $100(1-\alpha)\%$ confidence interval for $\mu$ is.
$$\hat \mu_L =\bar x - z_{\alpha/2} \cdot \sigma/\sqrt{n},\; \hat \mu_U=\bar x + z_{\alpha/2} \cdot \sigma/\sqrt{n}.$$

\item The sample size is inversely related to the width of confidence interval.
\item {\em Central Limit Theorem.} Let $X_1,\cdots,X_n$ be a random sample with mean $\mu$ and variance $\sigma^2$. For large $n$, $$Z=\frac{\bar X-\mu}{\sigma /\sqrt{n}} \sim N(0,1).$$
\item If $n$ is sufficiently large, approximate $100(1-\alpha)\%$ confidence interval for $\mu$ is $\bar x \pm z_{\alpha/2}s/\sqrt{n}$, where $s$ is the sample standard deviation.
\end{enumerate}

\section*{In-class problems}
Continuing Exercise 6.25, construct $98\%$ confidence interval.\\
Example 7.4. Response time $\sim N(\mu,\sigma^2),\sigma=25$. Find
the sample size $n$ that ensures 95$\%$ CI with a width of 10.\\
Example 7.6. Alternating current (AC) voltage data
\begin{verbatim}
> data(xmp07.06)
> attach(xmp07.06)
> str(xmp07.06)
`data.frame':48 obs. of 1 variable:
 $ C1: int  62 50 53 57 ...
> boxplot(C1)
> mean(C1)
[1] 54.70833
> sd(C1)
[1] 5.230672
>mean(C1)-qnorm(0.975)*sd(C1)/sqrt(length(C1))
[1] 53.2286
>mean(C1)+qnorm(0.975)*sd(C1)/sqrt(length(C1))
[1] 56.18807
\end{verbatim}
{\bf Ex.} Toss $n=100$ biased coins with $P(H)=p$. Suppose you
observe 38 heads. Construct 95$\%$ CI of $p$.
\begin{figure}[t]
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.1]{box7.6.ps}
\end{figure}
\begin{verbatim}
> X<-rbinom(100,1,0.4)
> X
  [1] 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0
 [17] 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0
 [33] 1 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0
 [49] 0 1 0 0 0 0 1 1 0 1 0 1 1 0 0 1
 [65] 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0
 [81] 1 0 1 0 0 1 1 0 0 0 1 0 0 1 1 1
 [97] 0 1 1 0
> sd(X)
[1] 0.4878317
> sqrt(0.38*(1-0.38)/(100-1))
[1] 0.04878317
> 0.38+1.96*0.049/sqrt(100)
[1] 0.389604
> 0.38-1.96*0.049/sqrt(100)
[1] 0.370396
\end{verbatim}


\section*{Self-study problems}
Example 7.8., Exercise 7.13., 7.19., 7.25.\\
In the above coin tossing example, check if $\bar X$ is MLE.
\end{document}






