% $Header: /cvsroot/latex-beamer/latex-beamer/examples/beamerexample5.tex,v 1.22 2004/10/08 14:02:33 tantau Exp $

\documentclass[11pt]{beamer}
\usepackage{amscd}

%\usetheme{Madrid} % Darmstadt, Boadilla


\mode<presentation> {
  \usetheme{Madrid}
  \setbeamercovered{transparent}
}

\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsbsy,alltt,amsmath,times}
\usepackage{epsfig, color, graphicx, rotate, colordvi}
%\usepackage{fancybox,fancyhdr,times,subfigure}
\usepackage{hyperref, mathptmx}


\setbeamercovered{dynamic}

\newcommand{\Lang}[1]{\operatorname{\text{\textsc{#1}}}}

\newcommand{\Class}[1]{\operatorname{\mathchoice
  {\text{\sf \small #1}}
  {\text{\sf \small #1}}
  {\text{\sf #1}}
  {\text{\sf #1}}}}

\newcommand{\NumSAT}      {\text{\small\#SAT}}
\newcommand{\NumA}        {\#_{\!A}}

\newcommand{\barA}        {\,\bar{\!A}}

\newcommand{\Nat}{\mathbb{N}}
\newcommand{\Set}[1]{\{#1\}}

\newtheorem{thm}{Result}%[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{exam}{Example}%[section]
\newtheorem{rem}{Remark}

\newcommand{\cred}{\textcolor {red}}
\newcommand{\cblue}{\textcolor {blue}}
\newcommand{\cgreen}{\textcolor {green}}

\def\ul{\underline}

\def\sign{\;{\rm sign}}
\def\rank{\;{\rm rank}}
\def\disp{\displaystyle}
\def\sn{\sqrt{n}}
\def\Pr{\mathrm{P}}

\def\Cov{\;{\rm Cov}}
\def\L{\underline L}
\def\LL{\overline L}

\def\balpha{{\boldsymbol{\alpha}}}
\def\cal{\mathcal}
\def\conas{\stackrel{a.s.} {\longrightarrow}}         % conv. a.s.
\def\conp{\stackrel{\cal P} {\longrightarrow}}        % conv. in probability
\def\conD{\stackrel{\mathcal{L}} {\longrightarrow}}        % conv. in distribution
\def\conw{\stackrel{\mathcal{L}} {\rightarrow}}        % conv. in distribution
\def\hat{\widehat}
%\def\endproof{\begin{flushright}$\lozenge$\end{flushright}}
\def\Proof{\noindent{\it Proof }}
\def\endproof{\hfill{$\Box$}}
\newcommand{\wcon}{\stackrel{\mathcal{L}}{\longrightarrow}}
\def\Var{\mbox{var}}

%%%%%%%%%%%%%%% MY DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Put your own definitions
%
\def\VaR{{\rm VaR}}
\def\E{{\rm E}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pgfdeclaremask{tu}{beamer-tu-logo-mask}
\pgfdeclaremask{computer}{beamer-computer-mask}
\pgfdeclareimage[interpolate=true,mask=computer,height=2cm]{computerimage}{beamer-computer}
\pgfdeclareimage[interpolate=true,mask=computer,height=2cm]{computerworkingimage}{beamer-computerred}
\pgfdeclareimage[mask=tu,height=.5cm]{logo}{beamer-tu-logo}

\logo{\pgfuseimage{logo}}

\title[Stat 609 Lecture 2]{Stat 609: Mathematical Statistics \\ Lecture 2}
\author[UW-Madison]{Jun Shao}
\institute[Statistics]{%
%  Department of Statistics\\
%  University of Wisconsin\\
%  Madison, WI 53706, USA\\
%~~~\\
  }
\date[2015]{}

\colorlet{redshaded}{red!25!bg}
\colorlet{shaded}{black!25!bg}
\colorlet{shadedshaded}{black!10!bg}
\colorlet{blackshaded}{black!40!bg}

\colorlet{darkred}{red!80!black}
\colorlet{darkblue}{blue!80!black}
\colorlet{darkgreen}{green!80!black}

\def\radius{0.96cm}
\def\innerradius{0.85cm}

\def\softness{0.4}
\definecolor{softred}{rgb}{1,\softness,\softness}
\definecolor{softgreen}{rgb}{\softness,1,\softness}
\definecolor{softblue}{rgb}{\softness,\softness,1}

\definecolor{softrg}{rgb}{1,1,\softness}
\definecolor{softrb}{rgb}{1,\softness,1}
\definecolor{softgb}{rgb}{\softness,1,1}

\newcommand{\Bandshaded}[2]{
  \color{shadedshaded}
  \pgfmoveto{\pgfxy(-0.5,0)}
  \pgflineto{\pgfxy(-0.6,0.1)}
  \pgflineto{\pgfxy(-0.4,0.2)}
  \pgflineto{\pgfxy(-0.6,0.3)}
  \pgflineto{\pgfxy(-0.4,0.4)}
  \pgflineto{\pgfxy(-0.5,0.5)}
  \pgflineto{\pgfxy(4,0.5)}
  \pgflineto{\pgfxy(4.1,0.4)}
  \pgflineto{\pgfxy(3.9,0.3)}
  \pgflineto{\pgfxy(4.1,0.2)}
  \pgflineto{\pgfxy(3.9,0.1)}
  \pgflineto{\pgfxy(4,0)}
  \pgfclosepath
  \pgffill

  \color{black}
  \pgfputat{\pgfxy(0,0.7)}{\pgfbox[left,base]{#1}}
  \pgfputat{\pgfxy(0,-0.1)}{\pgfbox[left,top]{#2}}
}

\newcommand{\Band}[2]{
  \color{shaded}
  \pgfmoveto{\pgfxy(-0.5,0)}
  \pgflineto{\pgfxy(-0.6,0.1)}
  \pgflineto{\pgfxy(-0.4,0.2)}
  \pgflineto{\pgfxy(-0.6,0.3)}
  \pgflineto{\pgfxy(-0.4,0.4)}
  \pgflineto{\pgfxy(-0.5,0.5)}
  \pgflineto{\pgfxy(4,0.5)}
  \pgflineto{\pgfxy(4.1,0.4)}
  \pgflineto{\pgfxy(3.9,0.3)}
  \pgflineto{\pgfxy(4.1,0.2)}
  \pgflineto{\pgfxy(3.9,0.1)}
  \pgflineto{\pgfxy(4,0)}
  \pgfclosepath
  \pgffill

  \color{black}
  \pgfputat{\pgfxy(0,0.7)}{\pgfbox[left,base]{#1}}
  \pgfputat{\pgfxy(0,-0.1)}{\pgfbox[left,top]{#2}}
}

\newcommand{\BaenderNormal}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Band{input tapes}{}}
  \pgfputat{\pgfxy(0.35,4.6)}{\pgfbox[center,base]{$\vdots$}}
  \pgfputat{\pgfxy(0,4)}{\Band{}{}}

  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$w_1$}}

  \pgfxyline(0,4)(0,4.5)
  \pgfxyline(1.8,4)(1.8,4.5)
  \pgfputat{\pgfxy(0.25,4.25)}{\pgfbox[left,center]{$w_n$}}
  \ignorespaces}

\newcommand{\BaenderZweiNormal}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Band{Zwei Eingabebänder}{}}
  \pgfputat{\pgfxy(0,4.25)}{\Band{}{}}

  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$u$}}

  \pgfxyline(0,4.25)(0,4.75)
  \pgfxyline(1.8,4.25)(1.8,4.75)
  \pgfputat{\pgfxy(0.25,4.5)}{\pgfbox[left,center]{$v$}}
  \ignorespaces}

\newcommand{\BaenderHell}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Bandshaded{input tapes}{}}
  \color{shaded}
  \pgfputat{\pgfxy(0.35,4.6)}{\pgfbox[center,base]{$\vdots$}}
  \pgfputat{\pgfxy(0,4)}{\Bandshaded{}{}}

  \color{blackshaded}
  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$w_1$}}

  \pgfxyline(0,4)(0,4.5)
  \pgfxyline(1.8,4)(1.8,4.5)
  \pgfputat{\pgfxy(0.25,4.25)}{\pgfbox[left,center]{$w_n$}}
  \ignorespaces}

\newcommand{\BaenderZweiHell}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Bandshaded{Zwei Eingabebänder}{}}%
  \color{blackshaded}
  \pgfputat{\pgfxy(0,4.25)}{\Bandshaded{}{}}
  \pgfputat{\pgfxy(0.25,4.5)}{\pgfbox[left,center]{$v$}}
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$u$}}%

  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)

  \pgfxyline(0,4.25)(0,4.75)
  \pgfxyline(1.8,4.25)(1.8,4.75)
  \ignorespaces}

\newcommand{\Slot}[1]{%
  \begin{pgftranslate}{\pgfpoint{#1}{0pt}}%
    \pgfsetlinewidth{0.6pt}%
    \color{structure}%
    \pgfmoveto{\pgfxy(-0.1,5.5)}%
    \pgfbezier{\pgfxy(-0.1,5.55)}{\pgfxy(-0.05,5.6)}{\pgfxy(0,5.6)}%
    \pgfbezier{\pgfxy(0.05,5.6)}{\pgfxy(0.1,5.55)}{\pgfxy(0.1,5.5)}%
    \pgflineto{\pgfxy(0.1,4.0)}%
    \pgfbezier{\pgfxy(0.1,3.95)}{\pgfxy(0.05,3.9)}{\pgfxy(0,3.9)}%
    \pgfbezier{\pgfxy(-0.05,3.9)}{\pgfxy(-0.1,3.95)}{\pgfxy(-0.1,4.0)}%
    \pgfclosepath%
    \pgfstroke%
  \end{pgftranslate}\ignorespaces}

\newcommand{\SlotZwei}[1]{%
  \begin{pgftranslate}{\pgfpoint{#1}{0pt}}%
    \pgfsetlinewidth{0.6pt}%
    \color{structure}%
    \pgfmoveto{\pgfxy(-0.1,5.5)}%
    \pgfbezier{\pgfxy(-0.1,5.55)}{\pgfxy(-0.05,5.6)}{\pgfxy(0,5.6)}%
    \pgfbezier{\pgfxy(0.05,5.6)}{\pgfxy(0.1,5.55)}{\pgfxy(0.1,5.5)}%
    \pgflineto{\pgfxy(0.1,4.25)}%
    \pgfbezier{\pgfxy(0.1,4.25)}{\pgfxy(0.05,4.15)}{\pgfxy(0,4.15)}%
    \pgfbezier{\pgfxy(-0.05,4.15)}{\pgfxy(-0.1,4.2)}{\pgfxy(-0.1,4.25)}%
    \pgfclosepath%
    \pgfstroke%
  \end{pgftranslate}\ignorespaces}

\newcommand{\ClipSlot}[1]{%
  \pgfrect[clip]{\pgfrelative{\pgfxy(-0.1,0)}{\pgfpoint{#1}{4cm}}}{\pgfxy(0.2,1.5)}\ignorespaces}

\newcommand{\ClipSlotZwei}[1]{%
  \pgfrect[clip]{\pgfrelative{\pgfxy(-0.1,0)}{\pgfpoint{#1}{4.25cm}}}{\pgfxy(0.2,1.25)}\ignorespaces}


\AtBeginSection[]{\frame{\frametitle{Outline}\tableofcontents[current]}}
\def\back{\!\!\!\!\!}
\begin{document}

%\frame{\titlepage}
\frame{
	\frametitle{Lecture 2: Probability, conditional probability,  and independence}
	\vspace{-2mm}
	\begin{block}{Theorem 1.2.6.}
		Let $S = \{s_1,s_2,... \}$ and ${\cal F}$ be all subsets of $S$.\\
		Let $p_1,p_2,...$ be nonnegative numbers that sum to 1. \\
		The following defines a probability on ${\cal F}$:
		\[ P(A) = \sum_{i: s_i \in A} p_i , \quad A \in {\cal F} \vspace{-2mm} \]
		(sum over the empty set is defined to be 0). 
	\end{block}\vspace{-3mm}
	\begin{alertblock}{Theorem 1.2.8-9.}
		If  $P$ is a probability and $A$ and $B$ are events, then\\
		a. $P(A) \leq 1$;\\
		b. $P(A^c) = 1- P(A)$;\\
c. $P(B\cap A^c) = P(B)-P(A\cap B)$;\\
		d. $P(A \cup B) = P(A)+P(B) - P(A\cap B)$;\\
		e. If $A \subset B$, then $P(A) \leq P(B)$.
	\end{alertblock}
}

\frame{\vspace{-2mm}
	\begin{block}{Birth date problem}
		There are $n$ balls in $N$ boxes, $n \leq N$. \\
		What is the probability that there are $n$ boxes having exactly one ball?
		\[ P = \frac{N(N-1)\cdots (N-n+1)}{N^n } = \frac{N!}{N^n (N-n)!} \]
		When there are $n$ persons in a party, what is the probability $p_n$ that there are at least two persons having the same birth date?\\
		$n$ persons $= n$ balls\\
		$N = 365$ days
		\[ P( \mbox{no one has the same birth date with others} ) = \frac{365!}{365^n (365-n)!}  \]
		\[ p_n = 1- \frac{365!}{365^n (365-n)!} \]
		$p_{20} = 0.4058$, $p_{30} = 0.6963$, $p_{50}= 0.9651 $, $p_{60} = 0.9922$
	\end{block}\vspace{-2mm}
	\begin{alertblock}{Reading assignments: Sections 1.2.3 and 1.2.4}
	\end{alertblock}
}
\frame{
	\begin{block}{Union of three events}
		\[ P(A \cup B \cup C) = P(A)+P(B)+P(C)\]
		\[  - P(A\cap B) - P(A \cap C)- P(B\cap C) + P(A\cap B\cap C)\]
		Example:\\
		$P(A) = P(B) = P(C) = 1/4$, $A$ and $B$ are disjoint, $P(B\cap C) = P(A\cap C) = 1/6$\\
		$P(A \cup B \cup C) =?$ \vspace{-2mm}
		\[ P(A \cup B \cup C)  = 1/4 + 1/4 + 1/4 - 0 - 1/6 - 1/6 + 0 = 7/12 \]
	\end{block}\vspace{-2mm}
	\begin{alertblock}{General addition formula}
		For events $A_1,...,A_n$, \vspace{-2mm} 
		\[ P \left( \bigcup_{i=1}^n A_i \right) = \sum_{i=1}^n P(A_i) - \sum_{ i  < j} P(A_i\cap A_j) \]
		\[ + \sum_{i <j <k} P(A_i \cap A_j \cap A_k )  + \cdots +(-1)^{n-1} P(A_1 \cap A_2 \cap \cdots \cap A_n) \]
	\end{alertblock}
}
\frame{
	\begin{block}{Theorem 1.2.11.}
		If $P$ is a probability, $A$, $A_1,A_2,...$, $C_1,C_2,...$ are events, and $C_i \cap C_j = \emptyset$ for any $i \neq j$ and
		$\cup_{i=1}^\infty C_i = S$, then \\
		a. $P(A) = \sum_{i=1}^\infty P(A\cap C_i)$;\\
		b. $P(\cup_{i=1}^\infty A_i ) \leq \sum_{i=1}^\infty P(A_i)$.
		\begin{itemize}
			\item
			Property a is useful when $P(A\cap C_i)$ is easy to calculate.
			\item
			Property b is called Boole's inequality.
		\end{itemize}
	\end{block} \vspace{-2mm}
	\begin{alertblock}{Bonferroni's inequality}
		For $n$ events $A_1,..,A_n$,\vspace{-2mm} 
		\[ 1- P\left(\bigcap_{i=1}^n A_i \right) = P\left( \bigcup_{i=1}^n A_i^c \right)  \leq \sum_{i=1}^n P(A_i^c)
		= n - \sum_{i=1}^n P(A_i) \vspace{-1mm} \]
		Then
		\[ P\left( \bigcap_{i=1}^n A_i\right) \geq  \sum_{i=1}^n P(A_i) - (n-1) \]
		which is called Bonferroni's inequality.
	\end{alertblock}
}

\frame {
\begin{alertblock}{Conditional probability}
Sometimes we want to know the probability of event $A$ given that another event $B$ has occurred.
\vspace{-5cm}
\begin{figure}[h]
\begin{center}
%\caption{Venn Diagram}
\includegraphics[height=4in, width=4in]{img0.pdf}
\end{center}
\end{figure}
\end{alertblock}
\vspace{-12mm}
    \begin{block}{Definition 1.3.2.}
If $A$ and $B$ are events with $P(B)>0$, then the conditional
probability of $A$ given $B$ is
\[ P(A|B) = \frac{P(A\cap B)}{P(B)} . \]
\end{block}
}

\frame {
\vspace{-2mm}
\begin{alertblock}{}
\begin{itemize}
\item
The conditional probability can be viewed as:
\begin{itemize}
\item
The sample space is reduced to $B$.
\item
Then $A$ occurs iff $A\cap B$ occurs.
\item
To have a probability, we need to divide $P(A\cap B)$ by $P(B)$.
\end{itemize}
\item
If $A \cap B = \emptyset$, then $P(A\cap B) =0$ and $P(A|B)=0$.
\item
For convenience, we define $P(A|B)=0$ when $P(B) =0$.
\item
$P(A \cap B) = P(A|B)P(B) = P(B|A) P(A)$.
\item
$P( \cdot |B)$ is a probability:
\begin{itemize}
\item
$P(\emptyset |B) = 0 $, $P(S|B) =P(B|B)= 1$;
\item
$P(A^c |B) = 1- P(A|B)$;
\item
$P(A \cup C |B) = P(A|B)+P(C|B) - P(A\cap C|B)$.
\end{itemize}
\end{itemize}
\end{alertblock}
\vspace{-2mm}
\begin{block}{Example 1.3.4 (Three prisoners)}
Three prisoners, A, B, and C, are on death row.

The warden knows that one of the three prisoners will be pardoned.

Prisoner A tries to get the warden to tell him who had been pardoned, but the warden refuses.

Prisoner A then asks which of B or C will be executed.

The warden thinks for a while, then tells A that B is to be executed.
\end{block}
}
\frame{\vspace{-2mm}
\begin{block}{}
Prisoner A's thinking:\vspace{-0.5mm}
\begin{itemize}
\item
Let $A$, $B$, and $C$ denote the events that A, B, and C is pardoned, respectively. Then $P(A)=P(B)=P(C) = 1/3$.\vspace{-0.5mm}
\item
Given that B will be executed, then either A or C will be pardoned; my chance of being pardoned has risen from 0.33 to 0.5.\vspace{-0.5mm}
\item
Prisoner A's calculation: $ P(A|B^c ) = \frac{1}{2}$.
\end{itemize}
Warden's reasoning: Each prisoner has a 1/3 chance of being pardoned; either B or C must be executed, so I have given A no information about whether A will be pardoned. \vspace{-3mm} 

\begin{center}
{\small
\begin{tabular}{ccc} \hline
Prisoner pardoned & Warden tells A & Probability\\
A & B dies & 1/6 \\
A & C dies & 1/6 \\
B & C dies & 1/3 \\
C & B dies & 1/3 \\ \hline
\end{tabular}
}
\end{center}

\vspace{-6mm}
\[ P(A| \mbox{warden says B dies}) = \frac{P(\mbox{warden says B dies}\cap  A ) }{P(\mbox{wanden says B dies})}
= \frac{1/6}{1/6+1/3} =  \frac{1}{3}\vspace{-2mm}\]
Reason for the difference: $\{ \mbox{warden says B dies} \} \subset B^c$ but the two are not the same;
e.g., the warden will not tell A whether A dies or not.
\end{block}

}
\frame { \vspace{-2mm}
     \begin{block}{Useful formulas}
\begin{itemize}
\item
For events $A_1$, $A_2$,...,\vspace{-2mm}
\[ P\left( \bigcap_{i=1}^n A_i\right) = P(A_1)P(A_2|A_1) P(A_3| A_1\cap A_2) \cdots P\left(A_n \bigg| \bigcap_{i=1}^{n-1}A_i \right) \vspace{-2mm}\]
\item
For disjoint $B_1$, $B_2$,..., with $\cup_{i=1}^\infty B_i = S$, \vspace{-2mm}
\[ P(A) = \sum_{i=1}^\infty P(B_i) P(A|B_i) \vspace{-2mm}\]
In particular, $ P(A) = P(B)P(A|B) + P(B^c)P(A|B^c) $.
\end{itemize}
\end{block}
\vspace{-2mm}
\begin{alertblock}{Example}
There are 90 red balls and 10 white balls. We select randomly one ball at a time without replacement. \\
What is the probability that the 1st white ball appears at the 3rd draw? \\
Define $A_i = \{$the $i$th selection is a white ball$\}$\\
$B_i = \{$the $i$th selection is a red ball$\}$\vspace{-3mm}
\[ P(B_1\cap B_2 \cap A_3 ) = P(B_1)P(B_2|B_1)P(A_3|B_1\cap B_2) = \frac{90}{100} \times \frac{89}{99} \times \frac{10}{98} \]
\end{alertblock} \vspace{-2mm}
\begin{block}{}
There are $a$ white balls and $b$ black balls in bag I, and $c$ white balls and $d$ black balls in bag II.\\
Randomly select one ball from bag I and put it in bag II.\\
Randomly select one ball from bag II.\\
What is the probability that the 2nd selected ball is white?\\
$A = \{$the 2nd selection is a white ball$\}$\\
$B = \{$the 1st selection is a white ball$\}$\vspace{-2mm}
{\small \[ P(A) = P(B)P(A|B) + P(B^c )P(A|B^c) = \frac{a}{a+b} \times \frac{c+1}{c+d+1} + \frac{b}{a+b}\times \frac{c}{c+d+1}  \]
}     \end{block}
}
\frame{\vspace{-2mm}
\begin{block}{Sensitive questions}
People may not give you a true answer if he/she is asked ``did you cheat in the last exam"?\\
If we want to know the probability that a person cheats in a given exam, we may use the following procedure.\\
We ask a person to flip a fair coin.\\
If the result is ``heads", then the question is ``did you cheat"?\\
If the result is ``tails", then the question is ``is your birthday afetr July 1"?\\
No one, except the person being asked, knows which question is asked.\\
The person will give the truthful answer.
\end{block}
\vspace{-3mm}
\begin{alertblock}{}
$A= $ the event that the person answers ``yes".\\
$B=$ the event that the person is asked the 1st question. \vspace{-2mm}
\[ P( A) = P(B)P(A|B) + P(B^c)P(A|B^c) = 0.5\times  P(A|B) + 0.5 \times 0.5\vspace{-2mm} \]
\[ P(A|B) = 2 P(A) - 0.5 \vspace{-2mm}\]
If we estimate $P(A)$ by asking 10,000 people, then we can estimate $P(A|B)$.
\end{alertblock}
}
\frame{
\begin{block}{Theorem 1.3.5. Bayes formula}
Let $B$, $A_1,A_2,...$ be events with $A_i \cap A_j=\emptyset $, $i \neq j$, and
$\cup_{i=1}^\infty A_i = S$. Then,\vspace{-2mm}
\[ P(A_i|B) = \frac{P(B|A_i)P(A_i)}{{\displaystyle \sum_{j=1}^\infty} P(B|A_j)P(A_j)}.\vspace{-2mm}\]
In particular, \vspace{-2mm}
\[ P(A|B) = \frac{P(B|A)P(A)}{P(B|A)P(A)+ P(B|A^c)P(A^c)} \]
\end{block}\vspace{-2mm}
\begin{alertblock}{Example}
$A= $ the event that a person has a type of disease, $P(A) = 0.0004$.\\
$B= $ a medical test indicates that a tested person has the disease,
$P(B|A) = 0.99$, $P(B|A^c) = 0.05$. \\
$P(A|B)=?$ \\
By Bayes formula, \vspace{-2mm}
\[ P(A|B) = \frac{0.0004 \times 0.99}{0.0004 \times 0.99 + 0.9996 \times 0.05} = 0.007808 \]
\end{alertblock}
}
\frame{\vspace{-2mm} 
\begin{block}{Definition 1.3.7.}
Two events $A$ and $B$ are (statistically) independent iff\vspace{-2mm}
\[ P(A\cap B ) = P(A)P(B).\]
\end{block}
\vspace{-2mm}
\begin{block}{}
\begin{itemize}
\item
This definition is still good if $P(A)=0$ or $P(B)=0$.
\item
$A$ and $B$ are independent iff $P(A|B)=P(A)$ (or $P(B|A)= P(B)$).\\
That is, the probability of the occurrence of $A$ is not affected by the occurrence of $B$.
\item
If $A$ and $B$ are independent, then
the following pairs are also independent: $A$ and $B^c$,
$A^c$ and $B$, and $A^c$ and $B^c$; e.g., \vspace{-2mm} 
\[ P(A\cap B^c) = P(A) - P(A\cap B) = P(A) -P(A)P(B)   = P(A)P(B^c) \]
\end{itemize}
\end{block}\vspace{-2mm}
\begin{alertblock}{Example 1.3.11 (Letters)}
$S$ consists of the 3! permutations of the letters a, b, and c, along with the three triplets of each letter:\vspace{-3.5mm}
\[ S = \left\{ \begin{array}{ccc}
aaa & bbb & ccc \\
abc & bca & cba \\
acb & bac & cab \end{array} \right\} \]
\end{alertblock}
}
\frame{
\begin{alertblock}{}
Suppose that each element of $S$ has probability 1/9 to occur.
\vspace{1mm}

Define $A_i = \{$$i$th place in the triple is occupied by a$\}$, $i=1,2,3$.
\vspace{1mm}

By looking at $S$, we obtain that \vspace{-2mm}
\[ P(A_1) = P(A_2 ) = P(A_3) = 1/3 \vspace{-2mm}\]
\[ P(A_1\cap A_2 ) = P(A_1\cap A_3) = P(A_2 \cap A_3 )= 1/9\vspace{-2mm} \]
Thus,\vspace{-1mm}
\[ P(A_i \cap A_j) = P(A_i )P(A_j) \quad i \neq j \vspace{-1mm}\]
and $A_i$ and $A_j$ are independent for any pair of $(i,j)$, $i \neq j$.
\vspace{1mm}

It is easy to find events that are not independent, e.g., $C= \{ abc , bca \}$, \vspace{-2mm} 
\[ P(C) = 2/9 , \quad \quad P(A_1 \cap C) =  1/9 \neq P(C)P(A_1) = 2/27 \]
\end{alertblock}
\vspace{-2mm} 
\begin{block}{}
If $A$ and $B$ has some relationship, usually they are not independent.
\begin{itemize}
\item
If $A \subset B$, then $P(A) = P(A\cap B) = P(A)P(B)$ iff $P(A)=0$ or $P(B)=1$.
\item
If $A \cap B = \emptyset$, then $P(A\cap B) = P(A)P(B)= 0$ iff $P(A)=0$ or $P(B)=0$.
\end{itemize}
\end{block}
}
\frame{\vspace{-2mm} 
\begin{block}{Definition 1.3.12.}
A collection of events $A_1,...,A_n$ are (mutually) independent
iff for any subcollection $A_{i_1},...,A_{i_k}$,\vspace{-2mm}
\[ P \left( A_{i_1}\cap \cdots \cap A_{i_k} \right) = P(A_{i_1})\cdots P(A_{i_k}) \]
\end{block}\vspace{-2mm}
\begin{alertblock}{}
\begin{itemize}
\item
If we know $P(A_i)$, $i=1,...,n$, we may not know $P(\cup_{i=1}^n A_i)$.\\
But if $A_1,...,A_n$ are independent,  then \vspace{-3mm}
\[ P \left( \bigcup_{i=1}^n A_i \right) = \sum_{i=1}^n P(A_i) - \sum_{ i  < j} P(A_i)P( A_j)\vspace{-2mm} \]
\[ + \sum_{i <j <k} P(A_i)P( A_j)P( A_k )  + \cdots +(-1)^{n-1} P(A_1)P( A_2) \cdots P( A_n) \vspace{-2mm} \]
\item
If events $A$, $B$, $C$ are independent, then so are $A\cup B$ and $C$,
$A\cap B$ and $C$, and $A-B$ and $C$, e.g., 
\end{itemize}
\vspace{-5mm}
\begin{eqnarray*}
 P((A\cup B)\cap C) \back &=& \back P((A\cap C)\cup (B\cap C)) \\
 \back &= & \back P(A\cap C)+P(B\cap C) - P(A\cap C\cap B) \\
\back  &= & \back P(A)P(C) +P(B)P(C) - P(A)P(C)P(B) \\
\back &  =& \back P(C)[P(A)+P(B)-P(A)P(B)] =  P(C)P(A\cup B)
\end{eqnarray*}
\end{alertblock}}
\frame{\vspace{-2mm}
\begin{block}{Pairwise independence}
Events $A_1,...,A_n$ are pairwise independent iff $A_i$ and $A_j$ are independent for any pair $(i,j)$.
\vspace{1mm}

Mutual independence is stronger than pairwise independence.
\end{block}
\vspace{-2mm}
\begin{alertblock}{Example 1.3.11 (continued)}
$A_1,A_2,A_3$ are pairwise independent.
\vspace{1mm}

They are not mutually independent, because \vspace{-2mm} 
\[ P(A_1\cap A_2 \cap A_3) = \frac{1}{9} \neq \frac{1}{27} = P(A_1)P(A_2)P(A_3) \]
\end{alertblock}\vspace{-2mm}
\begin{block}{Example 1.3.10 (Tossing two dice)}
An experiment consists of tossing two dice.
\vspace{1mm} 

The sample space is  \vspace{-2mm}
\[ S = \left\{ \begin{array}{ccc}
(1,1) & \cdots & (1,6) \\
(2,1) & \cdots & (2,6) \\
\cdots & \cdots & \cdots \\
(6,1) & \cdots & (6,6) \end{array} \right\} 
\]
\end{block}}
\frame{\vspace{-2mm} 
\begin{block}{}
Consider\vspace{-2mm}
\begin{eqnarray*}
A & = & \{\mbox{the same digit appear twice} \} \quad\quad  P(A)=1/6\\
B &=& \{ \mbox{the sum is between 7 and 10} \}\quad \quad P(B)=1/2\\
C &=& \{ \mbox{the sum is 2, or 7, or 8} \}   \quad \quad P(C)= 1/3
\end{eqnarray*}
$~~$ \vspace{-7mm} 

Then\vspace{-2mm}
\[ P(A\cap B\cap C) = P(\{(4,4)\})
 = \frac{1}{36} = \frac{1}{6} \times \frac{1}{2} \times \frac{1}{3} = P(A)P(B)P(C)\vspace{-2mm}
 \]
However,  $A$, $B$, and $C$ are not independent, because \vspace{-2mm}
\[ P(B\cap C)= P( \{\mbox{the sum is 7 or 8}\}) = \frac{11}{36} \neq \frac{1}{6} = P(B)P(C)
\]
\end{block}\vspace{-2mm} 
\begin{alertblock}{Independent experiments}
\begin{itemize}
\item
Two experiments are independent iff any event in experiment 1 and any event in experiment 2 are independent.
\item
$n$ experiments are independent iff $A_1,...,A_n$ are independent, where $A_j$ is any event from experiment $j$, $j=1,...,n$.
\item
Independence of experiments is an important concept in statistics.
\end{itemize}
\end{alertblock} 
}
\frame{
\begin{block}{Conditional independence}
Events $A$ and $B$ are conditionally independent given event $C$ iff  \vspace{-1mm}
\[ P(A\cap B|C ) = P(A|C) P(B|C) \vspace{-1mm} \]
Conditional independence is an important concept in statistics.
\end{block}\vspace{-2mm}
\begin{alertblock}{Independence does not imply conditional independence}
In Example 1.3.11, \vspace{-2mm}
\[ A_i = \{\mbox{$i$th place in the triple is occupied by a}\}, \quad \quad i=1,2,3.\vspace{-1mm}\]
$A_1$ and $A_2$ are independent, but they are not conditionally independent given $A_3$, because\vspace{-2mm}
\[ P(A_1\cap A_2|A_3) = \frac{P(A_1\cap A_2\cap A_3)}{P(A_3)} = \frac{1/9}{1/3} = \frac{1}{3} \vspace{-2mm}\]
\[ P(A_1|A_3)P(A_2|A_3) = \frac{P(A_1\cap A_3)}{P(A_3)} \frac{P(A_2\cap A_3)}{P(A_3)}= P(A_1)P(A_2) = \frac{1}{9} \]
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{alertblock}{Conditional independence does not imply  independence}
\[ S = \left\{ \begin{array}{cccc}
aaa & bbb & ccc & abd \\
abc & bca & cba & acd \\
acb & bac & cab & bcd \end{array} \right\} \vspace{-2mm}\]
\[ A_i = \{\mbox{$i$th place in the triple is occupied by a} \}, \quad \quad i=1,2,3.\vspace{-2mm}\]
\[ B= \{\mbox{d does not appear}\} \vspace{-2mm}\]
$A_1$ and $A_2$ are conditionally independent given $B$, because \vspace{-2mm}
\[ P(A_1\cap A_2|B) = \frac{1}{9} = \frac{1}{3} \times \frac{1}{3} = P(A_1|B)P(A_2|B) \vspace{-2mm}\]
However, $A_1$ and $A_2$ are not independent, because \vspace{-2mm}
\[ P(A_1\cap A_2) = \frac{1}{9} \neq \frac{5}{12} \times \frac{3}{12} = P(A_1)P(A_2) \]
\end{alertblock}\vspace{-2mm}
\begin{block}{Mutual independence implies conditional independence}
If $A$, $B$, $C$ are mutually independent, then $A$ and $B$ are conditionally independent given $C$, because\vspace{-2mm}
\[ P(A\cap B|C) = \frac{P(A\cap B\cap C)}{P(C)} = P(A)P(B) = P(A|C)P(B|C) \]

\end{block}
}
\end{document}
