% \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<presentation>

\title{Conditional Distributions and Independent Random Variables (Section 2.8)\footnote{ This slide show is an open-source document. See last slide for copyright information.}}
\subtitle{STA 256: Fall 2019}
\date{} % To suppress date

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
\frametitle{Overview}
\tableofcontents
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Independence}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Independent Random Variables: Discrete or Continuous}
\framesubtitle{The real definition}  \pause
The random variables $X$ and $Y$ are said to be \emph{independent} if 

{\LARGE
\begin{displaymath}
    P(X \in A, Y \in B) = P(X \in A) P(Y \in B) 
\end{displaymath} \pause
} % End size

\vspace{6mm}
For all subsets\footnote{Okay, all Borel subsets.} $A$ and $B$ of the real numbers.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Big Theorem} 
\framesubtitle{We will use this as our criterion of independence} 
The random variables $X$ and $Y$ are independent if and only if

{\LARGE
\begin{displaymath}
    F_{_{X,Y}}(x,y) = F_{_X}(x)F_{_Y}(y)
\end{displaymath} \pause
} % End size

\vspace{6mm}
For all real $x$ and $y$.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Theorem (for discrete random variables)}
\framesubtitle{Recalling independence means $ F_{_{X,Y}}(x,y) =F_{_X}(x)F_{_Y}(y)$} \pause
The discrete random variables $X$ and $Y$ are independent if and only if \pause
{\LARGE
\begin{displaymath}
    p_{_{X,Y}}(x,y) = p_{_X}(x) \, p_{_Y}(y)
\end{displaymath} 
} % End size

for all real $x$ and $y$.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Theorem (for continuous random variables)}
\framesubtitle{Recalling independence means $ F_{_{X,Y}}(x,y) = F_{_X}(x)F_{_Y}(y)$}  \pause
The continuous random variables $X$ and $Y$ are independent if and only if \pause
{\LARGE
\begin{displaymath}
    f_{_{X,Y}}(x,y) = f_{_X}(x) \, f_{_Y}(y)
\end{displaymath} 
} % End size

at all continuity points of the densities.
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conditional Distributions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Conditional Distributions}
\framesubtitle{Of discrete random variables} \pause
If $X$ and $Y$ are discrete random variables, the conditional probability mass function of $X$ given $Y=y$ is \pause just a conditional probability. \pause It is given by \pause
%{\LARGE
\begin{displaymath}
    P(X=x|Y=y) = \frac{P(X=x,Y=y)}{P(Y=y)}
\end{displaymath} \pause
%} % End size

These are just probabilities of events. For example, \pause
\begin{displaymath}
    P(X=x,Y=y) = P\{\omega \in \Omega: X(\omega)=x \mbox{ and }
                                       Y(\omega)=y \}
\end{displaymath} \pause

We write
%{\LARGE
\begin{displaymath}
    p_{_{X|Y}}(x|y) =  \frac{p_{_{X,Y}}(x,y)}{p_{_Y}(y)}
\end{displaymath} \pause
%} % End size
Note that $p_{_{X|Y}}(x|y)$ is defined only for $y$ values such that $p_{_Y}(y)>0$. 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Conditional Probability Mass Functions}
\framesubtitle{Both ways} \pause

{\LARGE
\begin{displaymath}
    p_{_{Y|X}}(_{Y|X}) = \frac{p_{_{X,Y}}(x,y)}{p_{_X}(x)}
\end{displaymath}
} % End size

\vspace{3mm}

{\LARGE
\begin{displaymath}
    p_{_{X|Y}}(x|y) =  \frac{p_{_{X,Y}}(x,y)}{p_{_Y}(y)}
\end{displaymath} \vspace{3mm}
} % End size

Defined where the denominators are non-zero.
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Independence makes sense}
\framesubtitle{In terms of conditional probability mass functions} \pause
Suppose $X$ and $Y$ are independent. \pause Then $p_{_{X,Y}}(x,y) = p_{_X}(x)p_{_Y}(y)$\pause, and \pause
 
%{\LARGE
\begin{eqnarray*}
    p_{_{X|Y}}(x|y) & = & \frac{p_{_{X,Y}}(x,y)}{p_{_Y}(y)} \\ \pause
                 & = & \frac{p_{_X}(x)p_{_Y}(y)}{p_{_Y}(y)} \\ \pause
                 & = & p_{_X}(x)
\end{eqnarray*} \pause
%} % End size
So we see that the conditional distribution of $X$ given $Y=y$ is identical for every value of $y$. \pause It does not depend on the value of $y$. 
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{The other way} \pause
%\framesubtitle{s}
Suppose the conditional distribution of $X$ given $Y=y$  does not depend on the value of $y$. 
\pause Then \pause
 
%{\LARGE
\begin{eqnarray*}
    && p_{_{X|Y}}(x|y) = p_{_X}(x) \\ \pause
    & \Leftrightarrow & p_{_X}(x) = \frac{p_{_{X,Y}}(x,y)}{p_{_Y}(y)} \\ \pause
    & \Leftrightarrow & p_{_{X,Y}}(x,y) = p_{_X}(x) \, p_{_Y}(y)
\end{eqnarray*} \pause
%} % End size
So that $X$ and $Y$ are independent. 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Conditional distributions of continuous random variables} \pause
% \framesubtitle{ }
If $X$ and $Y$ are continuous random variables, the conditional probability density of $X$ given $Y=y$ is \pause

{\LARGE
\begin{displaymath}
    f_{_{X|Y}}(x|y) =  \frac{f_{_{X,Y}}(x,y)}{f_{_Y}(y)}
\end{displaymath} \pause
} % End size
\begin{itemize}
     \item Note that $f_{_{X|Y}}(x|y)$ is defined only for $y$ values such that $f_{_Y}(y)>0$. \pause
     \item It looks like we are conditioning on an event of probability zero\pause, but the conditional density is a limit of a conditional probability\pause, as the radius of a tiny region surrounding $(x,y)$ goes to zero.
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Conditional Probability Density Functions}
\framesubtitle{Both ways} \pause

{\LARGE
\begin{displaymath}
    f_{_{Y|X}}(y|x) = \frac{f_{_{X,Y}}(x,y)}{f_{_X}(x)}
\end{displaymath}
} % End size

\vspace{3mm}

{\LARGE
\begin{displaymath}
    f_{_{X|Y}}(x|y) =  \frac{f_{_{X,Y}}(x,y)}{f_{_Y}(y)}
\end{displaymath} \vspace{3mm}
} % End size

Defined where the denominators are non-zero.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Independence makes sense}
\framesubtitle{In terms of conditional densities} \pause
Suppose $X$ and $Y$ are independent. \pause Then $f_{_{X,Y}}(x,y) = f_{_X}(x)f_{_Y}(y)$\pause, and \pause
 
%{\LARGE
\begin{eqnarray*}
    f_{_{X|Y}}(x|y) & = & \frac{f_{_{X,Y}}(x,y)}{f_{_Y}(y)} \\ \pause
                 & = & \frac{f_{_X}(x)f_{_Y}(y)}{f_{_Y}(y)} \\ \pause
                 & = & f_{_X}(x)
\end{eqnarray*} \pause
%} % End size
And we see that the conditional density of $X$ given $Y=y$ is identical for every value of $y$. \pause It does not depend on the value of $y$. 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{The other way} \pause
%\framesubtitle{s}
Suppose the conditional density of $X$ given $Y=y$  does not depend on the value of $y$. 
\pause Then \pause
 
%{\LARGE
\begin{eqnarray*}
    && f_{_{X|Y}}(x|y) = f_{_X}(x) \\ \pause
    & \Leftrightarrow & f_{_X}(x) = \frac{f_{_{X,Y}}(x,y)}{f_{_Y}(y)} \\ \pause
    & \Leftrightarrow & f_{_{X,Y}}(x,y) = f_{_X}(x) \, f_{_Y}(y)
\end{eqnarray*} \pause
%} % End size
So that $X$ and $Y$ are 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{center}
\includegraphics[width=2in]{BivariateNormal}
\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

