% 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\\
Two-sample tests}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
%\date{Feb 20, 2003}
% For two authors (default example)
\maketitle
\thispagestyle{empty}
\section*{Concepts}
\begin{enumerate}
\item The $P$-value is the smallest level of significance at which
$H_0$ would be rejected.\\
$P$-value $\leq \alpha \to$ reject $H_0$ at level $\alpha$.\\
$P$-value $> \alpha \to$ do not reject $H_0$ at level $\alpha$.\\
The smaller the $P$-value, the easier to reject $H_0$.

\item Let $X_1,\cdots,X_n$ and $Y_1,\cdots,Y_m$ be two independent
samples with mean $\mu_X$, $\mu_Y$ and variance $\sigma_X^2$,
$\sigma_Y^2$ respectively. Assume $n$ and $m$ to be {\bf large}.
The test statistic for testing
$$H_0: \mu_X = \mu_Y \mbox{ vs. } H_1: \mu_X \neq \mu_Y$$
$$Z=\frac{\bar Y - \bar X}{\sqrt{\sigma_X^2/n + \sigma_Y^2/m}} \sim N(0,1).$$

\item Let $X_1,\cdots,X_n$ and $Y_1,\cdots,Y_m$ be two independent
samples with $X_i \sim N(\mu_X,\sigma_X^2)$ and $Y_j \sim N(\mu_Y,
\sigma_Y^2)$. Then we can show that $$Z=\frac{\bar Y - \bar
X}{\sqrt{\sigma_X^2/n + \sigma_Y^2/m}} \sim N(0,1).$$

\end{enumerate}
\section*{In-class problems}

Example 8.11. 47 out of 102 doctors did not know the generic name
for the drug methadone. Let $p$ be the proportion of doctors who knew
the generic name. Determine the $P$-values for testing
$$H_0: p=0.5, \mbox{ vs } H_1:p < 0.5$$
\begin{verbatim}
> p<-47/102
> (p-0.5)/sqrt(0.5*0.5/102)
[1] -0.792118
> pnorm(-0.79)
[1] 0.2147639
\end{verbatim}
So we do not reject $H_0$ at any level less than $0.2$.

{\em Example 1.} A study was conducted to compare the reaction
times of men and women to a stimulus. 50 men and 65 women were
employed in the experiment. Let $X_i$ be the reaction time of the
$i$-th man and $Y_j$ be the reaction time of the $j$-th woman. The
following measurements were taken: $\bar x = 3.6$ seconds, $\bar
y= 3.8$ seconds, $s_X^2=0.18$, $s_Y^2=0.14$. Is there any
difference between the reaction times of men and women?
\begin{verbatim}
> z=(3.6-3.8)/sqrt(0.18/50+0.14/65)
> z
[1] -2.63664
> qnorm(0.025)
[1] -1.959964
\end{verbatim}

{\em Example 2.} 12 men and 9 women were employed in the
experiment. Let $X_i$ be the reaction time of the $i$-th man and
$Y_j$ be the reaction time of the $j$-th woman. There is a reason
to believe that $X_i \sim N(\mu_X, 0.18)$ and $Y_j \sim N(\mu_Y,
0.14)$. The following measurements were taken: $\bar x = 3.6$
seconds, $\bar y= 3.8$ seconds. Is there any difference between
the reaction times of men and women?
\begin{verbatim}
> z=(3.6-3.8)/sqrt(0.18/12+0.14/9)
> z
[1] -1.144155
\end{verbatim}
What is the main reason you are getting the different results in
Example 1 and 2?
%\begin{figure}[t]
%\centering
%\renewcommand{\baselinestretch}{1}
%\includegraphics[scale=0.5]{chi.eps}
%\caption{$t_{1000}}
%\end{figure}



\section*{Self-study problems}
Exercise 8.53. Determine the $P$-value in Example 1 and 2. Example 9.1., 9.4., 9.5.  
\end{document}
