% vim: tw=50
% 03/02/2022 11AM

\begin{example}[Simpson's Paradox]
    \[ A = \{\text{change colour}\}, \qquad B =
    \{\text{blue}\} \qquad B^c = \{\text{green}\} \]
    \[ C = \{\text{Cambridge}\} \qquad C^c =
    \{\text{Oxford}\} \]
    \[ \PP(A \mid B \cap C) > \PP(A \mid B^c \cap
    C) \]
    \[ \PP(A \cap B \cap C^c) > \PP(A \mid B^c
    \cap C^c) \]
    \[ \cancel{\implies} \PP(A \mid B) > \PP(A
    \mid B^c) \]
\end{example}

\subsubsection*{Law of Total Probability for Conditional Probabilities}

Suppose $C_1, C_2, \dots$ a partition of $B$.
\begin{align*}
    \PP(A \mid B)
    &= \frac{\PP(A \cap B)}{\PP(B)} \\
    &= \frac{\PP \left( A \cap \left( \bigcup_n
    C_n \right) \right)}{\PP(B)} \\
    &= \frac{\PP \left( \bigcup_n \left( A \cap
    C_n \right) \right)}{\PP(B)} \\
    &= \frac{\sum_n \PP (A \cap C_n)}{\PP(B)} \\
    &= \frac{\sum_n \PP (A \mid C_n)
    \PP(C_n)}{\PP(B)} \\
    &= \sum_n \PP(A \mid C_N) \frac{\PP(B \cap
    C_n)}{\PP(B)} \\
    &= \sum_n \PP(A \mid C_n)
    \frac{\PP(C_n)}{\PP(B)}
\end{align*}
Conclusion:
\[ \PP(A \mid B) = \sum_n \PP(A \mid C_n) \PP(C_n
\mid B) \]
Special case:
\begin{itemize}
    \item If all $\PP(C_n)$ are equal, then all
        $\PP(C_n \mid B)$ are equal too.
    \item If $\PP(A \mid C_n)$s all equal, then
        $\PP(A \mid B) = \PP(A \mid C_n)$ also.
\end{itemize}

\begin{example*}
    Uniform permutation $(\sigma(1), \dots,
    \sigma(52)) \in \sum_{52}$ (``well-shuffled
    cards''). $\{1, 2, 3, 4\}$ are \emph{aces}.
    What is $\PP(\{\sigma(1), \sigma(2) \text{
    both aces}\})$?
    \[ A = \{\sigma(1), \sigma(2) \text{ aces}\},
    \qquad B = \{\sigma(1) \text{ is ace}\} =
    \{\sigma(1) \le 4\} \]
    \[ C_1 = \{\sigma(1) = 1\}, \dots, C_4 =
    \{\sigma(1) = 4\} \]
    \begin{note*}
        \begin{itemize}
            \eqitem \begin{align*}
                \PP (A \mid C_i)
                &= \PP(\sigma(2) \in \{1, 2, 3,
                4\} \mid \sigma(1) = i)
                &&i \le 4 \\
                &= \frac{3}{51}
            \end{align*}
        \item $\PP(C_1) = \cdots = \PP(C_4) =
            \frac{1}{52}$
        \end{itemize}
    \end{note*}
    So conclude:
    \[ \PP(A \mid B) = \frac{3}{51} \]
    \[ \PP(A) = \PP(B) \times \PP(A \mid B) =
    \frac{4}{52} \times \frac{3}{51} \]
\end{example*}

\newpage
\section{Discrete Random Variables}

Motivation: Roll two dice.
\[ \Omega = \{1, \dots, 6\}^2 = \{(i, j) : 1 \le
i, j \le 6\} \]
Restrict attention to first dice, for example
$\{(i, j) : i = 3\}$, or sum of dice values for
example $\{(i, j) : i + j = 8\}$, or max of dice,
for example $\{(i, j) : i, j \le 4, i \text{ or }
j = 4\}$. \\
\ul{Goal}: ``Random real-valued measurements''.

\begin{definition*}
    A \emph{discrete random variable} $X$ on a
    probability space $(\Omega, \mathcal{F}, \PP)$
    is a function $X : \Omega \to \RR$ such that
    \begin{itemize}
        \item $\{\omega \in \Omega : X(\omega) = x\} \in
            \mathcal{F}$
        \item $\mathrm{Im}(X)$ is finite or
            countable (subset of $\RR$)
    \end{itemize}
    If $\Omega$ finite or countable and
    $\mathcal{F} = \mathcal{P}(\Omega)$ then both
    bullet points hold automatically.
\end{definition*}

\begin{example*}[Part II Applied Probability]
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/cb1b08768f4511ec.png}
    \end{center}
    \[ \Omega = \{\text{countable subsets $(a_1,
    a_2, \dots)$ of $(0, \infty)$}\} \]
    \begin{align*}
        N_t
        &= \text{number of arrivals by time $t$}
        \\
        &= |\{a_i : a_i \le t\}| \in \{0, 1, 2,
        \dots\}
    \end{align*}
    is a discrete random variable for each time
    $t$.
\end{example*}

\begin{definition*}
    The \emph{probability mass function} of
    discrete random variable $X$ is the function
    $p_X : \RR \to [0, 1]$ given by
    \[ p_X(x) = \PP(X = x)  \,\,\forall\,\,x \in
    \RR \]
    \begin{note*}
        \begin{itemize}
            \item if $x \not\in \mathrm{Im}(X)$
                then
                \[ p_X(x) = \PP(\{\omega \in
                \Omega : X(\omega) = x\}) =
                \PP(\emptyset) = 0 \]
            \eqitem \begin{align*}
                \sum_{x \in \mathrm{Im}(X)}
                P_X(x)
                &= \sum_{x \in
                \mathrm{Im}(X)} \PP(\{\omega \in
                \Omega : X(\omega) = x\}) \\
                &=
                \PP\left(\bigcup_{x \in \mathrm{Im}(x)}
                \left\{\omega \in \Omega : X(\omega) =
                x\right\}\right) \\
                &= \PP(\Omega) \\
                &= 1
            \end{align*}
        \end{itemize}
    \end{note*}
\end{definition*}

\begin{example*}
    Event $A \in \mathcal{F}$, define
    $\mathbbm{1}_A : \Omega \to \RR$ by
    \[ \mathbbm{1}_A(\omega) = \begin{cases}
        1 & \text{if $\omega \in A$} \\
        0 & \text{if $\omega \not \in A$}
    \end{cases} \]
    (``\emph{Indicator function of $A$}'')
    $\mathbbm{1}_A$ is a discrete random variable
    with $\mathrm{Im} = \{0, 1\}$. \\
    Probability mass function:
    \[ \PP_{\mathbbm{1}_A}(1) = \PP(\mathbbm{1}_A
    = 1) = \PP(A) \]
    \[ \PP_{\mathbbm{1}_A}(0) = \PP(\mathbbm{1}_A
    = 0) = 1 - \PP(A) \]
    \[ \PP_{\mathbbm{1}_A}(x) = 0 \,\,\forall x
    \not\in \{0, 1\} .\]
    This encodes ``did $A$ happen?'' as a real
    number.
\end{example*}

\begin{remark*}
    Given a probability mass function $p_X$, we
    can always construct a probability space
    $(\Omega, \mathcal{F}, \PP)$ and a random
    variable defined on it with this probability
    mass function.
    \begin{itemize}
        \item $\Omega = \mathrm{Im}(X)$ i.e. $\{x
            \in \RR : p_X(x) > 0\}$.
        \item $\mathcal{F} = \mathcal{P}(\Omega)$
        \item $\PP(\{x\}) = p_X(x)$ and extend to
            all $A \in \mathcal{F}$.
    \end{itemize}
\end{remark*}
