% $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}}
\def\br{\begin{array}}
\def\er{\end{array}}

%%%%%%%%%%%%%%% MY DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Put your own definitions
%
\def\VaR{{\rm VaR}}
\def\E{{\rm E}}
\def\beqrs{\begin{eqnarray*}}           %\beqrs
\def\eeqrs{\end{eqnarray*}}             %\eeqrs

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

\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 10]{Stat 609: Mathematical Statistics \\ Lecture 10}
\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]}}

\begin{document}

%\frame{\titlepage}
\def\back{\!\!\!\!\!}

\frame {
\frametitle{Chapter 4: Multiple Random Variables\\
Lecture 10: Joint and conditional distributions}\vspace{-2mm}
\begin{alertblock}{}
So far we focus on the distribution of a single random variable.
\vspace{1mm}

In applications we need to consider a set of random variables jointly.
\vspace{1mm}

In some cases we study relationships among random variables.
\end{alertblock}\vspace{-2mm}
\begin{block}{Definition 4.1.1.}
For an integer $n$, $X = (X_1,...,X_n)$ is called
an $n$-dimensional random vector iff each $X_i$ is a random variable.
\end{block}\vspace{-2mm}
\begin{block}{Joint cdf's}
The joint cdf of an $n$-dimensional random vector $X$ is a function $F_X$ in ${\cal R}^n$ such that \vspace{-2mm}
\[ \br{lll}
 F_X(x_1,...,x_n) &= P\left( {\displaystyle \bigcap_{i=1}^n} \{ X_i \leq x_i \} \right)&
\ \ x_i \in {\cal R} \vspace{2mm} \\
&=  P( X_1 \leq x_1,...,X_n \leq x_n) & \ \ i=1,...,n \er
\]
\end{block}}
\frame{\vspace{-2mm}
\begin{alertblock}{Properties of cdf's}
\begin{itemize}
\item
$F_X$ is nondecreasing and right-continuous in any of its $n$ arguments.
\item
For any $i=1,...,n$ and fixed $x_1,...,x_{i-1},x_{i+1},...,x_n$, \vspace{-2mm}
\[ \lim_{x_i \rightarrow -\infty} F(x_1,...,x_{i-1},x_i,x_{i+1},...,x_n) =0 \vspace{-2mm} \]
\[ \lim_{x_i \rightarrow \infty, \ i=1,...,n} F(x_1,...,x_n) =1\]
\end{itemize}
\end{alertblock}\vspace{-2mm}
\begin{block}{Marginal cdf's}
For a random vector $X= (X_1,...,X_n)$ and any $i$, the cdf of $X_i$ is called the marginal cdf of $X_i$ and is equal to \vspace{-2mm}
\[ F_{X_i}(x_i) = \lim_{x_j \rightarrow \infty, \ j=1,...,i-1,i+1,...,n}
 F_X(x_1,...,x_n) \vspace{-2mm} \]
 Knowing the joint cdf $F_X$ we can obtain $n$ marginal cdf's, but
in general, knowing $F_{X_1},...,F_{X_n}$ is not enough to determine
the joint cdf $F_X$.
\end{block}\vspace{-2mm}
\begin{alertblock}{}
Similar to the univariate case, we mainly consider two types of random vectors, discrete random vectors and continuous random vectors.
\end{alertblock}}
\frame{\vspace{-2mm}
\begin{block}{Definition 4.1.3 (Discrete joint pmf)}
A random vector $X=(X_1,...,X_n)$ is discrete iff each $X_i$ is discrete. \\
The joint pmf of $X$ is \vspace{-2mm}
\[ f_X(x_1,...,x_n) = P(X_1=x_1,...,X_n=x_n), \vspace{-2mm} \]
which is positive only for countably many $(x_1,...,x_n) \in {\cal R}^n$.
\end{block}
\vspace{-2mm}
\begin{alertblock}{}
\begin{itemize}
\item
For any event $A \subset {\cal R}^n$,\vspace{-2mm}
\[ P(X\in A) = \sum_{(x_1,...,x_n)\in A} f_{X}(x_1,...,x_n) \vspace{-2mm}\]
\item
For any $i$, the marginal pmf of $X_i$ is\vspace{-2mm}
\[ f_{X_i} (x_i) = \sum_{x_1,...,x_{i-1},x_{i+1},...,x_n} f_X(x_1,...,x_n) \vspace{-2mm} \]
\item
For any function $g(x_1,...,x_n)$,
the expected value of $g(X_1,...,X_n)$ is\vspace{-2mm}
\[ E[g(X_1,...,X_n)] = \sum_{x_1,...,x_n} g(x_1,...,x_n)f_X(x_1,...,x_n) \vspace{-3mm} \]
\item
If $n=2$ and each $X_i$ takes finitely many values, then
the joint and marginal pmf's can be listed in
 a $2\times 2$ table.
\end{itemize}
\end{alertblock}}
\frame{ \vspace{-2mm}
\begin{alertblock}{}
\begin{center}
Values and joint and marginal pmf's of a 2-dimensional random vector \\
\vspace{2mm}
\begin{tabular}{c|cccc|c}
value & $x_{21}$ & $x_{22}$ & $\cdots$ & $x_{2c}$ & marginal \\ \hline
$x_{11}$ & $p_{11}$ & $p_{12}$ & $\cdots$ & $p_{1c} $ & $p_{1 \cdot}$ \\
$x_{12}$ & $p_{21}$ & $p_{22}$ &  $\cdots$ & $p_{2c} $ & $p_{2 \cdot }$ \\
$\cdots$ &  $\cdots$ &  $\cdots$ &  $\cdots$ &  $\cdots$ &  $\cdots$ \\
$x_{1r}$ & $p_{r1}$ & $p_{r2}$ &  $\cdots$ & $p_{rc} $ & $p_{r\cdot}$ \\ \hline
marginal & $p_{\cdot 1}$ & $p_{\cdot 2}$ & $\cdots$ & $p_{\cdot c}$ &  1 \\
\end{tabular}\\
\vspace{4mm}
$p_{ij} =P(X_1 =i , X_2=j)$, $p_{i \cdot}=P(X_1=i)$, $p_{\cdot j}(X_2=j)$.
\end{center}
 \end{alertblock}\vspace{-2mm}
 \begin{block}{Example:  Multinomial distribution}
An experiment has  $r$ possible outcomes $A_1,...,A_r$ with $P(A_i) = p_i$, $i=1,...,r$, $p_1+\cdots + p_r =1$.

We independently repeat the experiment $n$ times.

If $X_i $ is the number of times $A_i$ is the result in $n$ experiments, $i=1,...,r$, then
$X =(X_1,...,X_r)$ has joint pmf \vspace{-2mm}
\[ P(X_1=x_1,...,X_r=x_r) = \frac{n!}{x_1! \cdots x_r!} p_1^{x_1} \cdots p_r^{x_r}
\quad \quad 0 \leq x_j , \ \ \sum_{i=1}^r x_i =n \]
\end{block}}
\frame{
\begin{alertblock}{Multivariate hypergeometric distribution}
A bag contains $N$ balls with $r$ different colors.

$N_i =$ the number of balls for color $i$, $N_1+\cdots +N_r = N$.

We randomly select $n$ balls from the bag.

If  $X_i  $ is the number of selected balls having color $i$, $i=1,...,r$, then
$X =(X_1,...,X_r)$ has joint pmf \vspace{-2mm}
\[ P(X_1=x_1,...,X_r=x_r) = \frac{{N_1 \choose x_1} \cdots {N_r \choose x_r}}{{N \choose n}}
\quad \quad 0 \leq x_j , \ \ \sum_{i=1}^r x_i =n \]
\end{alertblock}\vspace{-2mm}
\begin{block}{}
What are the marginal pmf's for the multinomial and
multivariate hypergeometric distributions?
\end{block}\vspace{-2mm}
\begin{alertblock}{Definition 4.1.10 (continuous pdf)}
A random vector $X=(X_1,...,X_n)$ has a continuous joint pdf if there exists a nonnegative function $f_X$
 on ${\cal R}^n$ such that \vspace{-2mm}
\[  P(X \in A) = {\int \cdots \int}_{(x_1,...,x_n) \in A} f_{X}(x_1,...,x_n)dx_1\cdots dx_n \]
\end{alertblock}}
\frame{
\begin{alertblock}{}
\begin{itemize}
\item
If $X=(X_1,...,X_n) $ has joint pdf $f_X$, a short notation is \vspace{-2mm}
\[ P(X \in A) = \int_A f_X(x)dx \quad \quad x=(x_1,...,x_n) \vspace{-2mm} \]
\item
If the joint pdf $f_X$ exists, then\vspace{-2mm}
\[ F_X(x_1,...,x_n) = \int_{-\infty}^{x_1}\cdots \int_{-\infty}^{x_n} f_X(t_1,...,t_n)
dt_1\cdots dt_n \vspace{-2mm} \]
\item
If the joint cdf $F_X$ is differentiable, then the joint $f_X$ exists and\vspace{-2mm}
\[ f_X(x_1,...,x_n) = \frac{\partial^n F_X(x_1,...,x_n)}{\partial x_1\cdots \partial x_n},
\quad \quad (x_1,...,x_n)\in{\cal R}^n \vspace{-2mm}\]
\item
If the joint pdf $f_X$ exists, then the $i$th margianl pdf $f_{X_i}$ exists and \vspace{-2mm}
\[ f_{X_i}(x_i) = \int_{-\infty}^\infty \cdots
\int_{-\infty}^\infty f_X(x_1,...,x_n)dx_1\cdots dx_{i-1}dx_{i+1}\cdots dx_n\vspace{-2mm} \]
\item
If the joint pdf $f_X$ exists, then for any function $g(x_1,...,x_n)$,
the expected value of $g(X_1,...,X_n)$ is\vspace{-2mm}
\[ E[g(X_1,...,X_n)] = \int_{-\infty}^\infty  \cdots
\int_{-\infty}^\infty  g(x_1,...,x_n) f_X(x_1,...,x_n)dx_1\cdots dx_n  \]
\end{itemize}
\end{alertblock}}
\frame{
\begin{alertblock}{Example}
Suppose that a 2-dimensional random vector $(X,Y)$ has pdf\vspace{-2mm}
\[ f(x,y) = \left\{ \br{ll}
C e^{-(2x+3y)} & \quad x \geq 0, y \geq 0 \vspace{1mm} \\
0 & \quad \mbox{otherwise} \er \right. \vspace{-4mm} \]
\begin{itemize}
\item
What should $C$ be?
Since \vspace{-2mm}
\beqrs
 \int_{-\infty}^\infty \int_{-\infty}^\infty f(x,y) dx dy &=&
\int_0^\infty \int_0^\infty C e^{-(2x+3y)} dx dy \\
&=& C \int_0^\infty e^{-2x} dx \int_0^\infty e^{-3y}dy \\
& = & C \left( \frac{e^{-2x}}{2}\bigg|_\infty^0 \frac{e^{-3y}}{3}\bigg|_\infty^0 \right) = \frac{C}{6}
\eeqrs
must be 1, we obtain that $C=6$.
\item
The joint cdf of $(X,Y)$ is \vspace{-2mm}
\[ F(x,y) = \left\{ \br{ll}
(1-e^{-2x})(1-e^{-3y}) & \quad x \geq 0, y \geq 0 \\
0 & \quad \mbox{otherwise} \er \right.  \]
\end{itemize}
\end{alertblock}}
\frame{\vspace{-2mm} 
\begin{alertblock}{}
\hspace{8mm}This is because, for $x>0$ and $y>0$, \vspace{-2mm} 
\beqrs
  F(x,y) &=& \int_0^\infty \int_0^\infty 6 e^{-(2x+3y)} dxdy =  6 \int_0^\infty e^{-2x} dx \int_0^\infty 6 e^{-3y} dy \\
&=&   (1-e^{-2x})(1-e^{-3y}) 
\eeqrs
$~$ \vspace{-8mm}

\begin{itemize}
\item
Calculate $P(2X+3Y \leq 6)$.

It is not convenient to use the joint cdf.

Using the joint pdf, we obtain \vspace{-2mm}
\beqrs
P(2X+3Y \leq 6) &=& \int_{2x+3y \leq 6} f(x,y) dx dy
\eeqrs
\end{itemize}
\vspace{-6.5cm}
\begin{figure}[h]
\begin{center}
%\caption{Graph of $y=\sin^2(x)$ in Example 2.1.2.}
\includegraphics[height=5in, width=4.5in]{figure402.pdf}
\end{center}
\end{figure}
\end{alertblock}}
\frame{
\begin{alertblock}{}
\beqrs
& = & 6 \int_0^3 \left[ \int_0^{(6-2x)/3} e^{-(2x+3y)} dy \right] dx
= 6 \int_0^3 e^{-2x} \left[ - \frac{e^{-3y}}{3}\bigg|_0^{(6-2x)/3}\right] dx \\
& = &  6 \int_0^3 e^{-2x} \left[ \frac{1}{3} - \frac{e^{-(6-2x)}}{3} \right] dx
= 2 \int_0^3 (e^{-2x} - e^{-6} ) dx \\
& = & - e^{-2x}\bigg|_0^3 -2e^{-6} \times 3 = 1- e^{-6} - 6 e^{-6} \\
& = & 1- 7e^{-6}
\eeqrs
\end{alertblock}\vspace{-2mm}
\begin{block}{Example 4.1.12.}
Suppose that a 2-dimensional random vector $(X,Y)$ has pdf\vspace{-2mm}
\[ f(x,y) = \left\{ \br{ll}
e^{-y} & \quad 0< x < y  \vspace{1mm} \\
0 & \quad \mbox{otherwise} \er \right. \vspace{-2mm} \]
We want to calculate $P(X+Y \geq 1)$.
\end{block}
}
\frame{\vspace{-2mm}
\begin{block}{}
Note that \vspace{-3mm}
\beqrs
 P(X+Y<1) &=& \int_{x+y<1} f(x,y) dx dy =
\int_0^{1/2} \left( \int_x^{1-x} e^{-y} dy \right) dx \\
&=& \int_0^{1/2} (e^{-x} - e^{-(1-x)} ) dx = 1-e^{-1/2} - e^{-1/2} + e^{-1} \\
& = & 1+e^{-1} -2e^{-1/2}
\eeqrs
$~$ \vspace{-7mm} 

Hence, \vspace{-2mm}
\[ P(X+Y \geq 1 ) = 1- P(X+Y < 1) = 2e^{-1/2} -e^{-1} \]
\vspace{-8.5cm}
\begin{figure}[h]
\begin{center}
%\caption{Graph of $y=\sin^2(x)$ in Example 2.1.2.}
\includegraphics[height=6in, width=6in]{figure403.pdf}
\end{center}
\end{figure}
\end{block}
}
\frame{
\begin{alertblock}{Example}
Let 
\[ f(x,y) = \left\{ \br{ll} 
\frac{x^{\alpha -1} (y-x)^{\beta -1} e^{-y} }{\Gamma (\alpha )\Gamma (\beta )} & \quad 0 <x<y \\
0 & \quad \mbox{otherwise} \er \right. \]
where $\alpha>0$ and $\beta >0$ are constants. 
\vspace{1mm}

We want to show this is a pdf and find its two marginal pdf's. 
\vspace{1mm}

For $x>0$, consider \vspace{-1mm} 
\beqrs
 f_X(x) &=&  \int_{-\infty}^\infty f(x,y) dy = \int_x^\infty 
\frac{x^{\alpha -1} (y-x)^{\beta -1} e^{-y} }{\Gamma (\alpha )\Gamma (\beta )} dy \\
&=& \frac{x^{\alpha -1}  }{\Gamma (\alpha )\Gamma (\beta )} \int_0^\infty u^{\beta -1} e^{-(u+x)}du \quad\quad\quad y-x= u \\
&=& \frac{x^{\alpha -1}  }{\Gamma (\alpha )} e^{-x}
\eeqrs
$~$ \vspace{-5mm} 

This is the pdf of $Gamma(\alpha , 1)$, which also shows that $f(x,y)$ is a  pdf. 
\vspace{1mm}

The other marginal pdf is, for $y>0$,  
\end{alertblock}}
\frame{\vspace{-2mm}
\begin{alertblock}{}
\vspace{-4mm}
\beqrs
 f_Y(y) &=&  \int_{-\infty}^\infty f(x,y) dx = \int_0^y
\frac{x^{\alpha -1} (y-x)^{\beta -1} e^{-y} }{\Gamma (\alpha )\Gamma (\beta )} dx \\
&=& \frac{e^{-y}  }{\Gamma (\alpha )\Gamma (\beta )} \int_0^1 (ty)^{\alpha -1}(y-ty)^{\beta -1} y dt \quad\quad\quad x= ty \\
&=& \frac{y^{\alpha+\beta -1} e^{-y}  }{\Gamma (\alpha )\Gamma (\beta )} \int_0^1 t^{\alpha -1}(1-t)^{\beta -1}  dt  = \frac{y^{\alpha+\beta -1} e^{-y}  }{\Gamma (\alpha + \beta )}  
\eeqrs 
$~$ \vspace{-4mm}

which is the pdf of $Gamma (\alpha + \beta , 1)$. 
\end{alertblock}\vspace{-2mm}
	\begin{alertblock}{Definition 4.2.1 (conditional pmf)}
		Let $(X_1,...,X_n)$ be a discrete random vector with joint pmf $f(x)$ and $k$ be an integer
		satisfying $1 \leq k \leq n-1$. The conditional pmf of $(X_{k+1},...,X_n)$
		given that $(X_1,...,X_k) = (x_1,...,x_k)$ 
		 with 		 $P( X_1=x_1,...,X_k=x_k)>0$ is\vspace{-2mm}
		\beqrs
		f(x_{k+1},...,x_n|x_1,...,x_k) \!\!\!\!\! &=& \!\!\!\!\! P( X_{k+1}=x_{k+1},..., X_n=x_n |
		X_1=x_1,...,X_k=x_k)  \\
		\!\!\!\!\! & = & \!\!\!\!\! \frac{f(x_1,...,x_n)}{{\displaystyle \sum_{(y_{k+1},...,y_n) \in {\cal N}_k}} f(x_1,...,x_k,y_{k+1},...,y_n) }
		\eeqrs
		\vspace{-5mm}
		
		where ${\cal N}_k = \{(y_{k+1},...,y_n): P( X_{k+1} =y_{k+1},...X_n=y_n) >0 \} $.
	\end{alertblock}}
	\frame{\vspace{-2mm}
	\begin{alertblock}{}
		\begin{itemize}
			\item
			It can be easily verified that $ f(x_{k+1},...,x_n|x_1,...,x_k)$ is a pmf for any $(x_1,...,x_k)$ with
			$P( X_1=x_1,...,X_k=x_k)>0$.
			\item
			The conditional pmf $ f(x_{k+1},...,x_n|x_1,...,x_k)$ vary with $x_1,...,x_k$.
			\item
			For any event $A \subset {\cal R}^{n-k}$, \vspace{-3mm}
			\beqrs
			&&  P((X_{k+1},...,X_n) \in A |X_1=x_1,...,X_k=x_k)  \\
			&= & \sum_{(x_{k+1},...,x_n)\in A} \!\!\!\!\! f(x_{k+1},...,x_n|x_1,...,x_k)
			\eeqrs
		\end{itemize}
	\end{alertblock}\vspace{-2mm}
	\begin{block}{Definition 4.2.3 (conditional pdf)}
		Let $(X_1,...,X_n)$ be a random vector with joint pdf $f(x)$ and $k$ be an integer
		satisfying $1 \leq k \leq n-1$. The conditional pdf of $(X_{k+1},...,X_n)$
		given that $(X_1,...,X_k) = (x_1,...,x_k)$ is\vspace{-2mm}
		\[  f(x_{k+1},...,x_n|x_1,...,x_k) = \frac{f(x_1,...,x_n)}{{\displaystyle \int_{{\cal R}^{n-k} }} f(x_1,...,x_k,y_{k+1},...,y_n)dy_{k+1} \cdots dy_n} \vspace{-2mm}\]
		assuming that the denominator is not 0.
	\end{block}
}
\frame{
	\begin{block}{}
		It can be easily verified that $ f(x_{k+1},...,x_n|x_1,...,x_k)$ is a pdf and for any event $A \subset {\cal R}^{n-k}$, \vspace{-3mm}
		\[  P((X_{k+1},...,X_n) \in A |X_1=x_1,...,X_k=x_k)  \vspace{-2mm} \]
		\[ = \int_A f(x_{k+1},...,x_n|x_1,...,x_k) dx_{k+1}\cdots dx_n \vspace{-2mm} \]
		In general, for random vectors $X$ and $Y$
		(discrete or conditions), we use the notation $Y|X=x$ or $Y|X$ to denote the conditional distribution $Y$ given $X=x$ or given $X$.
	\end{block}\vspace{-2mm}
	\begin{alertblock}{Example 4.2.4.}
		Suppose that a 2-dimensional random vector $(X,Y)$ has pdf \vspace{-2mm}
		\[ f(x,y) = \left\{ \br{ll}
		e^{-y} & \quad 0 <x< y \\
		0 & \quad \mbox{otherwise} \er \right. \vspace{-2mm} \]
		The marginal pdf of $X$ is \vspace{-2mm}
		\[ f_X(x) = \int_{-\infty}^\infty f(x,y) dy = \int_x^\infty e^{-y} dy = e^{-x} \vspace{-2mm} \]
		if $x>0$; $f_X(x) = 0 $ if $x \leq 0$; i.e., $X \sim exponential(0,1)$.
	\end{alertblock}\vspace{-2mm}
}
\frame{
	\begin{alertblock}{}
		For each $x>0$, \vspace{-3mm}
		\[ f(y|x) = \frac{f(x,y)}{f_X(x)} = \left\{ \br{ll}
		\frac{e^{-y}}{e^{-x}} = e^{-(y-x)} & \quad y>x \\
		0 & \quad y \leq x \er \right. \vspace{-2mm} \]
		i.e., $f(y|x)$ is the pdf of $exponential(x,1)$ for $x>0$.
		
		Thus, $Y|X=x \sim exponential(x,1)$ or $Y|X \sim exponential(X,1)$.
	\end{alertblock}\vspace{-2mm}
	\begin{block}{Conditional expectations}
		Let $(X_1,...,X_n)$ be a random vector with joint pmf or pdf $f(x)$,  $k$ be an integer
		satisfying $1 \leq k \leq n-1$, and $g$ be a function on ${\cal R}^{n-k}$. The conditional expectation of $g(X_{k+1},...,X_n)$
		given $(X_1,...,X_k) = (x_1,...,x_k)$ is\vspace{-2mm}
		\[ E[g(X_{k+1},...,X_n)|X_1=x_1,...,X_k=x_k] \vspace{-2mm} \]
		\[ = \sum_{x_{k+1},...,x_n} g(x_{k+1},...,x_n)
		f(x_{k+1},...,x_n|x_1,...,x_k) \vspace{-2mm} \]
		when $f$ is a pmf and \vspace{-2mm}
		\[ = \int_{{\cal R}^{n-k} } g(x_{k+1},...,x_n)
		f(x_{k+1},...,x_n|x_1,...,x_k) dx_{k+1}\cdots dx_n    \vspace{-2mm}\]
		when $f$ is a pdf.
	\end{block}}
	\frame{
		\begin{block}{}
			\begin{itemize}
				\item
				The condition expectation $E[g(X_{k+1},...,X_n)|X_1=x_1,...,X_k=x_k]$ is a function of $x_1,...,x_k$.
				\item
				It is an expectation of the conditional distribution.
				\item
				Let $h(x_1,...,x_k) = E[g(X_{k+1},...,X_n)|X_1=x_1,...,X_k=x_k]$. \\
				Then
				$h(X_1,...,X_k)$ is a random variable and is denoted by
				$E[g(X_{k+1},...,X_n)|X_1,...,X_k]$.
			\end{itemize}
		\end{block} \vspace{-2mm}
		\begin{alertblock}{Example 4.2.4.}
			Since $Y|X \sim exponential(X,1)$, the conditional expectation of $Y$ given $X$ is $E(Y|X) = 1+X$, and the conditional expectation of $[Y-E(Y|X)]^2$ given $X$ is \vspace{-3mm}
			\beqrs
			E\{ [Y-E(Y|X)]^2|X\} &=& \int_X^\infty [y-(1+X)]^2 e^{-y}dy \\
			&=&  \int_X^\infty y^2 e^{-y}dy - (1+X)^2 \\
			&=& 1+ (1+X)^2 - (1+X)^2 = 1
			\eeqrs
			Note that the function $g$ may depend on $X$ (treated as a constant).
		\end{alertblock}}

		\frame{\vspace{-2mm}
			\begin{block}{Properties of conditional expectations} \vspace{-0.3mm}
				Conditional expectations have the following  useful properties.
				
				Let $X$, $Y$, and $Z$ be random variables.\vspace{-0.3mm}
				\begin{enumerate}
					\item
					If $P(Y=c)=1$ for a constant $c$, then $E(Y|X)=c$.\vspace{-0.2mm}
					\item
					If $Y \leq Z$, then $E(Y |X) \leq E(Z|X)$.\vspace{-0.2mm}
					\item
					For constants $a$ and $b$, $E(aY+bZ|X) = aE(Y|X)+bE(Z|X)$.\vspace{-0.2mm}
					\item
					$E [E(Y|X)] = E(Y)$ (Theorem 4.4.3). This can be interpreted as: the average of averages is the overall average.\vspace{-0.2mm}
					\item
					${\rm Var}(Y) = E[{\rm Var}(Y|X)] + {\rm Var}(E(Y|X))$ (Theorem 4.4.7), where
					Var$(Y|X)$ is the variance of  the conditional distribution $Y|X$.\vspace{-0.2mm}
					\item
					For any function $g(X)$, $E[Yg(X)|X] = g(X)E(Y|X)$.\vspace{-0.2mm}
				\end{enumerate}
					Except for property 2, all properties can be extended to random vectors
					$X$, $Y$, and $Z$ with appropriate modifications on vector multiplications.
			\end{block}
			\vspace{-3mm}
			\begin{alertblock}{Proof of Theorem 4.4.3.}
				Consider the continuous case where $(X,Y)$ has pdf $f(x,y)$. \vspace{-3mm}
				\beqrs
				E(Y) &=& \int_{-\infty}^\infty y f_Y(y) dy
				=  \int_{-\infty}^\infty y \left[ \int_{-\infty}^\infty f(x,y) dx \right] dy
				\eeqrs
			\end{alertblock}
		}
		\frame{\vspace{-2mm}
			\begin{alertblock}{} \vspace{-4mm}
				\beqrs
				&=&  \int_{-\infty}^\infty  \left[ \int_{-\infty}^\infty y f(x,y)dy \right]  dx
				=\int_{-\infty}^\infty  \left[ \int_{-\infty}^\infty y \frac{f(x,y)}{f_X(x)} dy \right] f_X(x) dx \\
				&=&  \int_{-\infty}^\infty  \left[ \int_{-\infty}^\infty y f(y|x) dy \right] f_X(x) dx
				= \int_{-\infty}^\infty  E(Y|X=x) f_X(x) dx\\
				&  =&  E[E(Y|X)]
				\eeqrs
			\end{alertblock}
			\vspace{-2mm}
			\begin{alertblock}{Proof of Theorem 4.4.7.}
				Using properties 1, 3, 4, and 6, we obtain \vspace{-1mm}
				\vspace{-2mm}
				\beqrs
				{\rm Var}(Y) & = & E [Y-E(Y)]^2 = E \left(  E \{ [Y-E(Y)]^2 |X\} \right) \\
				& = & E \left(  E \{ [Y-E(Y|X) + E(Y|X) - E(Y)]^2 |X\} \right) \\
				& = & E \left(  E \{ [Y-E(Y|X) ]^2 |X \} \right)
				+ E \left( E\{ [E(Y|X) - E(Y)]^2 |X\} \right) \\
				&& + 2 E \left(E \{ [Y-E(Y|X) ][ E(Y|X) - E(Y)]|X\} \right) \\
				& = &  E\left( {\rm Var}(Y|X) \right) + E\left( [E(Y|X) - E(Y)]^2 \right)   \\
				&& + 2 E \left([ E(Y|X) - E(Y)] E \{ [Y-E(Y|X) ]|X\} \right) \\
				& = & E[{\rm Var}(Y|X) ] + {\rm Var} (E(Y|X))
				\eeqrs
			\end{alertblock}
		}
\end{document}
			

