% \documentclass[serif]{beamer} % Serif for Computer Modern math font.
\documentclass[serif, handout]{beamer} % Handout to ignore pause statements.
\hypersetup{colorlinks,linkcolor=,urlcolor=red}
\usefonttheme{serif} % Looks like Computer Modern for non-math text -- nice!
\setbeamertemplate{navigation symbols}{} % Suppress navigation symbols
% \usetheme{Berlin} % Displays sections on top
\usetheme{Frankfurt} % Displays section titles on top: Fairly thin but still swallows some material at bottom of crowded slides
%\usetheme{Berkeley}
\usepackage[english]{babel}
\usepackage{amsmath} % for binom
\usepackage{amsfonts} % for \mathbb{R} The set of reals
% \usepackage{graphicx} % To include pdf files!
% \definecolor{links}{HTML}{2A1B81}
% \definecolor{links}{red}
\setbeamertemplate{footline}[frame number]
\mode
\title{Conditional Probability and Independence\footnote{ This slide show is an open-source document. See last slide for copyright information.} (Section 1.5)}
\subtitle{STA 256: Fall 2019}
\date{} % To suppress date
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Overview}
\tableofcontents
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conditional Probability}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Conditional Probability: The idea} \pause
%\framesubtitle{}
\begin{itemize}
\item If event $A$ has occurred, maybe the probability of $B$ is different from the probability of $B$ overall. \pause
\item Maybe the chances of an auto insurance claim are different depending on the type of car. \pause
\item We will talk about the \emph{conditional} probability of an insurance claim \emph{given} that the car is a Dodge Charger. \pause
\item Or the conditional probability of graduating within five years, given that the student works full time during the school year.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Restrict the sample space}
%\framesubtitle{}
To condition on the event $A$, make $A$ the new, restricted sample space. \pause
\begin{center}
\vspace{2mm}
\includegraphics[width=2in]{Venn3} \pause
\vspace{2mm}
\end{center}
Express the probability of $B$ as a fraction of the probability of $A$\pause, provided the probability of $A$ is not zero. \pause
\begin{displaymath}
P(B|A) = \frac{P(A\cap B)}{P(A)}
\end{displaymath}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Definition: The probability of $B$ given $A$}
%\framesubtitle{}
\begin{center}
{\Large
If $P(A)>0$, \pause $\displaystyle P(B|A) = \frac{P(A\cap B)}{P(A)}$
} % End size
\vspace{2mm} \pause
\includegraphics[width=3in]{HIV} \pause
% \vspace{2mm}
$P(B|F) = \frac{P(A\cap F)}{P(F)} \pause = \frac{0.01}{0.50} \pause = 0.02$
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Either Direction}
%\framesubtitle{}
{\Large
\begin{displaymath}
P(A|B) = \frac{P(A\cap B)}{P(B)}
\end{displaymath}
} % End size
Or,
{\Large
\begin{displaymath}
P(B|A) = \frac{P(A\cap B)}{P(A)}
\end{displaymath}
} % End size
\begin{center}
\vspace{2mm}
\includegraphics[width=2in]{Venn2} \pause
\vspace{2mm}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Multiplication Formula (1.5.2)}
\framesubtitle{$P(B|A) = \frac{P(A\cap B)}{P(A)} \Rightarrow P(A\cap B) = P(A)P(B|A)$} \pause
{\Large
\begin{displaymath}
P(A\cap B) = P(A)P(B|A)
\end{displaymath} \pause
} % End size Note alphabetical order
\vspace{10mm}
Useful for sequential experiments. \pause A jar contains 15 red balls and 5 blue balls. \pause What is the probability of randomly drawing a red and then a blue? \pause
\vspace{3mm}
$P(R_1 \cap B_2) \pause = P(R_1)P(B_2|R_1) \pause = \frac{15}{20} \, \frac{5}{19}
\pause = \frac{15}{76} \pause \approx 0.197$
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Make a Tree}
\framesubtitle{Justified by the multiplication formula: Not in the text}
%\begin{center}
\includegraphics[width=4.55in]{tree}
%\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Trees}
%\framesubtitle{}
\begin{itemize}
\item Can be extended to more than 2 stages. \pause
\item Are best for \emph{small} sequential experiments. \pause
\item Can allow you to side-step two important theorems, if the problem is set up nicely for you. \pause
\begin{itemize}
\item The Law of Total Probability \pause
\item Bayes' Theorem.
\end{itemize}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Law of Total Probability, conditioned version}
\framesubtitle{Theorem 1.5.1 in the text} \pause
Partition $S$ into $A_1, A_2, \ldots$, disjoint, with $P(A_k)>0$ for all $k$. \pause
\vspace{3mm}
\begin{columns}
\column{0.5\textwidth}
\begin{center}
\includegraphics[width=2in]{TotalProb2}
\end{center} \pause
\column{0.5\textwidth}
$B = \cup_{k=1}^\infty(A_k \cap B)$, disjoint \pause
\begin{eqnarray*}
P(B) & = & \sum_{k=1}^\infty P(A_k \cap B) \\ \pause
& = & \sum_{k=1}^\infty P(A_k)P(B|A_k)
\end{eqnarray*}
\end{columns} \pause
\vspace{3mm}
Applies to finite partitions too.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Example}
\framesubtitle{Law of Total Probability: $P(B) = \sum_{k=1}^n P(A_k)P(B|A_k)$}
A jar contains two fair coins and one fair die. The coins have a ``1" on
one side and a ``2" on the other side. Pick an object at random, roll or
toss, and observe the number. \pause \vspace{2mm}
Can do this with a tree and get $P(2) = \frac{7}{18}$. \pause Or, \pause
\begin{eqnarray*}
P(2) & = & P(\mbox{Coin 1}) \, P(2|\mbox{Coin 1}) \\
& + & P(\mbox{Coin 2}) \, P(2|\mbox{Coin 2}) \\
& + & P(\mbox{Die}) \, P(2|\mbox{Die}) \\ \pause
& = & \frac{1}{3} \cdot \frac{1}{2} + \frac{1}{3} \cdot \frac{1}{2} +
\frac{1}{3}\cdot\frac{1}{6} \\ \pause
& = & \frac{7}{18}
\end{eqnarray*}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Thomas Bayes (1701-1761)}
\framesubtitle{Image from the Wikipedia}
\begin{center}
\includegraphics[width=2.8in]{Thomas_Bayes}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Bayes Theorem: The idea} \pause
%\framesubtitle{}
{\Large
Bayes' Theorem allows you to turn conditional probability around, and obtain $P(A|B)$ from $P(B|A)$.
} % End size
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Bayes' Theorem}
\framesubtitle{Our text gives the simplest version} \pause
{\Large
\begin{displaymath}
P(A|B) = \frac{P(A) P(B|A)}{P(B)}
\end{displaymath} \pause
} % End size
Proof:
\begin{eqnarray*}
P(A|B) &=& \frac{P(A\ \cap B)}{P(B)} \\ \pause
&=& \frac{P(A)P(B|A)}{P(B)}
\end{eqnarray*}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Two more versions of Bayes' Theorem}
\framesubtitle{$P(A|B) = \frac{P(A) P(B|A)}{P(B)}$ and use Law of Total Probability on $P(B)$} \pause
Let $S = \cup_{k=1}^\infty A_k$, disjoint\pause, with $P(A_k)>0$ for all $k$. Then \pause \vspace{3mm}
{\Large
\begin{displaymath}
P(A_j|B) = \frac{P(A_j)P(B|A_j)}{\sum_{k=1}^\infty P(A_k)P(B|A_k)}
\end{displaymath} \pause
} % End size
\vspace{2mm}
An important special case is \pause
%\vspace{2mm}
{\Large
\begin{displaymath}
P(A|B) = \frac{P(A)P(B|A)}{P(A)P(B|A) + P(A^c)P(B|A^c)}
\end{displaymath}
} % End size
\end{frame}
% Jump to sample questions now.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Independence}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Independence: The idea} \pause
%\framesubtitle{}
\begin{itemize}
\item Independent means totally unrelated. \pause
\item Occurrence of the event $A$ tells you \emph{nothing} about whether event $B$ will occur. \pause
\item If we say that (for people without vanity plates) that the license plate number is independent of whether the car will get in an accident\pause, it means that the license plate number has \emph{no connection} to whether the car gets in an accident. \pause
\item If we say that taking Vitamin C supplements is independent of whether you get cancer, it means that taking Vitamin C supplements has \emph{no connection} to whether you get cancer or not. \pause
\item It's a strong statement. \pause
\item It has a precise technical definition.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Independence of two events: Definition}
%\framesubtitle{}
Suppose $P(B|A) = P(B)$. \pause
\vspace{5mm}
\begin{eqnarray*}
& & \frac{P(A \cap B)}{P(A)} = P(B) \\ \pause
& \Rightarrow \pause & P(A \cap B) = P(A) \, P(B) \pause
\end{eqnarray*}
We use this \emph{definition}. \pause We say the events $A$ and $B$ are independent when \pause
{\LARGE
\begin{displaymath}
P(A \cap B) = P(A) \, P(B)
\end{displaymath} \pause
} % End size
It's symmetric, and applies even if $P(A)=0$ or $P(B)=0$.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Independent is not the same as disjoint!}
\framesubtitle{A very common error} \pause
\begin{center}
\includegraphics[width=4in]{Venn2}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Independence of several events}\pause
% \framesubtitle{}
A set of events $A_1, \ldots, A_n$ are said to be \emph{independent} if the probability of the intersection of any sub-collection is the product of probabilities. \vspace{5mm} \pause
Pairwise independence is not enough.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Example: Pairwise independent but not independent }\pause
% \framesubtitle{}
A fair coin is tossed twice. \pause Outcomes are \hspace{1mm} HH, HT, TH, TT \pause \linebreak
Let \pause
\begin{itemize}
\item[]$A$ = Head on first toss. \pause
\item[]$B$ = Head on second toss. \pause
\item[]$C$ = Exactly one Head. \pause
\item[]
\item[] $P(A)=P(B)=P(C) = \frac{1}{2}$ \pause
\item[] $P(A \cap B) \pause = \frac{1}{4} \pause = P(A)P(B)$ \pause
\item[] $P(A \cap C) \pause = P(\mbox{HT}) = \frac{1}{4} \pause = P(A)P(C) $ \pause
\item[] And similarly for $P(B \cap C)$ \pause
\item[] But $P(A \cap B \cap C) = \pause P(\emptyset) \pause = 0 \pause \neq \frac{1}{8}$.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{``The dice have no memory"} \pause
%\framesubtitle{}
Outcomes of simple statistical experiments like repeatedly flipping a coin or rolling a die will always be assumed independent.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Copyright Information}
This slide show was prepared by \href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner},
Department of Statistical Sciences, University of Toronto. It is licensed under a
\href{http://creativecommons.org/licenses/by-sa/3.0/deed.en_US}
{Creative Commons Attribution - ShareAlike 3.0 Unported License}. Use any part of it as you like and share the result freely. The \LaTeX~source code is available from the course website:
\vspace{5mm}
\href{http://www.utstat.toronto.edu/~brunner/oldclass/256f19} {\small\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/256f19}}
\end{frame}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{} \pause
%\framesubtitle{}
\begin{itemize}
\item \pause
\item \pause
\item
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Tree}
\framesubtitle{Useful for small sequential experiments} \pause
\begin{center}
\includegraphics[width=4.5in]{tree}
\end{center}
\end{frame}