Thursday, July 27, 2023

A categorical setting for elementary probability theory

(Early draft; I will be expanding this in the future.)

The basic idea is this:
Given a finite set $X$ and a subset $A\subseteq X$, 
we may regard the ratio of the size of $A$ to the size of $X$ 
as being the <I>probability</I> 
that a randomly chosen element of $X$ will be in $A$.

Thus given $A$ and its superset $X$, 
we have not only 
the inclusion relation between $A$ and $X$, which we may regard as being an arrow in the usual category $\Set$ of sets and functions, 
but also 
the positive rational number $\boxed{ |A| \over |X| }$, a number often called by probabilists <I>the probability of $A$</I> 
(when $X$ is assumed known).
Now, the positive rational numbers in fact form the objects of a discrete closed monoidal category (under multiplication) (details below).
Thus the above allows us to view the collection of sets as being the objects of an enriched category, enriched in the discrete closed monoidal category of positive rational numbers.

<hr />

That covers the notion of absolute probability. 
Let us now consider the notion of relative or conditional probability.

Suppose $X$ contains two sets, $A$ and $B$.
We may ask:
If $A$ is true, what is the probability that $B$ is true, 
and visa versa.
We may also ask:
What is the relation between those two probabilities (the equation that gives that is called "Bayes Theorem").

Let us depict this situation with a diagram;

\[ \boxed{ \begin{array} {} & A\cap B & \xrightarrow{ \textstyle{ A\cap B \over B } } & B & \\ & \llap{ A\cap B \over A } \Bigg\downarrow & \llap{ \scriptstyle \text{Bayes} } \nearrow \rlap{ {A \over B} } & \Bigg\downarrow \rlap{ {B \over X} } & \\ & A & \xrightarrow[ \textstyle{ A \over X } ]{} & X \\ \end{array} } \]

In the diagram,
at the vertices, the symbols $X, A, B, A\cap B$ denote <I>sets</I>;
when labelling arrows, they denote <I>positive integers</I>, viz the number of elements in the set, often denoted e.g. $|A|$.
Thus the ratios shown are ratios of positive integers, thus rational numbers.

Thus in the diagram
the bottom and right arrows give the absolute probabilities of $A$ and $B$ respectively,
The left arrow gives the relative or conditional probability of $B$ relative to $A$;
the top arrow gives that of $A$ relative to $B$. 
The commutativity of each triangle follows from elementary algebra. 
The commutativity of the upper left triangle, when interpreted in terms of probabilities, is Bayes Theorem:
\[ P(A|B) = P(B|A){P(A) \over P(B)} \]

Another example: 
A bipartite partition $A,B$ of $X$ together with a. third sunset $W$.
Note that we have changed notation so that $A,B$ form the two parts of the bipartite partition.
We will diagram this situation as:

\[ \boxed{ \begin{array} {} {} \rlap{ \kern-3em {A\cap W \over A} {A\over X} +  {B\cap W \over B} {B\over X} \xlongequal{\text{cancel}} {A\cap W \over X} + {B\cap W \over X} \xlongequal{\text{distribute}} {(A\cup B)\cap W \over X } \xlongequal{A\cup B = X} {W\over X} } \\ \\ \hline \\ \kern5em & A\cap W & \xrightarrow{ \textstyle{A\cap W \over W} } & W & \xleftarrow{ \textstyle{B\cap W \over W} } & B\cap W & \kern5em \\ & \llap{ A\cap W \over A } \Bigg\downarrow && \Bigg\downarrow \rlap{ W \over X } && \Bigg\downarrow \rlap{ B\cap W \over B } & \\ & A & \xrightarrow[ \textstyle{A \over X} ] {} & X & \xleftarrow[ \textstyle{B \over X} ] {} & B & \\ \end{array} } \]

In several of the examples in the chapter on conditional (or relative) probability in <I<Fat Chance</I>, 
we are given:
0. The numerical value for the bottom two arrows and the two side arrows.
From those values we may compute (setting $|X| = 1$):
1. The numerical values of the upper two corners $A\cap W, B\cap W$.
2. Using the fact that those last two form a partition of $W$ (the pullback of a partition is a partition), we add those last two values to get $|W|$.
3. Now that this is known, we may compute any and all of the three remaining conditional probabilities given by the three remaining arrows.

Such diagrams are useful in displaying numerical information associated with probability situations.
For example, consider the "Monty Hall" situation described in Section 9.1 of <I>Fat Chance</I>.
(And whose precise assumptions are emphasized here:
https://en.wikipedia.org/wiki/Monty_Hall_problem#Standard_assumptions )
The various expressions mentioned in the book are shown in this diagram:
\[ \boxed{ \begin{array} {} \kern8em & A\land W & \xrightarrow{  } & W & \xleftarrow{ } & B\land W & \kern9em \\ & \llap{ P(W|A) = {k-1 \over n-2} } \Bigg\downarrow &&  && \Bigg\downarrow \rlap{ P(W|B) = {k \over n-2} } & \\ & \llap{ \text{your guess is right} = {} } A & \xrightarrow[ \textstyle{ P(A) = {k \over n} } ] {} & X & \xleftarrow[ \textstyle{ P(B) = {n-k \over n} } ] {} & B \rlap{ {} = \text{ your guess is wrong} } & \\ &&& {} \rlap{\kern-10em X = \text{set of doors;} \; |X| = n = \text{number of doors;} \; k = \text{number of cars} } \\ \end{array} } \]
To get the original, basic, Monty Hall situation, take $n=3$, $k=1$.

No comments:

Post a Comment