1Probability, Random Variables, and Disease Occurrence
One sees, from this essay, that probability theory is basically common sense reduced to calculation; it makes us appreciate with exactitude that which fair minds sense with a sort of instinct, often without being able to account for it. (Laplace 1820)1
To begin at the beginning, we will start with probability. Morabia (2004) accurately observed that “Epidemiology came late in human history because it had to wait for the emergence of probability.” This is probably the most difficult chapter of the book, but it will make all subsequent chapters easier. You can use it as a reference and come back to the difficult parts when you need them. Learning to think clearly about probability will give you a compass to find your way through difficult terrain in epidemiology.
1.1 Sets, experiments, and events
To speak clearly about probabilities, we need some basic notation for sets. If \(A\) is a set that contains an element\(a\), we write \[a \in A.\] If \(A\) and \(B\) are sets such that every element of \(A\) is also an element of \(B\), we write \[A \subseteq B.\] to indicate that \(A\) is a subset of \(B\). Sets \(A\) and \(B\) are equal if and only if \(A \subseteq B\) and \(B \subseteq A\), which means they contain exactly the same elements. The empty set with no elements is denoted \(\varnothing\). For any set \(A\), it is true that \(A \subseteq A\) and \(\varnothing \subseteq A\).
We use \(\mathbb{R}\) to denote the real numbers. Intervals are subsets of \(\mathbb{R}\) that take one of the following forms: \[\begin{aligned}
(a, b) &= \{x \in \mathbb{R}: a < x < b\}, \\
(a, b] &= \{x \in \mathbb{R}: a < x \leq b\}, \\
[a, b) &= \{x \in \mathbb{R}: a \leq x < b\}, \\
[a, b] &= \{x \in \mathbb{R}: a \leq x \leq b\}. \\
\end{aligned}\] An endpoint with a square bracket is included in the interval; an endpoint with a round bracket is not. We can have \(a = -\infty\) or \(b = \infty\) as long as we use a round bracket for the corresponding endpoint. For example, it is true that \(\mathbb{R} = (-\infty, \infty)\). However, \(\mathbb{R} \neq [-\infty, \infty]\) because \(\pm \infty\) are not real numbers.
1.1.1 Experiments and events
In probability, an experiment is any process that will produce one outcome out of a set possible outcomes. The set of possible outcomes is called the sample space and is traditionally denoted \(\Omega\). An experiment produces a single outcome \(\omega \in \Omega\). For example, the sample space for a single coin flip is \[\Omega = \{H, T\},\] where \(\omega = H\) if we get heads and \(\omega = T\) if we get tails.
The outcomes in the sample space must determine everything about the random outcome of the experiment. If we flip a coin twice, the sample space cannot be \(\{H, T\}\) because each \(\omega \in \Omega\) must specify the outcome of both coin flips. Instead, \[\Omega = \{HH, HT, TH, TT\}\] where \(\omega = XY\) if we get \(X\) on the first flip and \(Y\) on the second. This helps us see, for example, that there are two ways to get one \(H\) and one \(T\) in two coin flips.
The purpose of probability is to summarize uncertainty about the outcomes of experiments. However, the outcomes themselves do not have probabilities. Probabilities are assigned to events, which are subsets of the sample space \(\Omega\). If \(A\) is an event, then \(A\) occurs if and only if the outcome \(\omega\) produced by our experiment is an element of \(A\) (i.e., if and only if \(\omega \in A\)). If we flip a coin twice, the event that we get two heads is \(\{HH\}\), the event that we get one head is \(\{HT, TH\}\), and the event that we get zero heads is \(\{TT\}\). By definition, the event \(\Omega\) always occurs and the event \(\varnothing\) never occurs.
In experiments with a finite or countably infinite sample space,2 the distinction between the outcome \(\omega\) and the event \(\{\omega\}\) can be safely ignored. In more complex experiments (e.g., taking a random sample from a standard normal distribution), this distinction is important.3 In all cases, experiments have outcomes and events have probabilities.
In epidemiology, it is often useful to think of the sample space \(\Omega\) as being a population and each \(\omega \in \Omega\) as an individual in this population. In this context, our experiment is to sample a person from \(\Omega\) and ask them questions, take measurements, or follow them over time to ascertain disease occurrence. Events would be subpopulations of \(\Omega\), such as \(\{\omega \in \Omega: \omega \text{ lives in Ohio}\}\). This event occurs if the sampled individual \(\omega\) lives in Ohio, and it does not occur if they live somewhere else.
1.1.2 Set operations and logic
There are three basic set operations that take one or more sets and define another set: complement, intersection, and union. Each operation has a simple interpretation in terms of logic.
The complement of a set \(A\) is \[A^\comp = \{\omega \in \Omega : \omega \not\in A\},\] which can be interpreted logically as not \(A\). If \(A\) is an event, then the event \(A^\comp\) occurs if \(\omega \not\in A\). For the same reason that “not not A” means “A”, we have \((A^\comp)^\comp = A\).
The intersection of two sets \(A\) and \(B\) is \[A \cap B = \{\omega \in \Omega : \omega \in A \text{ and } \omega \in B\},\] which can be interpreted logically as \(A\) and \(B\). If \(A\) and \(B\) are events, then the event \(A \cap B\) occurs if \(\omega \in A\) and \(\omega \in B\).
The union of two sets \(A\) and \(B\) is \[A \cup B = \{\omega \in \Omega : \omega \in A \text{ or } \omega \in B\},\] which can be interpreted logically as \(A\) or \(B\) as long as we use an inclusive “or” (i.e., and/or). If \(A\) and \(B\) are events, then the event \(A \cup B\) occurs if \(\omega \in A\) or \(\omega \in B\).
If \(A \subseteq B\), then \(A \cap B = A\) and \(A \cup B = B\). An important special case is that \[
A \cap A = A \cup A = A.
\tag{1.1}\] For the empty set \(\varnothing\), we get \(A \cap \varnothing = \varnothing\) and \(A \cup \varnothing = A\). For the sample space \(\Omega\), we get \(A \cap \Omega = A\) and \(A \cup \Omega = \Omega\).
Union and intersection are commutative operations like addition and multiplication, so the order of \(A\) and \(B\) does not matter: \[
A \cup B = B \cup A
\] and \[
A \cap B = B \cap A.
\] Events \(A\) and \(B\) are disjoint or mutually exclusive when \(A \cap B = \varnothing\). If \(A\) and \(B\) are disjoint, then at most of one of them can occur in a single experiment. Any set and its complement are disjoint, and the empty set \(\varnothing\) is disjoint with itself and all other sets.
If \(\Omega\) is a population, these set operations allow us to define subpopulations in terms of multiple traits. If the event \(A = \{\omega \in \Omega: \omega \text{ lives in Ohio}\}\), then its complement \(A^\comp\) contains all individuals in \(\Omega\) who live outside Ohio. If the event \(B = \{\omega \in \Omega: \omega \text{ is 42 years old}\}\), then the intersection \(A \cap B\) contains everyone in \(\Omega\) who is 42 years old and lives in Ohio. If \(\Omega\) does not contain any 42-year-old Ohio residents, then \(A\) and \(B\) are disjoint. The union \(A \cup B\) contains everyone in \(\Omega\) who lives in Ohio or is 42 years old. This could include both a 24-year-old who lives Ohio and a 42-year-old who lives Michigan.
1.1.3 Venn diagrams
A useful tool for understanding events and set operations is the Venn diagram.4 An example is shown in Figure 1.1. The rectangle represents \(\Omega\), and the circles \(A\) and \(B\) represent events. \(A^\comp\) is everything in \(\Omega\) outside the circle \(A\), and \(B^\comp\) is everything outside the circle \(B\). Their intersection \(A \cap B\) is the area where the two circles overlap. Their union \(A \cup B\) is everything contained in at least one of \(A\) or \(B\).
Figure 1.1: Venn diagram showing events \(A\) and \(B\). The area contained in both events is their intersection \(A \cap B\). The union \(A \cup B\) is all area contained in at least one of \(A\) and \(B\), including \(A \cap B\).
1.1.4 Sequences of events*
Intersections can be written for more than two events. The intersection of \(A_1, A_2, \ldots, A_n\) is \[
I_n = \bigcap_{i = 1}^n A_i.
\tag{1.2}\] Because set intersection is commutative and associative, any ordering of \(A_1, \ldots, A_n\) produces the same intersection. The event \(I_n\) occurs if and only if all of the events \(A_1, \ldots, A_n\) occur. Each new event makes the intersection smaller (i.e., never larger) in the sense that \[
\bigcap_{i = 1}^{n + 1} A_i \subseteq I_n.
\] whenever \(A_{n + 1}\) is another event.
Similarly, unions can be written for more than two events. If \(A_1, A_2, \ldots, A_n\) is a set of events, then their union is \[
U_n = \bigcup_{i = 1}^n A_i.
\tag{1.3}\] Because set union is commutative and associative, any ordering of \(A_1, \ldots, A_n\) produces the same union. The event \(U_n\) occurs if and only if at least one of the events \(A_i\) occurs. Each new event makes the union bigger (i.e., never smaller) in the sense that \[
U_n \subseteq \bigcup_{i = 1}^{n + 1} A_i
\] whenever \(A_{n + 1}\) is another event.
Both unions and intersections can be defined for infinite sequences of events.5 To describe this, we let \(n = \infty\) in the notation from Equation 1.2 or Equation 1.3. The union of any finite sequence of events can be turned into the union of an infinite sequence of events by adding an endless sequence of empty sets to the finite sequence. The new sequence is still a sequence of disjoint events, and each empty set \(\varnothing\) leaves the union unchanged. If \((A_1, A_2, \ldots)\) is an infinite sequence of events such that \(A_i = \varnothing\) for all \(i > n\), then \[
\bigcup_{i = 1}^\infty A_i = \bigcup_{i = 1}^n A_i.
\] This turns out to be useful when we try to give a mathematically rigorous definition of probability.
1.1.5 Algebra of sets\(^*\)
Unions, intersections, and complements can be combined in complex ways. Fortunately, there are a few basic principles that can be used to simplify these calculations. We have already seen that unions and intersections are commutative. Unions and intersections are also associative, so \[
A \cup (B \cup C)
= (A \cup B) \cup C
\] and \[
A \cap (B \cap C)
= (A \cap B) \cap C
\] for any sets \(A\), \(B\), and \(C\).
De Morgan’s laws describe how complements affect unions and intersections. If \(A\) and \(B\) are sets, then \[
(A \cap B)^\comp
= A^\comp \cup B^\comp
\tag{1.4}\] because you are outside \(A \cap B\) if and only f you are outside \(A\) or outside \(B\). Similarly, \[
(A \cup B)^\comp
= A^\comp \cap B^\comp.
\tag{1.5}\] because you are outside \(A \cup B\) if and only if you are outside \(A\) and outside \(B\). Note that each of these equations implies the other if we replace \(A = (A^\comp)^\comp\) with \(A^\comp\) and replace \(B = (B^\comp)^\comp\) with \(B^\comp\). They are two sides of the same coin, but it is helpful to remember them both.
The distributive properties describe how unions and intersections interact with each other. Recall that multiplication distributes over addition, so \(a (b + c) = ab + ac\). For any sets \(A\), \(B\), and \(C\), we have the following distributive properties:
Intersections distribute over unions, so \[
A \cap (B \cup C)
= (A \cap B) \cup (A \cap C).
\]
Unions distribute over intersections, so \[
A \cup (B \cap C)
= (A \cup B) \cap (A \cup C).
\]
Intersections and unions also distribute over themselves. However, this is a consequence of commutativity, associativity, and Equation 1.1, not a separate property like the distributive rules above.
1.2 Probability
A probability measure is a function that takes an event \(A \subseteq \Omega\) and returns a number \(\Pr(A) \in [0, 1]\) in any way that conforms to the following rules:
\(\Pr(\Omega) = 1\).
\(\Pr(A) \in [0, 1]\) for any event \(A \subseteq \Omega\).6
The addition rule: If \((A_1, A_2, \ldots)\) is any sequence of disjoint events, then \[
\Pr\Biggl( \bigcup_{i = 1}^\infty A_i\Biggr)
= \sum_{i = 1}^\infty \Pr(A_i).
\] The addition rule is stated in terms of an infinite sequence of disjoint events because this implies the addition rule for any finite sequence of disjoint events (see Section 1.1.4).
It is useful to think of probability as a generalization of our intuitions about area or volume. When there is no overlap in a set of two-dimensional shapes, we can get the total area they cover by adding up the areas of the individual shapes. Similarly, we can get the total volume taken up by a set of bowling balls by adding up their individual volumes.
There is a lot of debate about the meaning of probability, but its definition does not assume any particular interpretation. Probability calculations are based on the rules above no matter what we think it all means, and any interpretation consistent with these rules is valid.
1.2.1 Probability calculations
Several useful properties of probability follow immediately from the definition above. A short proof follows each result. To follow the proofs, it helps to draw Venn diagrams.
Theorem 1.1 If \(A\) is an event, \(\Pr\bigl(A^\comp\bigr) = 1 - \Pr(A)\).
Proof. Because \(\Omega = A \cup A^\comp\) and \(A\) and \(A^\comp\) are disjoint, we have \[
\Pr(A) + \Pr\bigl(A^\comp\bigr) = \Pr(\Omega) = 1
\] by the addition rule. The result follows when we subtract \(\Pr(A)\) from both sides.
Theorem 1.2 If \(A\) and \(B\) are events such that \(A \subseteq B\), then \(\Pr(A) = \Pr(B) - \Pr\bigl(B \cap A^\comp\bigr)\). This implies that \(\Pr(A) \leq \Pr(B)\).
Proof. Each element of \(B\) either is or is not in \(A\), so \[
B = (B \cap A) \cup \big(B \cap A^\comp\big)
= A \cup \big(B \cap A^\comp\big).
\] where the second equality follows from the fact that \(B \cap A = A\) because \(A \subseteq B\). The two sets on the right-hand side are disjoint, so we have \[
\Pr(B) = \Pr(A) + \Pr\bigl(B \cap A^\comp\bigr)
\] by the addition rule. The result follows if we subtract \(\Pr\bigl(B \cap A^\comp\bigr)\) from both sides. This implies that \(\Pr(A) \leq \Pr(B)\) because \(\Pr\bigl(B \cap A^\comp\bigr) \geq 0\).
Theorem 1.3 If \(A\) and \(B\) are events, \(\Pr(A \cup B) = \Pr(A) + \Pr(B) - \Pr(A \cap B)\).
Proof. We can break \(A \cup B\) into three disjoint sets: elements of \(A\) and not \(B\), elements of \(B\) and not \(A\), and elements of both \(A\) and \(B\). In set notation, this is \[
A \cup B = \big(A \cap B^\comp\big) \cup \big(B \cap A^\comp\big) \cup (A \cap B).
\] By the addition rule, \[
\Pr(A \cup B) = \Pr\bigl(A \cap B^\comp\bigr) + \Pr\bigl(B \cap A^\comp\bigr) + \Pr(A \cap B).
\tag{1.6}\] By Theorem 1.2, we have \[
\Pr\bigl(A \cap B^\comp\bigr)
= \Pr(A) - \Pr(A \cap B), \\
\] because \(A \cap B \subseteq A\) and \[
\Pr\bigl(B \cap A^\comp\bigr)
= \Pr(B) - \Pr(A \cap B).
\] because \(A \cap B \subseteq B\). The result follows from substituting these back into Equation 1.6 and collecting terms involving \(\Pr(A \cap B)\). Intuitively, \(\Pr(A) + \Pr(B)\) includes the overlap \(\Pr(A \cap B)\) twice, so we have to subtract out one of them. This can be see clearly in Figure 1.1.
1.3 Random variables
The outcomes of an experiment can be anything, not just numbers. A random variable is a real-valued function defined on a sample space \(\Omega\). In other words, a random variable \(X\) is a function that takes an argument\(\omega \in \Omega\) as input and returns a value\(X(\omega) \in \mathbb{R}\). Traditionally, random variables are written as capital letters and possible values are written as lower-case letters, so \(\Pr(X = x)\) denotes the probability of the event \[
\{\omega \in \Omega : X(\omega) = x\}.
\] For simplicity, random variables are usually written without the argument \(\omega\).
The distinction between outcomes and random variables is useful because we can define multiple random variables on the same sample space. For example, the height, weight, and age of an individual \(\omega\) sampled from a population \(\Omega\) are different random variables defined on the same sample space.
1.3.1 Indicator variables
The simplest random variables are indicator variables. For an event \(A\), the indicator variable \[
\indicator_A(\omega)
= \begin{cases}
1 & \text{ if } \omega \in A, \\
0 & \text{ if } \omega \not\in A.
\end{cases}
\] Indicator variables are binary random variables, which take exactly two values. In practice, these values should be zero and one unless there is a specific reason to do otherwise. When sampling from a population, we can define indicator variables for membership in different subpopulations.
All of the basic set operations above can be expressed in terms of indicator variables for sets.
The indicator function for the complement of \(A\) is \[
\indicator_{A^\comp} = 1 - \indicator_A.
\tag{1.7}\]
If \(B\) is another event and \(\indicator_B\) is its indicator variable, then the indicator variable for the intersection \(A\) and \(B\) is the product of their indicator variables: \[
\indicator_{A \cap B}
= \indicator_A \indicator_B.
\tag{1.8}\]
The indicator variable for the union \(A \cup B\) is \[
\indicator_{A \cup B}
= 1 - (1 - \indicator_A) (1 - \indicator_B)
= \indicator_A + \indicator_B - \indicator_{A \cap B}.
\tag{1.9}\] This follows from Equation 1.5 because \(A \cup B = (A^\comp \cap B^\comp)^\comp\).
## Indicator variables for events A and B, etc.# Setting the seed ensures that everyone gets the same random samples.# Functions are called using parentheses (round brackets).# The function rbinom() is a random sample from a binomial distribution.set.seed(42)n <-100dat <-data.frame(A =rbinom(n, 1, 0.3))dat$B <-rbinom(n, 1, 0.6)# inspecting a data framenames(dat) # variables in the data framenrow(dat) # number of rows (individuals)ncol(dat) # number of columns (variables)dim(dat) # rows and columns in the data framestr(dat) # summary of the data frame structure (variables and types)# inspecting columns of a data frame (or vectors)# Our sample space or population consists of 100 individuals.# Square brackets are used for indices, which can be numbers or TRUE/FALSE.dat$A # indicator for A for all 100 individualsdat$A[10] # indicator for A in individual 10dat$A[2:6] # indicator variables for individuals 2 to 6dat$A[c(10, 20, 30)] # A indicators for individuals 10, 20, and 30which(dat$A ==1) # which individuals are in event Awhich(dat$A ==0) # which individuals are not in event A# indicator variable for A complement# In R (and many other languages), "!" means "not".# The function as.integer() changes TRUE/FALSE to 1/0.dat$Acomp <-as.integer(!dat$A)# indicator variable for A intersection B# In R (and many other languages), "&" means "and".dat$ABintersect <-as.integer(dat$A & dat$B)# indicator variable for A union B# In R (and many other languages), "|" means "or".dat$ABunion <-as.integer(dat$A | dat$B)# save the data frame as a CSV file# The file argument can be a path (e.g., "./data/indicators.csv" in Linux).write.csv(dat, file ="indicators.csv", row.names =FALSE)
1.3.2 Probability distributions
The set of possible values of a random variable \(X\) is called the support of \(X\) and denoted \(\supp(X)\).7 For example, the support of an indicator variable is \(\{0, 1\}\). In this section, we will focus on discrete random variables, which have a support on a finite or countably infinite set. There are two standard ways to describe the distribution of a discrete random variable:
The probability mass function (PMF) of a discrete random variable \(X\) is \[
f(x) =
\begin{cases}
\Pr(X = x) > 0 & \text{ if } x \in \supp(X), \\
0 & \text{ if } x \not \in \supp(X).
\end{cases}
\] Because \(\Pr(\Omega) = 1\), we always have \[
\sum_{x \in \supp(X)} f(x) = 1.
\]
The cumulative distribution function (CDF) of \(X\) is \[
F(x)
= \Pr(X \leq x).
\]\(F(x)\) is monotonically increasing in \(x\), which means that \(F(a) \leq F(b)\) whenever \(a < b\). It has a jump upward of size \(f(x)\) at each \(x \in \supp(X)\), and its value at each such \(x\) is the value that it jumps to—not the value that it jumps up from. For sufficiently small \(x\), \(F(x)\) can be made arbitrarily close to zero. For sufficiently large \(x\), \(F(x)\) can be made arbitrarily close to one. More formally, we say that \(\lim_{x \downarrow -\infty} F(x) = 0\) and \(\lim_{x \uparrow \infty} F(x) = 1\).
The PMF and CDF provide equivalent descriptions of the distribution of \(X\) in the sense that either of these functions can be used to calculate the other. Given the PMF \(f\), the CDF is defined by \[
F(x) = \sum_{\substack{v \in \supp(X): \\ v \leq x}} f(v).
\] where the sum is taken over all \(u \in \supp(X)\) such that \(u \leq x\). Given the CDF \(F\), the PMF is defined by \[
f(x) = F(x) - \max_{v \leq x} F(v)
\] where the maximum is \(F(v)\) for the largest \(v \in \supp(X)\) such that \(v < x\).
1.3.3 Mean
The mean or expected value of a random variable \(X\) is \[
\E(X)
= \sum_{x \in \supp(X)} x \Pr(X = x)
= \sum_{x \in \supp(X)} x f(x),
\] where \(f\) is the PMF of \(X\). The mean is often written \(\mu\), and it is often described as a measure of the “location” or “central tendency” of \(X\).
Indicators are an extremely useful for calculating probabilities using means. For any event \(A\), its probability is the mean of the indicator variable \(\indicator_A\): \[
\Pr(A)
= 0 \Pr(\indicator_A = 0) + 1 \Pr(\indicator_A = 1)
= \E(\indicator_A).
\] This is a common way to calculate probabilities in data analyses.
## Indicator variables and probability calculations# read in CSV file with indicator variables using the function read.csv()# The argument can be a path (e.g., "./data/indicators.csv" in Linux).dat <-read.csv("indicators.csv")# calculate probabilities from indicator variables using the function mean()# This will also work with TRUE/FALSE (i.e., logical) variables, which are# converted to TRUE = 1 and FALSE = 0 in calculations.prob_A <-mean(dat$A)prob_B <-mean(dat$B)prob_Acomp <-mean(dat$Acomp)prob_ABintersect <-mean(dat$ABintersect)prob_ABunion <-mean(dat$ABunion)# Pr(A complement) = 1 - Pr(A)prob_Acomp1- prob_A# Pr(A union B) = Pr(A) + Pr(B) - Pr(A intersect B)prob_ABunionprob_A + prob_B - prob_ABintersect# Beware of numerical error when comparing floating-point numbers!# This example is from The R Inferno by Patrick Burns.# https://www.burns-stat.com/pages/Tutor/R_inferno.pdf0.1==0.3/3sprintf("%.20f", 0.1)sprintf("%.20f", 0.3/3)# math can be more accurate than computers (which is not their fault)prob_ABunion == prob_A + prob_B - probABintersectsprintf("%.20f", prob_ABunion)sprintf("%.20f", prob_A + prob_B - prob_ABintersect)
1.3.4 Variance
If \(X\) has \(\E(X) = \mu\), then \((X - \mu)^2\) is another random variable. The variance of \(X\) is the expected value of \((X - \mu)^2\): \[
\Var(X)
= \E\big[(X - \mu)^2\big]
= \sum_{x \in \supp(X)} (x - \mu)^2 f(x).
\] {eq-Var} Because \((x - \mu)^2 \geq 0\) with equality if and only if \(x = \mu\), we always have \(\Var(X) \geq 0\). We have \(\Var(X) = 0\) if and only if \(X = \mu\) with probability one. An equivalent expression for the variance that is often easier to use is: \[
\Var(X) = \E(X^2) - \mu^2
\tag{1.10}\] where \(\E(X^2)\) is the expected value of the random variable \(X^2\). The variance is often written \(\sigma^2\), and it is often described as a measure of the dispersion of \(X\) around the mean.
The square root of the variance is called the standard devation, which is often written \(\sigma\). If a random variable \(X\) has units (e.g., length, weight, or time), the mean and the standard deviation have the same units as \(X\). For example, the mean and standard deviation of a length in meters both have units of \(\text{meters}\) but the variance has units of \(\text{meters}^2\).
1.3.5 Bernoulli distribution
The distribution of an indicator variable is called the Bernoulli distribution.8 A random variable with the Bernoulli(\(p\)) distribution has the PMF \[
f(x)
= p^x (1 - p)^{1 - x}
= \begin{cases}
1 - p &\text{if } x = 0\\
p &\text{if } x = 1.
\end{cases}
\] Equivalently, it has the CDF \[
F(x)
= \begin{cases}
0 &\text{if } x < 0 \\
1 - p &\text{if } x \in [0, 1) \\
1 &\text{if } x \geq 1.
\end{cases}
\] If a random variable \(X\) has a Bernoulli(\(p\)) distribution, we write \(X \sim \text{Bernoulli}(p)\). The indicator variable for an event \(A\) has a Bernoulli distribution with \(p = \Pr(A)\).
If \(X \sim \Bernoulli(p)\), then it has mean \[
\E(X)
= 0 \times (1 - p) + 1 \times p \\
= p
\] and variance \[
\Var(X)
= (0 - p)^2(1 - p) + (1 - p)^2 p \\
= p (1 - p).
\] Its standard deviation is \(\sqrt{p (1 - p)}\), which is greater than zero unless \(p = 0\) or \(p = 1\). If \(p = 0\), then \(X = 0\) with probability one. If \(p = 1\), then \(X = 1\) with probability one.
1.4 Joint and marginal distributions
If \(X\) and \(Y\) are random variables defined on the same probability space, then their joint probability mass function is \[
f(x, y)
= \Pr(X = x \text{ and } Y = y)
= \Pr\big(\{\omega: X(\omega) = x \text{ and } Y(\omega) = y\}\big).
\] The marginal probability mass functions are the PMFs of \(X\) or \(Y\) individually, which can be calculated from the joint PMF. The marginal PMF of \(X\) is \[
f_X(x) = \sum_{y \in \supp(Y)} f(x, y),
\] and the marginal PMF of \(Y\) is \[
f_Y(y) = \sum_{x \in \supp(X)} f(x, y).
\] These are called marginal distributions by analogy to the margins of a table. The distinction between joint and marginal distributions is extremely important in epidemiology and other applications of probability.
For example, Table 1.1 shows the joint and marginal PMFs for two binary random variables \(X\) and \(Y\). By definition, \[
f(0, 0) + f(0, 1) + f(1, 0) + f(1, 1) = 1.
\] In the table, it is clear that the joint distribution determines the marginal distributions. However, there are many different joint distributions that are consistent with the same marginal distributions. Thus, the marginal distributions do not determine the joint distribution.9
Table 1.1: Joint and marginal PMFs for binary random variables \(X\) and \(Y\).
## Joint and marginal distributions of indicators for events A and B# read indicator variable data from the CSV filedat <-read.csv("indicators.csv")n <-nrow(dat)# tables of counts# Putting "<name> = " before the vector creates a label.table(A = dat$A)table(B = dat$B)# joint table of counts# In table(), the first argument defines rows and the second defines columns.# The addmargins() functions adds the row, column, and overall sums.table(A = dat$A, B = dat$B)addmargins(table(A = dat$A, B = dat$B))# tables of probabilities# Table margins match the distributions of A (rows) and B (columns).table(Adist = dat$A) / n # marginal distribution of A indicatortable(Bdist = dat$B) / n # marginal distribution of B indicatoraddmargins(table(A = dat$A, B = dat$B)) / n # joint distribution
Joint distributions can be defined for more than two random variables. If \(X_1, X_2, \ldots, X_n\) are random variables defined on the same sample space, then their joint PMF is \[
f(x_1, x_2, \ldots, x_n) = \Pr(X_1 = x_1, X_2 = x_2, \ldots, X_n = x_n).
\] The marginal distribution of each \(X_i\) can be found by adding up the PMF over the support of all the other random variables. For example, \[
f_{X_2}(x_2) = \sum_{x_1 \in \supp(X_1)} \sum_{x_3 \in \supp(X_3)} f(x_1, x_2, x_3).
\] when \(n = 3\). In this same case, we can talk about the joint distribution of any two variables marginalized over the third. For example, \[
f_{X_2, X_3}(x_2, x_3) = \sum_{x_1 \in \supp(X_1)} f(x_1, x_2, x_3).
\] For larger \(n\), the formulas gets uglier but the ideas are the same.
1.4.1 Linear combinations*
If \(a\) and \(b\) are constants, then \(a X + b Y\) is another random variable on \(\Omega\). It is called a linear combination of \(X\) and \(Y\). Linear combinations can be defined for more than two random variables. If \(X_1, \ldots, X_n\) are random variables defined on a sample space and \(a_1, \ldots, a_n\) are constants, then \[
\sum_{i = 1}^n a_i X_i = a_1 X_1 + a_2 X_2 + \cdots + a_n X_n
\] is a linear combination of \(X_1, \ldots, X_n\). The constants can be any real numbers, including one and zero.
Section 1.3.1 contains both examples and non-examples of linear combinations of random variables.
The indicator function for \(A^\comp\) in Equation 1.7 is a linear combination of \(\indicator_A\) and the random variable \(\indicator_\Omega\), which equals one for all \(\omega \in \Omega\).
The indicator function for \(A \cup B\) in Equation 1.9 is linear combination of the indicator variables \(\indicator_A\), \(\indicator_B\), and \(\indicator_{A \cap B}\).
The indicator function for \(A \cap B\) in Equation 1.8 is not a linear combination of \(\indicator_A\) and \(\indicator_B\) because we have to multiply these two variables.
If \(X\) and \(Y\) are random variables defined on the same sample space and \(a\) and \(b\) are constants, the mean of the linear combination \(a X + b Y\) is \[
\E(a X + b Y) = a \E(X) + b \E(Y).
\tag{1.11}\] This is a direct consequence of the definition of expected value: \[
\begin{aligned}
\E(a X + b Y)
&= \sum_{x \in \supp(X)} \sum_{y \in \supp(Y)} (a x + b y) f(x, y) \\
&= a \sum_{x \in \supp(X)} \bigg(x \sum_{y \in \supp(Y)} f(x, y)\bigg)
+ b \sum_{y \in \supp(Y)} \bigg(y \sum_{x \in \supp(X)} f(x, y)\bigg) \\
&= a \sum_{x \in \supp(X)} x f_X(x) + b \sum_{y \in \supp(Y)} y f_Y(y).
\end{aligned}
\] The algebra is not pretty, but the logic is straightforward. We split up the sum into parts depending only on \(x\) and only on \(y\) outside the joint PMF. In each part, we factor out a constant and find the marginal PMF. This same logic extends to a linear combination of any number of random variables.
1.4.2 Variance and covariance*
The variance of \(a X + b Y\) is \[
\Var(a X + b Y) = a^2 \Var(X) + b^2 \Var(Y) + 2 a b \Cov(X, Y)
\tag{1.12}\] where \[
\Cov(X, Y) = \E\bigl[\big(X - \E(X)\big) \big(Y - \E(Y)\big)\bigr]
\] is called the covariance of \(X\) and \(Y\). Note that \(\Cov(X, Y) = \Cov(Y, X)\). Because \(\Var(X) = \Cov(X, X)\), variance is a special case of covariance. When \(X\) and \(Y\) are independent in the sense that the value of one tells us nothing about the value of the other, then \(\Cov(X, Y) = 0\) and \(\Var(a X + b Y) = a^2 \Var(X) + b^2 Var(Y)\).10
The joint distribution of \(X\) and \(Y\) has a covariance matrix which is \[
\begin{bmatrix}
\Var(X) & \Cov(X, Y) \\
\Cov(X, Y) & \Var(Y)
\end{bmatrix}
\] The variances are along the diagonal of the matrix, and the covariances appear off the diagonal. Because \(\Cov(X, Y) = \Cov(Y, X)\), covariance matrices are always symmetric (i.e., symmetric across the diagonal). Covariance matrices are an extremely useful tool for calculating the variances of linear combinations of random variables. For example: \[
\Var(a X + b Y)
= \begin{pmatrix}
a & b
\end{pmatrix}
\begin{bmatrix}
\Var(X) & \Cov(X, Y) \\
\Cov(X, Y) & \Var(Y)
\end{bmatrix}
\begin{pmatrix}
a \\ b
\end{pmatrix}
\] in matrix and vector notation from linear algebra. This logic extends to linear combinations of any number of random variables.
The covariance is the numerator of the Pearson correlation coefficient,11 which is \[
\rho_{XY} = \rho_{YX}
= \frac{\Cov(X, Y)}{\sqrt{\Var(X) \Var(Y)}}.
\] Because of the Cauchy-Schwarz inequality, it turns out that \(\rho_{XY} \in [-1, 1]\).
We get \(\rho_{XY} = -1\) if and only if \(Y = c X\) for some negative constant \(c\).
We get \(\rho_{XY} = 1\) if and only if \(Y = c X\) for some positive constant \(c\). For example, \(\rho_{XX} = 1\) for any random variable \(X\).
We get \(\rho_{XY} = 0\) if (but not only if) \(X\) and \(Y\) are independent. However, it is possible to have \(\rho_{XY} = 0\) when \(X\) and \(Y\) are not independent.
If we divide each entry \(\Cov(X, Y)\) in a covariance matrix by \(\sqrt{\Var(X) \Var(Y)}\), when we get a correlation matrix. Any correlation matrix is symmetric, and the entries along its diagonals are all ones.
1.5 Probability and disease occurrence
In epidemiology, there are two fundamental measures of disease occurrence that are probabilities: prevalence and risk. In both cases, our experiment is to sample an individual \(\omega\) from a population \(\Omega\). The disease outcome is a binary random variable \[
D(\omega) =
\begin{cases}
1 & \text{if } \omega \text{ has the disease outcome}, \\
0 & \text{otherwise}.
\end{cases}
\] The set of individuals in \(\Omega\) who have \(D(\omega) = 1\) is an event in \(\Omega\), and our measure of disease occurrence is \[
\Pr(\{\omega \in \Omega: D(\omega) = 1\}).
\] The most important difference between prevalence and risk is the role of time in the definition of \(D\).
There is an important technical detail to remember when we talk about disease onset and recovery. When a person has disease onset at time \(\tonset\) and recovers at time \(\trec\), they have disease for each \(t \in [\tonset, \trec)\). We assume that \(\trec > \tonset\) so this interval is nonempty. We let the onset and recovery times for person \(i\) be \(\tonset_i\) and \(\trec_i\), respectively. If a person has multiple episodes of the disease, each episode has its own \(\tonset\) and \(\trec\). For example, the \(j^\text{th}\) episode in person \(i\) would have onset time \(\tonset_{ij}\) and recovery time \(\trec_{ij}\).
The time scale used to define disease onset is flexible, and this flexibility is useful. The most obvious time scale is calendar time or absolute time. Another common time scale is age, which is an important determinant of the risk of many diseases. In some cases, time since an event is a useful time scale. The event that defines time scale could be a single event (e.g., exposure to contaminated food at a party) or an event that occurs at different times for different individuals (e.g., time since menopause). In general, it is wise to choose the time scale that corresponds to the most important time-varying determinant of disease onset. The chosen time scale is often called the analysis time scale.
1.5.1 Prevalence
For prevalence, the disease outcome is defined by choosing a time \(t\) and letting \[
D(\omega) =
\begin{cases}
1 & \text{if } \omega \text{ has disease at time } t, \\
0 & \text{otherwise}.
\end{cases}
\] In other words, it is the proportion of the population \(\Omega\) that disease at time \(t\). This includes individuals who have disease onset at time \(\tonset = t\) but not individuals who recover from disease at time \(\trec = t\). This is often called the point prevalence at time \(t\).
Another version of prevalence is period prevalence. For period prevalence, we choose a nonempty time interval \((t_a, t_b]\) and define \[
D(\omega) =
\begin{cases}
1 & \text{if } \omega \text{ has disease at any time } t \in (t_a, t_b], \\
0 & \text{otherwise}.
\end{cases}
\] In other words, it is the proportion of the population that has disease at any time in the interval \((t_a, t_b]\). This includes prevalent cases at time \(t_a\) and cases with disease onset in \((t_a, t_b]\). The period prevalence in \((t_a, t_b]\) is the point prevalence at \(t_a\) plus the risk of disease onset in \((t_a, t_b]\), to which we now turn.
## Point and period prevalence# generate onset and recovery data for 100 individuals# Setting the seed ensures that everyone gets the same random numbers,# but it is strictly optional.# The function rexp() randomly samples from an exponential distribution.set.seed(42)cohort <-data.frame(onset =rexp(100, rate =0.4))cohort$duration <-rexp(100, rate =2)cohort$recovery <- cohort$onset + cohort$duration# statistical summaries (mean, quartiles, range)summary(cohort$onset)summary(cohort$duration)summary(cohort$recovery)# highest and lowest recovery times# The function sort() sorts the vector from lowest to highest.# head() returns the first 6 values of a vector; tails() returns the last 6.min(cohort$onset)head(sort(cohort$onset)) # lowest 6 values (first 6 in the sorted vector)tail(sort(cohort$onset)) # highest 6 values (last 6 in the sorted vector)max(cohort$onset)# With a long vector, sorting repeatedly can be slow.# You can also control the number of elements returned by head() or tail().onset_ordered <-sort(cohort$onset)head(onset_ordered, n =10)tail(onset_ordered, n =10)# seeing rows and columns of the data framecohort[1:10, c("onset", "duration", "recovery")]cohort[c(10, 20, 50), c("onset", "recovery")]cohort[which(cohort$recovery <1), c("onset", "recovery")]cohort[, c("onset", "recovery")] # all rowscohort[c(2, 3, 5, 7, 11), ] # all columns# point prevalenceprev <-function(t) {# vector of TRUE/FALSE for prevalent cases at time t prevalent <- cohort$onset <= t & cohort$recovery > tmean(prevalent)}prev(0)prev(1)prev(2)prev(6)# period prevalence# The parentheses around the logical tests are just for readability.pdprev <-function(ta, tb) {# prevalent cases at t_a prevalent_ta <- (cohort$onset <= ta & cohort$recovery > ta)# incident cases in (t_a, t_b] incident_ab <- (cohort$onset > ta & cohort$onset <= tb)# mean indicator for prevalent at t_a or incident in (t_a, t_b]mean(prevalent_ta | incident_ab)}pdprev(0, 1)pdprev(1, 2)pdprev(0, 6)# save the data as a CSV filewrite.csv(cohort, "cohort.csv", row.names =FALSE)
1.5.2 Risk (cumulative incidence) and the survival function
To define risk or cumulative incidence, we first choose an nonempty time interval \((t_a, t_b]\). The disease outcome is defined as \[
D(\omega) =
\begin{cases}
1 & \text{if } \omega \text{ has } \tonset \in (t_a, t_b], \\
0 & \text{otherwise}.
\end{cases}
\] In the population that is disease-free and at risk of disease at time \(t_a\), it is the proportion who have disease onset at \(\tonset \leq t_b\). The risk is sometimes called the incidence proportion.
The risk depends on a specified interval \((t_a, t_b]\). We can always define our time scale so that \(t_a = 0\), so the risk in \((t_a, t_b]\) on the original time scale is the same as the risk in the interval \((0, t_b - t_a]\) on the analysis time scale. On the analysis time scale, the cumulative incidence function\(F(t)\) is the risk of disease in \((0, t]\) for any possible \(t\). The corresponding survival function is \[
S(t)
= 1 - F(t),
\] which is the probability of no disease onset in \((0, t]\). In practice, it is often easier to calculate the survival function than to calculate the cumulative incidence function directly. There is only one way to survive disease-free through the interval \((0, t]\), but you can have disease onset at any time.
## Risk, survival function, and cumulative incidence function# read data from CSV file# Change or remove ".R/" in the path as needed to locate the cohort.csv file.# You can also re-generate the data as in prevalence.R using the same seed.cohort <-read.csv("./R/cohort.csv")# risk (cumpulative incidence)risk <-function(t) {# vector of TRUE/FALSE for incident cases in (0, t] incident <- cohort$onset <= tmean(incident)}risk(0)risk(1)risk(2)risk(6)# cumulative incidence function# Vectorize() takes a function like risk() that takes a single number as input# and creates a function that can take a number or vector as input.cuminc <-Vectorize(risk)cuminc(c(0, 1, 2, 6))# survival function# A simple function can be put on one line.# It takes the same input as cuminc(), so it can take a vectorsurv <-function(t) 1-cuminc(t)surv(c(0, 1, 2, 6))# plot the survival and cumulative incidence functionst <-seq(0, 20, by =0.1)plot(t, surv(t), type ="l",xlab ="Time", ylab ="Probability")lines(t, cuminc(t), lty ="dashed")grid()legend("right", bg ="white", lty =c("dashed", "solid"),legend =c("Cumulative incidence", "Survival"))
The survival function has several important properties:
\(S(0) = 1\) because \((0, 0]\) is an empty interval where no one can have disease onset.
Because \(S(t)\) is a probability, \(S(t) \in [0, 1]\) for all \(t\).
\(S(t)\) monotonically decreases (i.e., never increases) with increasing \(t\). If \(t_a < t_b\), then the time interval \((0, t_a]\) is contained \((0, t_b]\). Everyone who survives disease-free through \((0, t_b]\) must have survived disease-free through \((0, t_a]\), but some people who survived through \((0, t_a]\) might not make it all the way through \((0, t_b]\). Thus, \(S(t_a) \geq S(t_b)\) whenever \(t_a < t_b\).
If the disease or event occurs eventually for all individuals in our population \(\Omega\) (e.g., death), then \(S(t) \rightarrow 0\) as \(t \rightarrow \infty\).
Each of these probabilities follows directly from the definition of \(S(t)\). Similarly, the cumulative incidence function \(F\) has \(F(0) = 0\) and \(F(t) \in [0, 1]\), and it is monotonically increasing (i.e., never decreasing) with increasing \(t\). If the disease or event occurs eventually in all individuals, then \(F(t) \rightarrow 1\) as \(t \rightarrow \infty\). Figure 1.2 shows the survival and cumulative hazard curves for the data generated in the prevalence example above.
Code
surv-fig.R
## Plot of survival and cumulative incidence functions# read data from CSV file# Change or remove ".R/" in the path as needed to locate the cohort.csv file.# You can also re-generate the data as in prevalence.R using the same seed.cohort <-read.csv("./R/cohort.csv")# risk (cumpulative incidence)risk <-function(t) {# vector of TRUE/FALSE for incident cases in (0, t] incident <- cohort$onset <= tmean(incident)}# cumulative incidence functioncuminc <-Vectorize(risk)# survival functionsurv <-function(t) 1-cuminc(t)# plot the survival and cumulative incidence functionst <-seq(0, 20, by =0.1)plot(t, surv(t), type ="l",xlab ="Time", ylab ="Probability")lines(t, cuminc(t), lty ="dashed")grid()legend("right", bg ="white", lty =c("dashed", "solid"),legend =c("Cumulative incidence", "Survival"))
Figure 1.2: Survival and cumulative incidence curves for the data from the prevalence example.
Here, I will generally use the word “risk” to refer to the probability of disease onset in a specified interval. When there is possible confusion about the meaning of “risk”, I will use “cumulative incidence” instead. The terms “cumulative incidence function” and “survival function” are standard in survival analysis, which is the branch of statistics that studies times to events. The creative use of “risk” in public health and medicine should not make you shy away from using the word correctly.
1.5.3 Prevalence and the duration of disease
Point and period prevalence are both affected by the duration of disease. Both measures will increase if the duration of disease increases. A simple illustration of this is given in Figure 1.3. For a fixed set of onset times, the point prevalence of disease at any time \(t\) either stays the same or increases when the duration of disease increases. The prevalence at time \(t = 5\) is \(\frac{2}{5} = 0.4\) under the shorter duration of disease but \(\frac{3}{5} = 0.6\) under the longer duration of disease. Period prevalence over any interval \((t_a, t_b]\) is affected by the duration of disease because it is the point prevalence at \(t_a\) (which is affected by disease duration) plus the risk of disease onset over \((t_a, t_b]\). In a given population, the relationship between prevalence, frequency of disease onset (incidence), and the duration of disease can be complex (Freeman and Hutchison 1980; Preston 1987; Keiding 1991; Alho 1992). The risk of disease in any given interval is not affected by the duration of disease.
Figure 1.3: Each black horizonal line shows the onset of disease and recovery from disease in a single individual. The gray lines show recoveries from disease if the disease duration increases.
1.5.4 Descriptive and analytic epidemiology
Prevalence is often a useful measure for descriptive epidemiology, which measures the distribution of disease over person, place, and time. Because prevalence depends on both incidence and duration of disease, a change in the prevalence of disease can generally be explained several different ways (MacMahon and Terry 1958; Dunn Jr 1962). For example, an increase in prevalence of human immunodeficiency virus (HIV) infection could be cause by an increase in the incidence of HIV infection (which is bad) or an increase in the life expectancy of HIV-infected people (which is good).
Risk (cumulative incidence) is generally more useful than prevalence for analytic epidemiology, which attempts to identify the causes of a disease. Another advantage of risk is that it can be used for outcomes that begin and end very quickly (e.g., traffic accidents or being hit by lightning) and for outcomes that remove individuals from the population (e.g., emigration or death). Prevalence is not a useful measure of the public health impact of these events.
Alho, Juha M. 1992. “On Prevalence, Incidence, and Duration in General Stable Populations.”Biometrics 48 (2): 587–92.
Dunn Jr, John E. 1962. “The Use of Incidence and Prevalence in the Study of Disease Development in a Population.”American Journal of Public Health 52 (7): 1107–18.
Freeman, Jonathan, and George B Hutchison. 1980. “Prevalence, Incidence and Duration.”American Journal of Epidemiology 112 (5): 707–23.
Keiding, Niels. 1991. “Age-Specific Incidence and Prevalence: A Statistical Perspective.”Journal of the Royal Statistical Society: Series A (Statistics in Society) 154 (3): 371–96.
Laplace, Pierre Simon. 1820. Théorie Analytique Des Probabilités. Vol. 7. Courcier.
MacMahon, Brian, and William D Terry. 1958. “Application of Cohort Analysis to the Study of Time Trends in Neoplastic Disease.”Journal of Chronic Diseases 7 (1): 24–35.
Morabia, Alfredo. 2004. “Epidemiology: An Epistemological Perspective.” In A History of Epidemiologic Methods and Concepts, edited by Alfredo Morabia, 3–125. Springer.
Preston, Samuel H. 1987. “Relations Among Standard Epidemiologic Measures in a Population.”American Journal of Epidemiology 126 (2): 336–45.
Pierre-Simone, marquis de Laplace (1749-1827) is often called the Newton of France. He proved that the solar system is stable, developed theories of ocean tides and gravitational potential, proved one of the first general versions of the central limit theorem, and pioneered the Bayesian interpretation of probability. His is one of the 72 names on the Eiffel Tower. ↩︎
The natural numbers \(\mathbb{N} = \{0, 1, 2, \ldots\}\) are countably infinite, as are the integers \(\mathbb{Z}\) and the rational numbers \(\mathbb{Q}\). The real numbers \(\mathbb{R}\) are uncountably infinite, as are the real numbers in any nonempty interval \((a, b)\) and the irrational numbers. Uncountably infinite sets are infinitely larger than countably infinite sets. This distinction was discovered in the 1870s by the German mathematician Georg Cantor (1845–1918). It was considered shocking, but it has become a cornerstone of modern mathematics.↩︎
In experiments with uncountably infinite sample spaces, the probability of an event \(A\) cannot always be calculated by adding up the probabilities of \(\{\omega\}\) for all \(\omega \in A\). For example: If we choose a number at uniformly at random in \([0, 1]\), the probability of getting any particular number \(\omega\) is zero. The sum of the probabilities of all \(\{\omega\} \subseteq A\) is zero (if \(A\) is countable) or undefined (if \(A\) is uncountable). By maintaining a distinction between outcomes and events and by limiting probability calculations to countable (i.e., finite or countably infinite) sums, we end up with something coherent and useful.↩︎
Named after John Venn (1834-1923), an English logician and philosopher who was one of the pioneers of the frequentist interpretation of probability. He was ordained as an Anglican priest in 1859 but resigned from the church in 1883. He was a prize-winning gardener of roses and white carrots and a prominent supporter of women’s right to vote. From 1903 until his death, he was President of Fellows in Gonville and Caius College at the University of Cambridge, where he is commemorated with a Venn diagram in a stained glass window.↩︎
In probability, we only consider unions and intersections of finite or countably infinite sets of events. Although unions and intersections can be defined for uncountably infinite sets of events, it can be impossible to assign probabilities to the resulting sets (see the Banach-Tarski paradox). As an epidemiologist, this should not keep you up at night.↩︎
Technically, we assign probabilities only to events in a class \(\mathcal{F}\) of subsets of \(\Omega\) that is required to contain \(\Omega\) and to be closed under complements and countable unions. “Closed under complements” means that \(A^\comp \in \mathcal{F}\) whenever \(A \in \mathcal{F}\). For example, \(\varnothing = \Omega^\comp\) must be in \(\mathcal{F}\) because \(\Omega \in \mathcal{F}\). “Closed under countable unions” means that \(\bigcup_{i = 1}^\infty A_i \in \mathcal{F}\) whenever \((A_1, A_2, \ldots)\) is a sequence of events in \(\mathcal{F}\). The class \(\mathcal{F}\) is called a \(\sigma\)-algebra or \(\sigma\)-field, and this restriction on the domain of probability helps avoid internal contradictions like the Banach-Tarski paradox.↩︎
Technically, the support of \(X\) is the smallest closed set \(S_X\) such that \(\Pr(X \in S_X) = 1\). For a discrete random variable with support on a finite set, it is just the set of possible values. For a discrete random variable with support on a countably infinite set, it can include points whose probability mass is zero—a pathological case that we can safely ignore. For a continuous random variable, it can include values whose probability density is zero—a case that is not unusual or pathological.↩︎
Named after Jacob Bernoulli (1655-1705), a Swiss mathematician who derived the first version of the law of large numbers and discovered the constant \(e \approx 2.718281828\), which is the base for natural logarithms. He and his younger brother Johann Bernoulli (1667-1748) were some of the first mathematicians to try to understand and apply calculus, but their relationship eventually curdled into a jealous rivalry. A lunar impact crater called Bernoulli is named jointly after them.↩︎
This becomes a fundamental insight when we discuss hypothesis tests for independence as well as confounding and selection bias.↩︎
Discrete random variables \(X\) and \(Y\) are independent if \(\Pr(X = x \vand Y = y) = \Pr(X = x) \Pr(Y = y)\) for any possible values \(x \in \supp(X)\) and \(y \in \supp(Y)\). We will discuss independence more rigorously when we discuss conditional probabilities in Chapter 2.↩︎
Named after Karl Pearson (1857-1936), an English mathematician who founded the modern discipline of mathematical statistics. In 1911, he started the world’s first university department of statistics at University College London. He was an outspoken socialist and supporter of women’s rights, but he was also a vocal proponent of social Darwinism and eugenics who opposed Jewish immigration into Britain.↩︎