% 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.6in} \setlength{\textwidth}{6.9in}
%\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{0in}
\setlength{\headheight}{0in} \setlength{\headsep}{-1in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.2in}  % Centers text.
\setlength{\evensidemargin}{-.2in}

% 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 13\\
Testing on Population Means}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
\date{October 26, 2004}
% For two authors (default example)
\maketitle
\thispagestyle{empty}

\begin{enumerate}

\item Since we can minimize both type I and type II errors
simultaneously in constructing a test procedure, we will control for
fixed type I error (level $\alpha$) and make type II error as small
as possible. The corresponding test procedure is called a {\em level
$\alpha$ test}.

\item Testing mean $\mu$ with known variance $\sigma^2$.
$$H_0: \mu=\mu_0 \mbox{ vs. } H_1: \mu < \mu_0$$
Test statistic: $z=\frac{\bar x -\mu_0}{\sigma/\sqrt{n}}$, which is
a pivot under $H_0$. A {\em pivot} is a statistic whose distribution
is independent of population paramters. Rejection region for level
$\alpha$ test: $z \leq -z_{\alpha}.$

Ex. Intelligence quotient (IQ) is a number used to express the
relative intelligence of a person. An average person has the IQ of
100. Assume IQ of a dog follows $X_i \sim N(\mu, 10^2)$. The IQs of
10 dogs are measured: 30, 25, 70, 110, 40, 80, 50, 60, 100, 60. We
want to test if dogs are as smart as people by testing
$$H_0: \mu = 100 \mbox{ vs. } H_1: \mu < 100$$
at level $\alpha = 0.05$.
\begin{verbatim}
> x<-c(30, 25, 70, 110, 40, 80, 50, 60,
100, 60)
> mean(x)
[1] 62.5
> z<-(mean(x)-100)/(10/sqrt(10))
> z
[1] -11.85854
> qnorm(0.05)
[1] -1.644854
> qnorm(0.025)
[1] -1.959964
\end{verbatim}

Since $z < -z_{0.05} = -1.64$, we reject $H_0$ at $\alpha=0.05$
level.

\item Testing mean $\mu$ with unknown variance $\sigma^2$.
$$H_0: \mu=\mu_0 \mbox{ vs. } H_1: \mu < \mu_0$$ Test statistic:
$t=\frac{\bar x -\mu_0}{s/\sqrt{n}}.$ Rejection region for level
$\alpha$ test: $z \leq -t_{\alpha,n-1}.$


Ex. IQ of a dog, $X_i \sim N(\mu, \sigma^2),$ where $\sigma$ is
unknown. Test
$$H_0: \mu = 100 \mbox{ vs. } H_1: \mu < 100$$
at level $\alpha = 0.05$.
\begin{verbatim}
> t=(mean(x)-100)/(sd(x)/sqrt(10))
> t
[1] -4.205156
> qt(0.05,9)
[1] -1.833113
\end{verbatim}
A simpler method is to use command {\tt t.test}.
\begin{verbatim}
>help(t.test)
...
t.test(x,alternative=c("two.sided", "less",
       "greater"),conf.level = 0.95)
...
> t.test(x,mu=100,alternative="less",
 conf.level=0.95)
        One Sample t-test
 data:  x t = -4.2036, df = 9,
 p-value = 0.001147
 alternative hypothesis: true mean is
 less than 100
 95 percent confidence interval:
    -Inf 78.8531
 sample estimates: mean of x 62.5
\end{verbatim}
%\begin{figure}[t]
%\centering
%\renewcommand{\baselinestretch}{1}
%\includegraphics[scale=0.5]{chi.eps}
%\caption{$t_{1000}}
%\end{figure}


\end{enumerate}

\section*{Review problems}
Example 8.6., 8.7., 8.8., 8.9.

\end{document}
