% 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[12pt,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}

% Make title bold and 14 pt font (Latex default is non-bold, 16pt)
\title{Stat 312: Lecture 27\\
Testing for Independence}
% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
% For two authors (default example)
\maketitle \thispagestyle{empty}
\subsection*{Concepts}
\begin{enumerate}
\item Suppose that each individual in a population is classified
with respect to two different {\em factors} into a two-way
contingency table of size $I \times J$.

\item The null hypothesis of interest would be testing if the two
factors are independent:
$$H_0: p_{ij} = p_{i\bullet}p_{\bullet j} \mbox{ for all } i,j,$$
where $p_{i\bullet}=\sum_{j=1}^J p_{ij}$ and $p_{\bullet
j}=\sum_{i=1}^J p_{ij}.$

 \item Under $H_0$, the expected number of element $\mathbb{E} N_{ij} =
 np_{ij} = np_{i\bullet}p_{\bullet j}$. Since the marginal
 probabilities are unknown, we estimate them by $\hat p_{i
 \bullet}=n_{i \bullet}/n$, the sample proportion for category $i$
 for factor 1 and $\hat p_{\bullet j}=n_{\bullet j}/n$, the sample proportion
 for category $j$ for factor 2. So $\mathbb{E} N_{ij} = n_{i \bullet}n_{\bullet
 j}/n$.

 \item Test statistic
 $$\chi^2 = \sum_{i,j} \frac{(n_{ij}
 -\mathbb{E}N_{ij})^2}{\mathbb{E}N_{ij}} \sim
 \chi^2_{(I-1)(J-1)}.$$
This is the test statistic that has been used in testing
homogeneity!
\end{enumerate}

\subsection*{In-class problems}
Excercise 14.41. Test if the parental use of alcohol and drugs
is independent of the student usage of marijuana for 445 college students.\\
\begin{tabular}{|c|c|c|c|}
  \hline
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
   parent$\backslash$student& never & occasional & regular \\
  \hline
  neither & 141 & 54 & 40 \\
  one & 68 & 44 & 51 \\
  both & 17 & 11 & 19 \\
  \hline
\end{tabular}\\
\subsection*{Self-study problems}
{\em Example 14.14.}\\
 {\em Example.} Show that the two hypotheses
$H_0: p_{ij} = p_{i\bullet}p_{\bullet j} \mbox{ for all } i,j$ and
$H_0: p_{1j} = p_{2j} = \cdots = p_{Ij} \mbox{ for all } j$ are
equivalent. Hence testing for homogeneity is equivalent to testing
independence.\\
{\bf The End of Lectures. ra...ra...ra...} Thank you all. In the next class, I will
solve some sample final exams.
\end{document}
