Reference sheet

Introduction to Probability reference sheet

The main definitions, formulas, distributions and conditions of Introduction to Probability on one page, unit by unit, with links to the lessons that explain each topic in full.

For Introduction to Probability

This sheet follows the thirteen units of the course in order. Each unit starts with the big idea in a few sentences, then gives the definitions, formulas and rules you will look up most often, with the conditions they need. When you want the full explanation, a proof or more examples, follow the lesson links under each topic.

Events are sets of outcomes in a sample space Ω\Omega, with complement AcA^{c}, empty event ∅\varnothing, intersection A∩BA \cap B and union A∪BA \cup B. A conditional probability P(A∣B)P(A \mid B) is defined only when P(B)>0P(B) > 0. Random variables are capital letters such as XX, and lowercase letters such as xx stand for their values. A discrete variable has the PMF pX(x)=P(X=x)p_X(x) = P(X = x), a continuous one has a density ff, and every random variable has the CDF F(t)=P(X≤t)F(t) = P(X \le t). Expectations are written E[X]E[X], together with Var⁡(X)\operatorname{Var}(X), SD⁡(X)\operatorname{SD}(X) and Cov⁡(X,Y)\operatorname{Cov}(X, Y), and a formula that contains an expectation assumes it is finite unless it says otherwise. For observations X1,…,XnX_1, \dots, X_n the partial sum is Sn=X1+⋯+XnS_n = X_1 + \cdots + X_n and the sample mean is Xˉn=Sn/n\bar{X}_n = S_n/n, also written Xˉ\bar{X}.

Distributions are written Bin⁡(n,p)\operatorname{Bin}(n, p), Pois⁡(λ)\operatorname{Pois}(\lambda), Uniform⁡(a,b)\operatorname{Uniform}(a, b), Exp⁡(λ)\operatorname{Exp}(\lambda) and N(μ,σ2)N(\mu, \sigma^2). The exponential distribution is written with its rate λ\lambda, so its mean is 1/λ1/\lambda, and the second entry of N(μ,σ2)N(\mu, \sigma^2) is the variance. The standard normal CDF is Φ\Phi. Geometric and negative binomial waiting times count the trials up to and including the success they wait for. Markov chains use a row-stochastic transition matrix PP and row vectors of state probabilities. Logarithms are natural, and decimals from Φ\Phi, exe^{x} or long products are rounded.

Probability Foundations

A probability is a number attached to an event under a stated model. The model lists the possible outcomes and assigns probabilities that obey three axioms, and every other rule, such as the complement rule and the addition rule, follows from those axioms.

Models, outcomes and events

An experiment is a procedure together with a rule for what is recorded, and a trial is one run of it. An outcome is one complete recorded result, the sample space Ω\Omega is the set of all outcomes, and an event is a set of outcomes. An event occurs on a trial when the observed outcome belongs to it. In a finite model it is enough to give each outcome ω\omega a probability pω≥0p_\omega \ge 0 so that these numbers add to 11, and then every event AA has

P(A)=∑ω∈Apω.P(A) = \sum_{\omega \in A} p_\omega .

Three kinds of probability are easy to mix up.

KindWhat it isWhere it comes from
Theoreticalthe value P(A)P(A) in a stated modelthe assumptions of the model
Empirical relative frequencyk/nk/n when AA occurred on kk of nn recorded trialsone finite record, which can change from run to run
Subjectivea degree of belief that AA occurs, coherent when it obeys the rules of probabilitythe information available, revised as evidence arrives

For independent trials in which AA has the same probability pp, for every fixed positive margin the chance that the relative frequency misses pp by more than that margin tends to 00 as nn grows. This is the law of large numbers. At a fixed nn the relative frequency can still differ from pp.

Lessons Probability Models and Uncertainty

Describing events

WordsEvent
AA or BB, with the inclusive orA∪BA \cup B
AA and BBA∩BA \cap B
not AAAc=Ω∖AA^{c} = \Omega \setminus A
AA but not BBA∖B=A∩BcA \setminus B = A \cap B^{c}
neither AA nor BBAc∩BcA^{c} \cap B^{c}
not both(A∩B)c=Ac∪Bc(A \cap B)^{c} = A^{c} \cup B^{c}
exactly one of AA and BB(A∩Bc)∪(Ac∩B)(A \cap B^{c}) \cup (A^{c} \cap B)
AA happens only if BB happensthe statement A⊆BA \subseteq B, not an event

De Morgan’s laws hold for any events,

(A∪B)c=Ac∩Bc,(A∩B)c=Ac∪Bc,\begin{gathered} (A \cup B)^{c} = A^{c} \cap B^{c}, \\[0.4em] (A \cap B)^{c} = A^{c} \cup B^{c}, \end{gathered}

and for any number of events in the same way. Events are disjoint, or mutually exclusive, when A∩B=∅A \cap B = \varnothing. Nonempty, pairwise disjoint events whose union is Ω\Omega form a partition, so every outcome lies in exactly one of them. For a count NN with integer values and an integer kk, at least kk means N≥kN \ge k and includes kk, and its complement is N≤k−1N \le k - 1. One outcome that lies in AA but not in BB is a counterexample that disproves the claim A⊆BA \subseteq B.

Lessons Sample Spaces and Events, Translating Event Language

The axioms and basic rules

A probability PP gives a number to every event and satisfies three axioms.

  1. Nonnegativity. Every event has P(E)≥0P(E) \ge 0.
  2. Normalization. The certain event has P(Ω)=1P(\Omega) = 1.
  3. Countable additivity. For pairwise disjoint events E1,E2,…E_1, E_2, \dots the probability of the union is the sum P(E1)+P(E2)+⋯P(E_1) + P(E_2) + \cdots.

The other basic rules follow from these.

RuleStatementCondition
Empty eventP(∅)=0P(\varnothing) = 0always
Finite additivityP(A∪B)=P(A)+P(B)P(A \cup B) = P(A) + P(B)A∩B=∅A \cap B = \varnothing
Complement ruleP(Ac)=1−P(A)P(A^{c}) = 1 - P(A)always
MonotonicityP(A)≤P(B)P(A) \le P(B)A⊆BA \subseteq B
DifferenceP(B∖A)=P(B)−P(A)P(B \setminus A) = P(B) - P(A)A⊆BA \subseteq B
Range0≤P(A)≤10 \le P(A) \le 1always

The complement rule is the usual way to handle at least one. The complement of at least one of A1,…,AnA_1, \dots, A_n is none of them, so

P(at least one)=1−P(none).\begin{aligned} &P(\text{at least one}) \\[0.4em] &\quad = 1 - P(\text{none}). \end{aligned}

This step needs no independence. Independence enters only when P(none)P(\text{none}) is written as the product of the factors 1−P(Ai)1 - P(A_i), a step that mutual independence of the events justifies.

Lessons Probability Axioms and Basic Rules, The Complement Rule

The addition rule

For any two events,

P(A∪B)=P(A)+P(B)−P(A∩B).\begin{aligned} P(A \cup B) &= P(A) + P(B) \\[0.4em] &\quad - P(A \cap B). \end{aligned}

The overlap is subtracted once because P(A)+P(B)P(A) + P(B) counts it twice. Two events split Ω\Omega into the four disjoint regions A∩BA \cap B, A∩BcA \cap B^{c}, Ac∩BA^{c} \cap B and Ac∩BcA^{c} \cap B^{c}, and every event built from AA and BB is a union of some of them. Exactly one of the two events occurs with probability P(A)+P(B)−2P(A∩B)P(A) + P(B) - 2P(A \cap B), and neither occurs with probability 1−P(A∪B)1 - P(A \cup B). When the overlap is unknown, the union bound still gives

P(A1∪⋯∪An)≤P(A1)+⋯+P(An),\begin{aligned} &P(A_1 \cup \cdots \cup A_n) \\[0.4em] &\quad \le P(A_1) + \cdots + P(A_n), \end{aligned}

and for two events max⁡(P(A),P(B))≤P(A∪B)≤P(A)+P(B)\max\bigl(P(A), P(B)\bigr) \le P(A \cup B) \le P(A) + P(B), with equality on the right exactly when P(A∩B)=0P(A \cap B) = 0. For example, if P(A)=0.5P(A) = 0.5, P(B)=0.4P(B) = 0.4 and P(A∩B)=0.2P(A \cap B) = 0.2, then P(A∪B)=0.7P(A \cup B) = 0.7, exactly one occurs with probability 0.50.5 and neither occurs with probability 0.30.3.

Lessons The Addition Rule

Equally likely outcomes

If Ω\Omega is finite and nonempty and all of its outcomes are equally likely, then every event AA has

P(A)=∣A∣∣Ω∣,P(A) = \frac{\lvert A \rvert}{\lvert \Omega \rvert},

where ∣A∣\lvert A \rvert is the number of outcomes in AA. Equal likelihood is an assumption about the experiment, and it can hold at one level of detail and fail at a coarser one. Count the event and the sample space at the same level, one where the outcomes are equally likely, which is often the level of ordered sequences. Two fair dice rolled independently have 3636 equally likely ordered outcomes, so a total of 77 has probability 6/36=1/66/36 = 1/6, while the eleven possible totals are not equally likely. Three tosses of a fair coin have 88 equally likely sequences, and exactly two heads has probability 3/83/8.

Lessons Equally Likely Outcomes

Simulation

A simulation generates outcomes from a model, repeats the experiment nn times and reports the relative frequency

p^n=Snn,\hat{p}_n = \frac{S_n}{n},

where SnS_n is the number of simulated trials in which the event occurred. A pseudorandom generator is deterministic, so the same algorithm, seed and sequence of calls reproduce the same run, and a different seed usually gives a different estimate. For independent simulated trials the estimate varies around the model probability, and for every fixed positive margin the chance of a miss larger than that margin tends to 00 as nn grows. A simulator built on the wrong model estimates the probability of the event in that wrong model, and running it longer does not remove the difference from the intended probability. How large the sampling error is likely to be is worked out in the unit on repeated sampling.

Lessons Probability Simulation

Counting and Equally Likely Models

When the outcomes are equally likely, a probability is a ratio of two counts. Every counting method starts from what one outcome records, then asks whether order matters, whether items can repeat and which objects can be told apart.

Sum and product rules

  • Product rule. Suppose each outcome is built by kk successive choices, the choice at stage ii has nin_i options whatever the earlier choices were, and different sequences of choices give different outcomes. Then there are n1n2⋯nkn_1 n_2 \cdots n_k outcomes. The options themselves may depend on the earlier choices, as long as their number does not.
  • Sum rule. If a set splits into pairwise disjoint cases, its size is the sum of the sizes of the cases. For two overlapping sets, ∣S1∪S2∣=∣S1∣+∣S2∣−∣S1∩S2∣\lvert S_1 \cup S_2 \rvert = \lvert S_1 \rvert + \lvert S_2 \rvert - \lvert S_1 \cap S_2 \rvert.
  • Cases and trees. When the number of options differs from path to path, split into cases at the stage where it differs, count each case and add. In a decision tree each outcome is one leaf.
  • Restrictions. Give each stage only the options that satisfy every restriction, and it often helps to fill the most restricted stage first.

A code of 44 digits has 104=1000010^4 = 10000 possibilities, and 10⋅9⋅8⋅7=504010 \cdot 9 \cdot 8 \cdot 7 = 5040 of them repeat no digit.

Lessons Sum and Product Rules for Counting

Permutations and combinations

Choose kk objects from nn distinct objects.

SelectionOrder mattersOrder ignored
Without replacement, 0≤k≤n0 \le k \le nn!(n−k)!\dfrac{n!}{(n - k)!}(nk)=n!k! (n−k)!\dbinom{n}{k} = \dfrac{n!}{k!\,(n - k)!}
With replacement, n≥1n \ge 1nkn^k(n+k−1k)\dbinom{n + k - 1}{k} multisets

Here n!=n(n−1)⋯2⋅1n! = n(n - 1) \cdots 2 \cdot 1 for n≥1n \ge 1, and 0!=10! = 1. There are n!n! arrangements of nn distinct objects in a row, and for n≥1n \ge 1 there are (n−1)!(n - 1)! arrangements around a circle when rotations count as the same. Without replacement no selection exists when k>nk > n. Counting multisets is not the same as finding their probabilities, because unordered records of independent draws are usually not equally likely, as the last topic of this unit shows.

For 0≤k≤n0 \le k \le n the binomial coefficient (nk)\binom{n}{k} counts the subsets of size kk of a set of nn elements. It satisfies (nk)=(nn−k)\binom{n}{k} = \binom{n}{n - k}, the rows of Pascal’s triangle add up to (n0)+⋯+(nn)=2n\binom{n}{0} + \cdots + \binom{n}{n} = 2^n, and Pascal’s identity

(nk)=(n−1k−1)+(n−1k)\begin{aligned} \binom{n}{k} &= \binom{n - 1}{k - 1} \\[0.4em] &\quad + \binom{n - 1}{k} \end{aligned}

holds for 1≤k≤n−11 \le k \le n - 1. For every integer n≥0n \ge 0 the binomial theorem states

(a+b)n=∑k=0n(nk)an−kbk,(a + b)^n = \sum_{k=0}^{n} \binom{n}{k} a^{n - k} b^{k},

with 000^0 read as 11. From 1010 people, a chair and a secretary can be chosen in 10⋅9=9010 \cdot 9 = 90 ways and a committee of three in (103)=120\binom{10}{3} = 120 ways.

Lessons Permutations, Combinations and Binomial Coefficients

Repeated objects

Suppose nn objects come in kk types, with nin_i objects of type ii that cannot be told apart and n1+⋯+nk=nn_1 + \cdots + n_k = n. The number of distinct arrangements in a row is the multinomial coefficient

(nn1,…,nk)=n!n1! n2!⋯nk!.\begin{aligned} &\binom{n}{n_1, \ldots, n_k} \\[0.4em] &\quad = \frac{n!}{n_1!\, n_2! \cdots n_k!}. \end{aligned}

The same number counts the ways to split nn distinct objects into named groups of sizes n1,…,nkn_1, \dots, n_k, and it is the coefficient of x1n1⋯xknkx_1^{n_1} \cdots x_k^{n_k} in (x1+⋯+xk)n(x_1 + \cdots + x_k)^n, so these coefficients add up to knk^n. Choosing the positions of each type in turn gives the same count as the product (nn1)(n−n1n2)⋯\binom{n}{n_1}\binom{n - n_1}{n_2} \cdots. Whether two objects can be told apart depends on what the outcome records. The letters of LEVEL have 5!/(2! 2! 1!)=305!/(2!\,2!\,1!) = 30 arrangements, and those of MISSISSIPPI have 11!/(1! 4! 4! 2!)=3465011!/(1!\,4!\,4!\,2!) = 34650.

Lessons Repeated Objects and Multinomial Counting

Inclusion-exclusion

For three events AA, BB and CC, write S1=P(A)+P(B)+P(C)S_1 = P(A) + P(B) + P(C) for the sum of the single probabilities, S2S_2 for the sum of the three pairwise intersection probabilities and S3=P(A∩B∩C)S_3 = P(A \cap B \cap C). These three sums give the probabilities in the table.

EventProbability
at least one, A∪B∪CA \cup B \cup CS1−S2+S3S_1 - S_2 + S_3
exactly oneS1−2S2+3S3S_1 - 2S_2 + 3S_3
at least twoS2−2S3S_2 - 2S_3
exactly twoS2−3S3S_2 - 3S_3
all threeS3S_3

For nn events, with SkS_k the sum of the probabilities of all intersections of kk of them,

P(⋃i=1nAi)=∑k=1n(−1)k+1Sk.P\Bigl(\bigcup_{i=1}^{n} A_i\Bigr) = \sum_{k=1}^{n} (-1)^{k+1} S_k .

The same identities hold for the sizes of finite sets, and none of them needs independence or equally likely outcomes. Among the integers 11 to 100100, the number divisible by 22, 33 or 55 is 50+33+20−16−10−6+3=7450 + 33 + 20 - 16 - 10 - 6 + 3 = 74.

Lessons Inclusion-Exclusion

Birthday and collision problems

Suppose each of nn individuals receives one of mm categories, independently and with probability 1/m1/m for each category. A collision means that at least two individuals share a category, and its complement has probability

P(no collision)=∏j=0n−1(1−jm).\begin{aligned} &P(\text{no collision}) \\[0.4em] &\quad = \prod_{j=0}^{n-1} \left(1 - \frac{j}{m}\right). \end{aligned}
  • With m=365m = 365 equally likely birthdays, a shared birthday has probability about 0.4760.476 for n=22n = 22 people and about 0.5070.507 for n=23n = 23.
  • A pair named in advance matches with probability 1/m1/m whatever nn is. A collision is the union of (n2)\binom{n}{2} such pair events, which can occur together, so the sum gives only the bound P(collision)≤(n2)/mP(\text{collision}) \le \binom{n}{2}/m.
  • If n>mn > m, a collision is certain by the pigeonhole principle, whatever the category probabilities.
  • With unequal category probabilities p1,…,pmp_1, \dots, p_m, two independent individuals match with probability p12+⋯+pm2≥1/mp_1^2 + \cdots + p_m^2 \ge 1/m. For any nn, independent individuals who share these probabilities collide at least as often as under equal probabilities.

Lessons Birthday and Collision Problems

Choosing a counting method

  1. Write down what one outcome records, and check that these outcomes are equally likely under the way the selection is actually made.
  2. Decide whether order matters, whether repetition is allowed and which objects can be told apart, then use the table of selections above or the multinomial coefficient.
  3. Count the event and the sample space at the same level of detail.
  4. When an event such as at least one splits into many cases, count its complement instead.

Erasing order can destroy equal likelihood. For two fair dice the unordered record of a 11 and a 22 comes from the two ordered outcomes (1,2)(1, 2) and (2,1)(2, 1) and has probability 2/362/36, while a double 11 comes only from (1,1)(1, 1) and has probability 1/361/36, so the 2121 unordered records are not equally likely. A record produced by mm of the equally likely outcomes of Ω\Omega has probability m/∣Ω∣m/\lvert \Omega \rvert.

Lessons Choosing a Counting Method

Conditioning, Independence and Evidence

Conditioning on an event BB with P(B)>0P(B) > 0 keeps only the outcomes in BB and rescales their probabilities to total 11. Independence is a product rule, not a statement about overlap, and Bayes’ theorem reverses a conditional probability by combining the evidence with the base rate.

Conditional probability

For events AA and BB with P(B)>0P(B) > 0,

P(A∣B)=P(A∩B)P(B).P(A \mid B) = \frac{P(A \cap B)}{P(B)}.

If P(B)=0P(B) = 0, the ratio is 0/00/0 and the conditional probability is undefined, which is different from 00. With equally likely outcomes, P(A∣B)=∣A∩B∣/∣B∣P(A \mid B) = \lvert A \cap B \rvert / \lvert B \rvert. For a fixed BB the rule A↦P(A∣B)A \mapsto P(A \mid B) is itself a probability, so for example P(Ac∣B)=1−P(A∣B)P(A^{c} \mid B) = 1 - P(A \mid B). Reversing the condition changes the denominator. When P(A)>0P(A) > 0 and P(B)>0P(B) > 0, the probabilities P(A∣B)P(A \mid B) and P(B∣A)P(B \mid A) are equal exactly when P(A)=P(B)P(A) = P(B) or P(A∩B)=0P(A \cap B) = 0.

In a two-way table of counts with one member drawn uniformly at random, a cell divided by the grand total is a joint probability and a row or column total divided by the grand total is a marginal probability. A cell divided by its row total is a conditional probability given the row, and a cell divided by its column total is a conditional probability given the column. In the constructed table below, P(T∩D)=18/200=0.09P(T \cap D) = 18/200 = 0.09, P(D∣T)=18/30=0.6P(D \mid T) = 18/30 = 0.6 and P(T∣D)=18/24=0.75P(T \mid D) = 18/24 = 0.75.

Defective DDNot defectiveTotal
Tagged TT181812123030
Not tagged66164164170170
Total2424176176200200

Lessons Conditional Probability, Conditional Probability Tables

Independence

Events AA and BB are independent when

P(A∩B)=P(A) P(B).P(A \cap B) = P(A)\,P(B).
  • When P(B)>0P(B) > 0 this is equivalent to P(A∣B)=P(A)P(A \mid B) = P(A), and when P(A)>0P(A) > 0 to P(B∣A)=P(B)P(B \mid A) = P(B).
  • If AA and BB are independent, so are AA and BcB^{c}, AcA^{c} and BB, and AcA^{c} and BcB^{c}.
  • An event of probability 00 or 11 is independent of every event.
  • Events A1,…,AnA_1, \dots, A_n are mutually independent when the product rule holds for every subcollection of two or more of them. Pairwise independence, the rule for every two, does not imply mutual independence.
  • For mutually independent events, none of them occurs with probability ∏i(1−P(Ai))\prod_i \bigl(1 - P(A_i)\bigr), and at least one occurs with probability 1−∏i(1−P(Ai))1 - \prod_i \bigl(1 - P(A_i)\bigr).

Disjoint and independent are different properties.

Relation between AA and BBIndependent exactly when
disjoint, A∩B=∅A \cap B = \varnothingP(A)=0P(A) = 0 or P(B)=0P(B) = 0
nested, A⊆BA \subseteq BP(A)=0P(A) = 0 or P(B)=1P(B) = 1
overlappingthe product rule holds, which the overlap alone cannot show

So disjoint events with positive probabilities are always dependent, since P(A∩B)=0<P(A) P(B)P(A \cap B) = 0 < P(A)\,P(B). Overlapping events can go either way. For one fair die the events {2,4,6}\{2, 4, 6\} and {1,2}\{1, 2\} are independent, because their intersection {2}\{2\} has probability 1/6=12⋅131/6 = \tfrac12 \cdot \tfrac13. The union of independent events still needs the overlap term,

P(A∪B)=P(A)+P(B)−P(A) P(B).\begin{aligned} P(A \cup B) &= P(A) + P(B) \\[0.4em] &\quad - P(A)\,P(B). \end{aligned}

Lessons Independent Events, Disjoint Events and Independence

Trees and the chain rule

The multiplication rule P(A∩B)=P(A) P(B∣A)P(A \cap B) = P(A)\,P(B \mid A) holds whenever P(A)>0P(A) > 0, with or without independence. Repeating it gives the chain rule. If P(A1∩⋯∩An−1)>0P(A_1 \cap \cdots \cap A_{n-1}) > 0, then

P(A1∩A2∩⋯∩An)  =P(A1) P(A2∣A1)⋯  ×P(An∣A1∩⋯∩An−1).\begin{aligned} &P(A_1 \cap A_2 \cap \cdots \cap A_n) \\[0.4em] &\; = P(A_1)\,P(A_2 \mid A_1) \cdots \\[0.4em] &\; \times P(A_n \mid A_1 \cap \cdots \cap A_{n-1}). \end{aligned}

In a probability tree the branches leaving a node are the disjoint and exhaustive outcomes of the next stage. Each carries its probability given the history at that node, so the branches from one node add to 11. The probability of a path is the product of its branch probabilities, and the probability of an event is the sum over the paths that make it up. Two cards drawn without replacement from a standard deck are both aces with probability 452⋅351=1221\tfrac{4}{52} \cdot \tfrac{3}{51} = \tfrac{1}{221}.

Lessons Probability Trees and the Chain Rule

Total probability and Bayes’ theorem

Let B1,…,BkB_1, \dots, B_k be a partition of Ω\Omega with every P(Bi)>0P(B_i) > 0. For every event EE,

P(E)=∑i=1kP(Bi) P(E∣Bi),P(E) = \sum_{i=1}^{k} P(B_i)\,P(E \mid B_i),

a weighted average of the rates in the groups, with the group probabilities as weights. If a partition also has groups of probability 00, they contribute nothing to P(E)P(E), so they are left out and the sum runs over the groups of positive probability. Bayes’ theorem reverses the condition. If P(H)>0P(H) > 0 and P(E)>0P(E) > 0, then

P(H∣E)=P(E∣H) P(H)P(E),P(H \mid E) = \frac{P(E \mid H)\,P(H)}{P(E)},

and when also P(H)<1P(H) < 1, the partition HH, HcH^{c} gives the denominator

P(E)=P(E∣H) P(H)+P(E∣Hc) P(Hc).\begin{aligned} P(E) &= P(E \mid H)\,P(H) \\[0.4em] &\quad + P(E \mid H^{c})\,P(H^{c}). \end{aligned}

For a test, let FF be the event that the condition is present and AA the event of a positive result.

TermProbability
Prior probability, or base rateP(F)P(F)
Sensitivity, the true positive rateP(A∣F)P(A \mid F)
Specificity, the true negative rateP(Ac∣Fc)P(A^{c} \mid F^{c})
False positive rateP(A∣Fc)P(A \mid F^{c}), which is 11 minus the specificity
Posterior probability after a positive resultP(F∣A)P(F \mid A)

Sensitivity and specificity condition on the true state, so neither of them is the posterior probability, and judging the posterior without the base rate is base rate neglect. With P(F)=0.05P(F) = 0.05, sensitivity 0.90.9 and false positive rate 0.10.1, a positive result has probability 0.045+0.095=0.140.045 + 0.095 = 0.14, and

P(F∣A)=0.0450.14=928≈0.32.\begin{aligned} P(F \mid A) &= \frac{0.045}{0.14} \\[0.4em] &= \frac{9}{28} \approx 0.32. \end{aligned}

Lessons The Law of Total Probability, Bayes’ Theorem and Base Rates

Conditional independence and odds

For an event CC with P(C)>0P(C) > 0, events AA and BB are conditionally independent given CC when P(A∩B∣C)=P(A∣C) P(B∣C)P(A \cap B \mid C) = P(A \mid C)\,P(B \mid C). Conditional independence and ordinary independence do not imply each other. Two reports that both respond to the same hidden state can be conditionally independent given each value of the state and still be dependent overall. To process evidence one piece at a time, use the current posterior as the next prior and condition each new likelihood on everything already observed. Under conditional independence given each hypothesis, the single-report likelihoods can be reused, while a report that only copies another one adds no evidence.

For 0≤p<10 \le p < 1, the odds in favor of an event with probability pp are o=p/(1−p)o = p/(1 - p), and conversely p=o/(1+o)p = o/(1 + o). Odds of a:ba : b in favor, with a,b≥0a, b \ge 0 and a+b>0a + b > 0, mean p=a/(a+b)p = a/(a + b). For a hypothesis HH with 0<P(H)<10 < P(H) < 1 and evidence EE with P(E∣Hc)>0P(E \mid H^{c}) > 0, write O(H)=P(H)/P(Hc)O(H) = P(H)/P(H^{c}) for the prior odds and O(H∣E)O(H \mid E) for the posterior odds. The odds form of Bayes’ theorem is

O(H∣E)=LR⁡(E) O(H),LR⁡(E)=P(E∣H)P(E∣Hc).\begin{aligned} O(H \mid E) &= \operatorname{LR}(E)\,O(H), \\[0.4em] \operatorname{LR}(E) &= \frac{P(E \mid H)}{P(E \mid H^{c})}. \end{aligned}

In the test example the prior odds 1/191/19 times the likelihood ratio 99 give posterior odds 9/199/19, which is the probability 9/289/28 again. For pieces of evidence that are conditionally independent given HH and given HcH^{c}, the likelihood ratios multiply.

Lessons Conditional Independence and Sequential Evidence, Probability and Odds

Discrete Random Variables and Expected Value

A random variable assigns a number to each outcome, and its distribution says how probability is spread over those numbers. Expected value is the probability-weighted average of the values, a single summary that need not be a possible value.

Random variables and PMFs

A random variable is a function XX from Ω\Omega to the real numbers, and {X∈B}\{X \in B\} is the event of the outcomes at which its value lies in BB. It is discrete when P(X∈S)=1P(X \in S) = 1 for some finite or countably infinite set SS. Its support is the set of values with positive probability, and its probability mass function is

pX(x)=P(X=x)p_X(x) = P(X = x)

for every real xx. A function pp is a PMF exactly when p(x)≥0p(x) \ge 0 for every xx, finitely or countably many values have p(x)>0p(x) > 0, and those masses add to 11. For a discrete XX and every set BB of real numbers

P(X∈B)=∑x∈BpX(x),P(X \in B) = \sum_{x \in B} p_X(x),

where only the support values in BB contribute. If the masses are known only up to a factor, p(x)=c g(x)p(x) = c\,g(x) on a set SS with g≥0g \ge 0 and a finite positive total, then c=1/∑x∈Sg(x)c = 1/\sum_{x \in S} g(x). For p(x)=cxp(x) = cx on {1,2,3,4}\{1, 2, 3, 4\} this gives c=1/10c = 1/10.

Lessons Discrete Random Variables, Probability Mass Functions

Cumulative distribution functions

The CDF of any random variable is F(t)=P(X≤t)F(t) = P(X \le t) for every real tt. It is nondecreasing and right-continuous, it tends to 00 as t→−∞t \to -\infty and to 11 as t→∞t \to \infty, and its left limit is F(t−)=P(X<t)F(t^-) = P(X < t). The jump of FF at aa is F(a)−F(a−)=P(X=a)F(a) - F(a^-) = P(X = a), so the CDF of a discrete variable jumps exactly at its support values, and with finite support it is a step function. For a<ba < b,

EventProbability
X≤bX \le bF(b)F(b)
X>aX > a1−F(a)1 - F(a)
X≥aX \ge a1−F(a−)1 - F(a^-)
a<X≤ba < X \le bF(b)−F(a)F(b) - F(a)
a≤X≤ba \le X \le bF(b)−F(a−)F(b) - F(a^-)
a<X<ba < X < bF(b−)−F(a)F(b^-) - F(a)

For a discrete variable, including or excluding an endpoint matters exactly when the endpoint has positive probability. When FF is continuous it never matters.

Lessons Cumulative Distribution Functions

Functions of a random variable

For Y=g(X)Y = g(X) with XX discrete, each value of XX passes its mass to its output, and masses with the same output add,

pY(y)=∑x : g(x)=ypX(x).p_Y(y) = \sum_{x \,:\, g(x) = y} p_X(x).

A map that is one-to-one on the support moves the masses without merging them. When two support values have the same output their masses merge, and when YY takes that output its value does not determine the value of XX. If XX is uniform on {−2,−1,0,1,2}\{-2, -1, 0, 1, 2\}, then Y=X2Y = X^2 has pY(0)=1/5p_Y(0) = 1/5 and pY(1)=pY(4)=2/5p_Y(1) = p_Y(4) = 2/5. The positive part X+=max⁡(X,0)X^{+} = \max(X, 0) moves the mass of every negative value to 00.

Lessons Functions of Discrete Random Variables

Expected value

For a discrete XX, the expected value, or mean, is

E[X]=∑xx pX(x),E[X] = \sum_{x} x\,p_X(x),

a finite number when ∑x∣x∣ pX(x)<∞\sum_x \lvert x \rvert\,p_X(x) < \infty, which always holds for finite support. Each value is weighted by its own probability, and for finite support the mean lies between the smallest and the largest value. A fair die has E[X]=3.5E[X] = 3.5, which is not a possible roll. For a function gg with ∑x∣g(x)∣ pX(x)<∞\sum_x \lvert g(x) \rvert\,p_X(x) < \infty,

E[g(X)]=∑xg(x) pX(x),E[g(X)] = \sum_{x} g(x)\,p_X(x),

and the value E[g(X)]E[g(X)] can differ from g(E[X])g(E[X]), as it does for g(x)=x2g(x) = x^2 and a fair die.

  • Infinite mean. A variable with no negative values has either a finite mean or E[X]=+∞E[X] = +\infty. If P(X=2k)=2−kP(X = 2^k) = 2^{-k} for k=1,2,…k = 1, 2, \dots, every term of the series equals 11 and the mean is infinite. This needs infinitely many values.
  • Undefined mean. If the positive and the negative values both contribute infinite sums, E[X]E[X] is undefined.
  • Conditional mean. For an event AA with P(A)>0P(A) > 0, the mean computed with the conditional masses P(X=x∣A)P(X = x \mid A) is E[X∣A]E[X \mid A].
  • Mode. A mode is a value with the largest mass. There can be several, and a mode can differ from the mean.

Lessons Expected Value

Expected value and decisions

If an action pays a random amount GG and costs a fixed amount cc, the net payoff N=G−cN = G - c has E[N]=E[G]−cE[N] = E[G] - c. The fair price, the fee that makes the expected net payoff 00, is c∗=E[G]c^{*} = E[G]. A ticket that costs c≥0c \ge 0 and pays a>0a > 0 with probability pp and nothing otherwise has expected net payoff ap−cap - c, which is 00 at the break-even probability p∗=c/ap^{*} = c/a, a probability only when c≤ac \le a. A $2 ticket that pays $10 with probability 0.150.15 has expected net payoff 10(0.15)−2=−0.510(0.15) - 2 = -0.5 dollars, and it would break even at p∗=0.2p^{*} = 0.2.

Choosing the action with the largest expected payoff, or the smallest expected cost, is one decision criterion among several. Others protect the worst case or limit the probability of exceeding a budget, and different criteria can rank the same actions differently. An expected value describes the model it was computed from, so a sensitivity check under other plausible inputs is one guard against model risk.

Lessons Expected Value and Decisions

Expectation, Spread, Sums and Averages

Expectation is linear whether or not the variables are independent, which turns expected counts into sums of probabilities. Variance measures spread around the mean, the variances of independent variables add, and together these facts give the mean and the standard error of a sample mean.

Linearity and indicators

If X1,…,XnX_1, \dots, X_n have finite expectations, a1,…,ana_1, \dots, a_n and cc are constants and nn is fixed, then

E[∑i=1naiXi+c]=∑i=1naiE[Xi]+c,\begin{aligned} &E\Bigl[\sum_{i=1}^{n} a_i X_i + c\Bigr] \\[0.4em] &\quad = \sum_{i=1}^{n} a_i E[X_i] + c, \end{aligned}

with no independence needed. The product rule E[XY]=E[X] E[Y]E[XY] = E[X]\,E[Y] is a different statement. It holds for independent XX and YY with finite expectations, and it can also hold for dependent variables, so it does not show independence.

The indicator IAI_A of an event AA equals 11 on AA and 00 elsewhere, with E[IA]=P(A)E[I_A] = P(A), IAc=1−IAI_{A^{c}} = 1 - I_A and IA∩B=IAIBI_{A \cap B} = I_A I_B. If NN counts how many of the events A1,…,AnA_1, \dots, A_n occur, then N=IA1+⋯+IAnN = I_{A_1} + \cdots + I_{A_n} and

E[N]=P(A1)+⋯+P(An),E[N] = P(A_1) + \cdots + P(A_n),

even when the events are dependent. If nn hats are handed back to their nn owners in a uniformly random order, each owner gets their own hat with probability 1/n1/n, so the expected number of matches is 11 for every nn. Six rolls of a fair die show on average 6(1−(5/6)6)≈3.996\bigl(1 - (5/6)^6\bigr) \approx 3.99 different faces.

Lessons Linearity of Expectation, Indicator Random Variables

Variance and standard deviation

For XX with finite mean μ\mu,

Var⁡(X)=E[(X−μ)2],SD⁡(X)=Var⁡(X).\begin{gathered} \operatorname{Var}(X) = E\bigl[(X - \mu)^2\bigr], \\[0.4em] \operatorname{SD}(X) = \sqrt{\operatorname{Var}(X)}. \end{gathered}

The variance is finite exactly when E[X2]<∞E[X^2] < \infty, and then Var⁡(X)=E[X2]−(E[X])2\operatorname{Var}(X) = E[X^2] - (E[X])^2. It equals 00 exactly when P(X=μ)=1P(X = \mu) = 1. Variance is in squared units, and the standard deviation is in the units of XX. For a fair die E[X2]=91/6E[X^2] = 91/6, so Var⁡(X)=91/6−49/4=35/12\operatorname{Var}(X) = 91/6 - 49/4 = 35/12 and SD⁡(X)≈1.71\operatorname{SD}(X) \approx 1.71. For constants aa and bb and finite variance,

QuantityValue for aX+baX + b
Meana E[X]+ba\,E[X] + b
Variancea2Var⁡(X)a^2 \operatorname{Var}(X)
Standard deviation∣a∣SD⁡(X)\lvert a \rvert \operatorname{SD}(X)

A shift leaves the spread unchanged, and a change of units with factor aa multiplies the standard deviation by ∣a∣\lvert a \rvert. The mean absolute deviation E[∣X−μ∣]E\bigl[\lvert X - \mu \rvert\bigr] is another measure of spread, and it never exceeds SD⁡(X)\operatorname{SD}(X).

Lessons Variance, Standard Deviation and Changing Scale

Sums of random variables

For discrete XX and YY on the same sample space, with joint masses pX,Y(x,y)=P(X=x,Y=y)p_{X,Y}(x, y) = P(X = x, Y = y), the sum S=X+YS = X + Y has

pS(s)=P(X+Y=s)=∑xpX,Y(x,s−x).\begin{aligned} p_S(s) &= P(X + Y = s) \\[0.4em] &= \sum_{x} p_{X,Y}(x, s - x). \end{aligned}

In general the separate distributions of XX and YY do not determine the distribution of the sum. For independent XX and YY the joint masses factor, and the formula becomes the discrete convolution

pS(s)=∑xpX(x) pY(s−x).p_S(s) = \sum_{x} p_X(x)\,p_Y(s - x).

The mean always adds, E[X+Y]=E[X]+E[Y]E[X + Y] = E[X] + E[Y]. With finite variances,

Var⁡(X+Y)=Var⁡(X)+Var⁡(Y)+2Cov⁡(X,Y),\begin{aligned} &\operatorname{Var}(X + Y) \\[0.4em] &\quad = \operatorname{Var}(X) + \operatorname{Var}(Y) \\[0.4em] &\qquad + 2\operatorname{Cov}(X, Y), \end{aligned}

where the covariance, defined in the unit on joint laws, is 00 for independent variables. So the variances of independent variables add, while their standard deviations do not. The total of two fair dice rolled independently has P(S=7)=6/36P(S = 7) = 6/36 and Var⁡(S)=35/6\operatorname{Var}(S) = 35/6.

Lessons Sums of Discrete Random Variables

Sample means

A random sample of size nn is a list X1,…,XnX_1, \dots, X_n of independent and identically distributed, or IID, random variables. A statistic is computed from the sample by a fixed rule, and its sampling distribution is its distribution under the model. If the XiX_i are IID with mean μ\mu and finite variance σ2\sigma^2, then

E[Xˉ]=μ,Var⁡(Xˉ)=σ2n,SD⁡(Xˉ)=σn.\begin{gathered} E[\bar{X}] = \mu, \\[0.4em] \operatorname{Var}(\bar{X}) = \frac{\sigma^2}{n}, \\[0.4em] \operatorname{SD}(\bar{X}) = \frac{\sigma}{\sqrt{n}}. \end{gathered}

The mean needs only a common mean. The variance needs uncorrelated observations with a common variance, which IID observations have. The standard deviation of a statistic is called its standard error. A histogram of simulated values of a statistic only approximates its sampling distribution.

Lessons Sample Means and Sampling Distributions

Discrete Probability Distributions

A few families of discrete distributions describe the most common random mechanisms, and each family belongs to a particular experiment. Its formulas apply only when that experiment’s conditions hold, so check the conditions before using a formula.

Families at a glance

In the binomial, geometric and negative binomial rows, the trials are independent and every trial is a success with the same probability pp.

FamilyExperimentValuesMeanVariance
Discrete uniform on {a,…,b}\{a, \dots, b\}one of N=b−a+1N = b - a + 1 consecutive integers, all equally likelya,…,ba, \dots, ba+b2\dfrac{a + b}{2}N2−112\dfrac{N^2 - 1}{12}
Bernoulli⁡(p)\operatorname{Bernoulli}(p)one trial, success coded 110,10, 1ppp(1−p)p(1 - p)
Bin⁡(n,p)\operatorname{Bin}(n, p)successes in nn trials0,…,n0, \dots, nnpnpnp(1−p)np(1 - p)
Geometric, 0<p≤10 < p \le 1trials up to and including the first success1,2,…1, 2, \dots1p\dfrac{1}{p}1−pp2\dfrac{1 - p}{p^2}
Negative binomial, r≥1r \ge 1 and 0<p≤10 < p \le 1trials up to and including success number rrr,r+1,…r, r + 1, \dotsrp\dfrac{r}{p}r(1−p)p2\dfrac{r(1 - p)}{p^2}
Hypergeometricmarked items among nn drawn without replacement from NN items, KK of them markedsee belownKN\dfrac{nK}{N}nKN(1−KN)N−nN−1n\dfrac{K}{N}\Bigl(1 - \dfrac{K}{N}\Bigr)\dfrac{N - n}{N - 1} for N≥2N \ge 2
Pois⁡(λ)\operatorname{Pois}(\lambda)a count over an exposure0,1,2,…0, 1, 2, \dotsλ\lambdaλ\lambda

A discrete uniform variable on a set of NN values gives each of them the mass 1/N1/N, so an event containing mm of the values has probability m/Nm/N. The mean and variance in the table hold for consecutive integers, and for evenly spaced values with gap dd the variance is d2(N2−1)/12d^2(N^2 - 1)/12. A fair die has mean 3.53.5 and variance 35/1235/12. No distribution gives the same positive mass to infinitely many values, because the masses would add to more than 11.

Lessons The Discrete Uniform Distribution

Bernoulli and binomial distributions

A variable B∼Bernoulli⁡(p)B \sim \operatorname{Bernoulli}(p) with 0≤p≤10 \le p \le 1 has P(B=1)=pP(B = 1) = p and P(B=0)=1−pP(B = 0) = 1 - p. Every indicator IAI_A is Bernoulli⁡(P(A))\operatorname{Bernoulli}\bigl(P(A)\bigr). The variance p(1−p)p(1 - p) is at most 1/41/4, with equality only at p=1/2p = 1/2, and it is 00 when pp is 00 or 11.

A count XX of successes is Bin⁡(n,p)\operatorname{Bin}(n, p) when the number of trials nn is fixed in advance, each trial records one clearly defined success, the trials are independent and every trial has the same success probability pp. Then, for k=0,1,…,nk = 0, 1, \dots, n,

P(X=k)=(nk)pk(1−p)n−k,P(X = k) = \binom{n}{k} p^{k} (1 - p)^{n - k},

with 000^0 read as 11. Writing X=I1+⋯+InX = I_1 + \cdots + I_n with one indicator per trial, the mean npnp follows from linearity alone, while the variance np(1−p)np(1 - p) uses independence. Tail probabilities are finite sums, and the complement rule gives P(X≥k)=1−P(X≤k−1)P(X \ge k) = 1 - P(X \le k - 1). For Bin⁡(10,0.3)\operatorname{Bin}(10, 0.3), P(X=3)=120(0.3)3(0.7)7≈0.267P(X = 3) = 120(0.3)^3(0.7)^7 \approx 0.267.

Lessons The Bernoulli Distribution, The Binomial Distribution

Geometric and negative binomial distributions

With independent trials and success probability 0<p≤10 < p \le 1, let TT be the number of the trial on which the first success occurs. Then

P(T=k)=(1−p)k−1p,P(T>k)=(1−p)k,\begin{gathered} P(T = k) = (1 - p)^{k - 1} p, \\[0.4em] P(T > k) = (1 - p)^{k}, \end{gathered}

the first for every integer k≥1k \ge 1 and the second for every integer k≥0k \ge 0. For 0<p<10 < p < 1 the geometric distribution is memoryless, P(T>m+n∣T>m)=P(T>n)P(T > m + n \mid T > m) = P(T > n) for all integers m,n≥0m, n \ge 0. The number of failures before the first success is T−1T - 1, with mean (1−p)/p(1 - p)/p and the same variance, and some books call that variable geometric, so state the convention with every formula. With p=0.2p = 0.2, P(T>5)=0.85≈0.328P(T > 5) = 0.8^5 \approx 0.328 and E[T]=5E[T] = 5.

For a positive integer rr, let TT be the number of the trial on which success number rr occurs. For every integer k≥rk \ge r,

P(T=k)=(k−1r−1)pr(1−p)k−r,\begin{aligned} &P(T = k) \\[0.4em] &\quad = \binom{k - 1}{r - 1} p^{r} (1 - p)^{k - r}, \end{aligned}

because trial kk succeeds and the first k−1k - 1 trials hold exactly r−1r - 1 successes. This TT is a sum of rr independent geometric waits, which gives the mean and variance in the table of families. The rrth success has come by trial nn exactly when the first nn trials hold at least rr successes, so P(T≤n)=P(Xn≥r)P(T \le n) = P(X_n \ge r) with Xn∼Bin⁡(n,p)X_n \sim \operatorname{Bin}(n, p). With r=3r = 3 and p=0.5p = 0.5, P(T=5)=6/32=0.1875P(T = 5) = 6/32 = 0.1875.

Lessons The Geometric Distribution, The Negative Binomial Distribution

Hypergeometric distributions

Draw nn items uniformly without replacement from NN items of which KK are marked, where 0≤n≤N0 \le n \le N and 0≤K≤N0 \le K \le N. The number XX of marked items drawn has

P(X=x)=(Kx)(N−Kn−x)(Nn)P(X = x) = \frac{\binom{K}{x}\binom{N - K}{n - x}}{\binom{N}{n}}

for every integer xx with max⁡(0,n−N+K)≤x≤min⁡(n,K)\max(0, n - N + K) \le x \le \min(n, K), and probability 00 elsewhere. The draws are dependent, yet linearity still gives E[X]=nK/NE[X] = nK/N. The variance is the binomial variance with p=K/Np = K/N multiplied by the finite population correction (N−n)/(N−1)(N - n)/(N - 1). When nn is small compared with NN, the distribution is close to Bin⁡(n,K/N)\operatorname{Bin}(n, K/N). With N=20N = 20, K=5K = 5 and n=4n = 4, P(X=1)=455/969≈0.470P(X = 1) = 455/969 \approx 0.470, E[X]=1E[X] = 1 and Var⁡(X)=12/19≈0.632\operatorname{Var}(X) = 12/19 \approx 0.632.

Lessons Hypergeometric Distributions

Poisson distributions

For λ>0\lambda > 0, a variable X∼Pois⁡(λ)X \sim \operatorname{Pois}(\lambda) has

P(X=k)=e−λλkk!P(X = k) = \frac{e^{-\lambda}\lambda^{k}}{k!}

for k=0,1,2,…k = 0, 1, 2, \dots, and Pois⁡(0)\operatorname{Pois}(0) is the point mass at 00. The masses add to 11 because of the exponential series, and E[X]=Var⁡(X)=λE[X] = \operatorname{Var}(X) = \lambda. When λ\lambda is not an integer the most likely count is ⌊λ⌋\lfloor \lambda \rfloor, and when λ\lambda is a positive integer the counts λ−1\lambda - 1 and λ\lambda tie. Under a model with a constant rate rr per unit of exposure and a Poisson count, the count over an exposure tt is Pois⁡(rt)\operatorname{Pois}(rt), with rr and tt in matching units. With λ=2\lambda = 2, P(X=0)=e−2≈0.135P(X = 0) = e^{-2} \approx 0.135 and P(X≤2)=5e−2≈0.677P(X \le 2) = 5e^{-2} \approx 0.677.

For many trials with a small success probability, Bin⁡(n,p)\operatorname{Bin}(n, p) is close to Pois⁡(np)\operatorname{Pois}(np). If X∼Bin⁡(n,p)X \sim \operatorname{Bin}(n, p) and Y∼Pois⁡(np)Y \sim \operatorname{Pois}(np), Le Cam’s inequality gives ∣P(X∈A)−P(Y∈A)∣≤np2\lvert P(X \in A) - P(Y \in A) \rvert \le np^2 for every set AA of counts. For Bin⁡(1000,0.002)\operatorname{Bin}(1000, 0.002), P(X=0)=0.9981000≈0.13506P(X = 0) = 0.998^{1000} \approx 0.13506, while e−2≈0.13534e^{-2} \approx 0.13534, well within the bound 0.0040.004.

Lessons Poisson Distributions

Joint Discrete Laws and Conditional Averages

A joint distribution records how two variables occur together, and everything in this unit is computed from it. Margins forget how the values pair up, conditional distributions renormalize one row or column, and conditional means combine into the overall mean and variance.

The examples in this unit use the constructed joint table below.

Y=0Y = 0Y=1Y = 1Y=2Y = 2pX(x)p_X(x)
X=0X = 00.20.20.10.10.10.10.40.4
X=1X = 10.10.10.20.20.30.30.60.6
pY(y)p_Y(y)0.30.30.30.30.40.411

Joint and marginal distributions

The joint PMF of discrete XX and YY on the same sample space is pX,Y(x,y)=P(X=x,Y=y)p_{X,Y}(x, y) = P(X = x, Y = y). A table of numbers is a joint PMF exactly when no entry is negative and the entries add to 11. For a set BB of pairs, P((X,Y)∈B)P\bigl((X, Y) \in B\bigr) is the sum of the cells in BB. The marginal PMFs are the row and column totals,

pX(x)=∑ypX,Y(x,y),pY(y)=∑xpX,Y(x,y),\begin{aligned} p_X(x) &= \sum_{y} p_{X,Y}(x, y), \\[0.4em] p_Y(y) &= \sum_{x} p_{X,Y}(x, y), \end{aligned}

where each sum must include every value that can occur with the fixed one. The margins do not determine the joint table in general, because different tables can have the same totals. A function W=g(X,Y)W = g(X, Y) collects the cells with the same value of gg. In the table, P(X+Y=2)=0.1+0.2=0.3P(X + Y = 2) = 0.1 + 0.2 = 0.3.

Lessons Joint Probability Mass Functions, Marginal Probability Distributions

Conditional distributions

For a value xx with pX(x)>0p_X(x) > 0, the conditional PMF of YY given X=xX = x is

pY∣X(y∣x)=pX,Y(x,y)pX(x),p_{Y \mid X}(y \mid x) = \frac{p_{X,Y}(x, y)}{p_X(x)},

which divides row xx of the table by its total. It is a PMF in yy, and its mean is the conditional mean E[Y∣X=x]=∑yy pY∣X(y∣x)E[Y \mid X = x] = \sum_y y\,p_{Y \mid X}(y \mid x). In the other direction pX,Y(x,y)=pX(x) pY∣X(y∣x)p_{X,Y}(x, y) = p_X(x)\,p_{Y \mid X}(y \mid x), and adding over xx gives the law of total probability pY(y)=∑xpX(x) pY∣X(y∣x)p_Y(y) = \sum_x p_X(x)\,p_{Y \mid X}(y \mid x). Conditioning the other way round divides by a column total instead, and the two are linked by Bayes’ theorem. In the table, given X=1X = 1 the values 00, 11 and 22 of YY have probabilities 1/61/6, 1/31/3 and 1/21/2, so E[Y∣X=1]=4/3E[Y \mid X = 1] = 4/3, while E[Y∣X=0]=3/4E[Y \mid X = 0] = 3/4.

Lessons Conditional Probability Mass Functions

Independent random variables

Discrete XX and YY are independent exactly when

pX,Y(x,y)=pX(x) pY(y)p_{X,Y}(x, y) = p_X(x)\,p_Y(y)

for every pair (x,y)(x, y), which is equivalent to P(X∈A,Y∈B)=P(X∈A) P(Y∈B)P(X \in A, Y \in B) = P(X \in A)\,P(Y \in B) for all sets AA and BB. For variables of any type, independence means that the joint CDF FX,Y(a,b)=P(X≤a,Y≤b)F_{X,Y}(a, b) = P(X \le a, Y \le b) equals FX(a) FY(b)F_X(a)\,F_Y(b) for all real aa and bb. One cell where the product fails proves dependence, and a cell with mass 00 whose row and column totals are positive is such a cell. In the table pX,Y(0,0)=0.2p_{X,Y}(0, 0) = 0.2, while pX(0) pY(0)=0.12p_X(0)\,p_Y(0) = 0.12, so XX and YY are dependent. If XX and YY are independent, so are g(X)g(X) and h(Y)h(Y) for any functions gg and hh. Variables X1,…,XnX_1, \dots, X_n are mutually independent when their joint PMF is the product of all nn marginal PMFs, which is stronger than pairwise independence.

Lessons Independent Random Variables

Covariance and correlation

For XX and YY with finite second moments and means μX\mu_X and μY\mu_Y,

Cov⁡(X,Y)=E[(X−μX)(Y−μY)]=E[XY]−E[X] E[Y].\begin{aligned} &\operatorname{Cov}(X, Y) \\[0.4em] &= E[(X - \mu_X)(Y - \mu_Y)] \\[0.4em] &= E[XY] - E[X]\,E[Y]. \end{aligned}
  • Rules. The covariance satisfies Cov⁡(X,X)=Var⁡(X)\operatorname{Cov}(X, X) = \operatorname{Var}(X) and Cov⁡(aX+b,cY+d)=acCov⁡(X,Y)\operatorname{Cov}(aX + b, cY + d) = ac\operatorname{Cov}(X, Y) for constants aa, bb, cc and dd, it is 00 when one of the variables is constant, and it adds over sums in each argument.
  • Variance of a sum. For finitely many variables, Var⁡(X1+⋯+Xn)\operatorname{Var}(X_1 + \cdots + X_n) is the sum of the variances plus twice the sum of Cov⁡(Xi,Xj)\operatorname{Cov}(X_i, X_j) over all pairs i<ji < j. The variances add exactly when those covariances add to 00, for example when the variables are pairwise uncorrelated.
  • Correlation. When both variances are positive, ρ=Cov⁡(X,Y)/(SD⁡(X)SD⁡(Y))\rho = \operatorname{Cov}(X, Y)/\bigl(\operatorname{SD}(X)\operatorname{SD}(Y)\bigr) has no unit and lies in [−1,1][-1, 1] by the Cauchy-Schwarz inequality. It equals 11 or −1-1 exactly when Y=aX+bY = aX + b with probability 11 for constants a≠0a \ne 0 and bb, with the sign of aa.
  • Uncorrelated is weaker than independent. Independent variables with finite second moments have covariance 00, but the converse fails. If XX is uniform on {−1,0,1}\{-1, 0, 1\} and Y=X2Y = X^2, then Cov⁡(X,Y)=0\operatorname{Cov}(X, Y) = 0, although YY is a function of XX.

In the table E[XY]=0.8E[XY] = 0.8, E[X]=0.6E[X] = 0.6 and E[Y]=1.1E[Y] = 1.1, so Cov⁡(X,Y)=0.8−0.66=0.14\operatorname{Cov}(X, Y) = 0.8 - 0.66 = 0.14. With Var⁡(X)=0.24\operatorname{Var}(X) = 0.24 and Var⁡(Y)=0.69\operatorname{Var}(Y) = 0.69, the correlation is about 0.340.34.

Lessons Covariance, Correlation and Sums

Conditional expectation and total variance

The conditional mean function m(x)=E[Y∣X=x]m(x) = E[Y \mid X = x], defined where pX(x)>0p_X(x) > 0, turns into the random variable E[Y∣X]=m(X)E[Y \mid X] = m(X). If E[∣Y∣]<∞E\bigl[\lvert Y \rvert\bigr] < \infty, the law of total expectation, or tower rule, states

E[Y]=E[E[Y∣X]]=∑xpX(x) m(x).\begin{aligned} E[Y] &= E\bigl[E[Y \mid X]\bigr] \\[0.4em] &= \sum_{x} p_X(x)\,m(x). \end{aligned}

If E[Y2]<∞E[Y^2] < \infty, the law of total variance splits the variance into the variation within the groups and the variation between the group means,

Var⁡(Y)=E[Var⁡(Y∣X)]+Var⁡(E[Y∣X]),\begin{aligned} \operatorname{Var}(Y) &= E\bigl[\operatorname{Var}(Y \mid X)\bigr] \\[0.4em] &\quad + \operatorname{Var}\bigl(E[Y \mid X]\bigr), \end{aligned}

and m(X)m(X) is the best predictor of YY from XX in mean squared error. In the table, E[Y]=0.4⋅34+0.6⋅43=1.1E[Y] = 0.4 \cdot \tfrac34 + 0.6 \cdot \tfrac43 = 1.1. The within-group part is 73/120≈0.60873/120 \approx 0.608 and the between-group part is 49/600≈0.08249/600 \approx 0.082, which add to Var⁡(Y)=0.69\operatorname{Var}(Y) = 0.69.

Lessons Conditional Expectation and the Tower Rule, The Law of Total Variance

Random sums

Let X1,X2,…X_1, X_2, \dots have mean μ\mu, and let a count NN with values 0,1,2,…0, 1, 2, \dots be independent of the whole sequence. The random sum S=X1+⋯+XNS = X_1 + \cdots + X_N is 00 when N=0N = 0. Then

E[S]=E[N] μ,Var⁡(S)=E[N] σ2+Var⁡(N) μ2.\begin{aligned} E[S] &= E[N]\,\mu, \\[0.4em] \operatorname{Var}(S) &= E[N]\,\sigma^2 \\[0.4em] &\quad + \operatorname{Var}(N)\,\mu^2. \end{aligned}

The mean formula needs identically distributed terms with a finite mean and E[N]<∞E[N] < \infty. The variance formula needs IID terms with finite variance σ2\sigma^2 and E[N2]<∞E[N^2] < \infty, and it follows from the law of total variance with NN as the group label. If the number of claims is N∼Pois⁡(4)N \sim \operatorname{Pois}(4) and each claim has mean 22 and variance 11, the total has mean 88 and variance 4⋅1+4⋅4=204 \cdot 1 + 4 \cdot 4 = 20.

Lessons Random Sums with Independent Counts

Repeated Sampling and the Discrete Law of Large Numbers

An average of many independent draws from one distribution is likely to land near the mean. Chebyshev’s inequality turns the variance σ2/n\sigma^2/n of the average into a bound on the probability of a miss, which proves a law of large numbers and also measures the error of a simulation.

Mean and variance of the sample mean

If every XiX_i has the same mean μ\mu, then E[Xˉn]=μE[\bar{X}_n] = \mu, so the sample mean is unbiased, with or without independence. With finite variances, Var⁡(Xˉn)=Var⁡(Sn)/n2\operatorname{Var}(\bar{X}_n) = \operatorname{Var}(S_n)/n^2, where

Var⁡(Sn)=∑i=1nVar⁡(Xi)+2∑i<jCov⁡(Xi,Xj).\begin{aligned} \operatorname{Var}(S_n) &= \sum_{i=1}^{n} \operatorname{Var}(X_i) \\[0.4em] &\quad + 2\sum_{i < j} \operatorname{Cov}(X_i, X_j). \end{aligned}

For uncorrelated observations with a common variance σ2\sigma^2, in particular IID ones, Var⁡(Xˉn)=σ2/n\operatorname{Var}(\bar{X}_n) = \sigma^2/n and the standard error of the mean is σ/n\sigma/\sqrt{n}. Dividing the standard error by kk takes k2k^2 times as many observations, and the standard error is at most s>0s > 0 exactly when n≥σ2/s2n \ge \sigma^2/s^2. With σ=10\sigma = 10, a sample of 100100 gives a standard error of 11, and halving it takes 400400 observations.

Lessons Mean and Variance of the Sample Mean

Markov and Chebyshev inequalities

InequalityStatementConditions
MarkovP(X≥a)≤E[X]aP(X \ge a) \le \dfrac{E[X]}{a}X≥0X \ge 0 with probability 11, finite mean, a>0a > 0
ChebyshevP(∣X−μ∣≥d)≤σ2d2P(\lvert X - \mu \rvert \ge d) \le \dfrac{\sigma^2}{d^2}finite mean μ\mu and variance σ2\sigma^2, d>0d > 0
Chebyshev in standard deviationsP(∣X−μ∣≥kσ)≤1k2P(\lvert X - \mu \rvert \ge k\sigma) \le \dfrac{1}{k^2}0<σ<∞0 < \sigma < \infty, k>0k > 0

Chebyshev’s inequality is Markov’s inequality applied to (X−μ)2(X - \mu)^2 with threshold d2d^2. Both bounds hold for every distribution with the stated information, and both are sharp, since whenever a bound is at most 11 some distribution attains it. A bound of 11 or more says nothing, so the last form is informative only for k>1k > 1. It guarantees that at least 1−1/k21 - 1/k^2 of the probability lies strictly within kk standard deviations of the mean, at least 0.750.75 for k=2k = 2, where a normal distribution has about 0.9540.954.

Lessons Markov and Chebyshev Inequalities

The weak law of large numbers

A sequence YnY_n converges in probability to a constant cc when P(∣Yn−c∣≥ε)→0P(\lvert Y_n - c \rvert \ge \varepsilon) \to 0 for every ε>0\varepsilon > 0. If X1,X2,…X_1, X_2, \dots are IID with mean μ\mu and finite variance σ2\sigma^2, Chebyshev’s inequality gives, for every ε>0\varepsilon > 0 and every n≥1n \ge 1,

P(∣Xˉn−μ∣≥ε)≤σ2nε2,P\bigl(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon\bigr) \le \frac{\sigma^2}{n\varepsilon^2},

so Xˉn\bar{X}_n converges in probability to μ\mu. The bound is at most δ\delta when n≥σ2/(δε2)n \ge \sigma^2/(\delta\varepsilon^2), a sufficient sample size that can be much larger than necessary. For the relative frequency of an event with probability pp, the variance is p(1−p)≤1/4p(1 - p) \le 1/4, so n≥1/(4δε2)n \ge 1/(4\delta\varepsilon^2) works for every pp, which is 20002000 for ε=δ=0.05\varepsilon = \delta = 0.05. The law also holds for IID variables with a finite mean and infinite variance, with a different proof. It is a statement about probabilities at each nn. At a fixed nn with σ2>0\sigma^2 > 0 the average differs from μ\mu with positive probability, and nothing makes one observed run approach μ\mu step by step.

Lessons Law of Large Numbers for Discrete Variables

Streaks and the gambler’s fallacy

For independent trials with a known success probability pp, where Xi=1X_i = 1 records a success on trial ii, every record HH of the first nn trials with P(H)>0P(H) > 0 leaves P(Xn+1=1∣H)=pP(X_{n+1} = 1 \mid H) = p. The gambler’s fallacy is the belief that a streak makes the opposite outcome more likely. The law of large numbers does not work by compensation. After kk successes in nn trials, the expected excess of successes over pp times the number of trials stays k−npk - np however many further trials follow, while the expected proportion after mm further trials is

k+mpn+m=p+k−npn+m,\frac{k + mp}{n + m} = p + \frac{k - np}{n + m},

which tends to pp because the early excess is diluted. A run of 1010 heads on tosses chosen in advance has probability 2−10≈0.0012^{-10} \approx 0.001 for a fair coin, but a run of at least 1010 heads somewhere in 10001000 tosses has probability about 0.390.39. When pp is unknown, a long record is evidence about pp, and updating with Bayes’ theorem is learning, not the fallacy.

Lessons Streaks and the Gambler’s Fallacy

Simulation error

For nn independent simulated trials of an event with probability pp, the estimate p^n=Sn/n\hat{p}_n = S_n/n has E[p^n]=pE[\hat{p}_n] = p and standard error

SE⁡(p^n)=p(1−p)n≤12n.\operatorname{SE}(\hat{p}_n) = \sqrt{\frac{p(1 - p)}{n}} \le \frac{1}{2\sqrt{n}}.

Multiplying nn by 44 halves the standard error, and 1000010000 trials give a standard error of at most 0.0050.005. The plug-in standard error puts p^n\hat{p}_n in place of pp, so it is itself random, and it is 00 whenever all trials agree. A standard error is not a largest possible error. Chebyshev’s inequality gives the guarantee P(∣p^n−p∣≥ε)≤p(1−p)/(nε2)P(\lvert \hat{p}_n - p \rvert \ge \varepsilon) \le p(1 - p)/(n\varepsilon^2) for every ε>0\varepsilon > 0. A replication is a new run with independent random inputs, while rerunning with the same seed only reproduces the same numbers. Model error and implementation error do not shrink as nn grows.

To study a statistic, repeat the whole sampling procedure RR times and compare the empirical distribution of the RR values with exact benchmarks such as Var⁡(Xˉn)=σ2/n\operatorname{Var}(\bar{X}_n) = \sigma^2/n. The sample size nn decides which distribution is studied, and the number of replications RR decides how precisely it is estimated. A probability qq estimated from RR independent replications has standard error q(1−q)/R\sqrt{q(1 - q)/R}, and an empirical variance should say whether it divides by RR or by R−1R - 1.

Lessons Simulation Error and Number of Trials, A Repeated-Sampling Investigation

Continuous Probability and Its Mathematical Tools

A continuous random variable spreads probability over intervals rather than single values. Probabilities become areas under a density, the CDF accumulates that area, and where the density is continuous the derivative of the CDF gives the density back.

Integrals and area

For ff on [a,b][a, b] with a<ba < b, split [a,b][a, b] into pieces of widths Δxi\Delta x_i and pick a point xi∗x_i^{*} in each. The definite integral is the limit of the Riemann sums ∑if(xi∗) Δxi\sum_i f(x_i^{*})\,\Delta x_i as the widest piece shrinks to 00, when that limit is the same whatever points are chosen. The limit exists when ff is continuous on [a,b][a, b], and also when ff is bounded with finitely many jumps. For f≥0f \ge 0 it is the area under the graph.

RuleFormulaCondition
Power rule∫abxk dx=bk+1−ak+1k+1\displaystyle\int_a^b x^k\,dx = \frac{b^{k+1} - a^{k+1}}{k + 1}integer k≥0k \ge 0
Constant multiple∫abcf(x) dx=c∫abf(x) dx\displaystyle\int_a^b c f(x)\,dx = c\int_a^b f(x)\,dxff integrable
Sum∫ab(f+g) dx=∫abf dx+∫abg dx\displaystyle\int_a^b (f + g)\,dx = \int_a^b f\,dx + \int_a^b g\,dxff and gg integrable
Adjacent intervals∫acf dx=∫abf dx+∫bcf dx\displaystyle\int_a^c f\,dx = \int_a^b f\,dx + \int_b^c f\,dxa<b<ca < b < c

For a nonnegative, nondecreasing ff the left Riemann sum is at most the area and the right sum is at least the area. For example ∫012x dx=1\int_0^1 2x\,dx = 1.

Lessons Integrals and Probability as Area

Derivatives and the density-CDF connection

The derivative of FF at xx is

F′(x)=lim⁡h→0F(x+h)−F(x)h\begin{aligned} &F'(x) \\[0.4em] &\quad = \lim_{h \to 0} \frac{F(x + h) - F(x)}{h} \end{aligned}

when the limit exists, the slope of the tangent line. For a positive integer nn the derivative of xnx^n is nxn−1nx^{n-1}, a constant has derivative 00, and derivatives respect sums and constant multiples. Let ff be continuous on [a,b][a, b]. The fundamental theorem of calculus says that G(x)=∫axf(t) dtG(x) = \int_a^x f(t)\,dt has G′(x)=f(x)G'(x) = f(x) for a<x<ba < x < b, and that if GG is continuous on [a,b][a, b] with G′=fG' = f on (a,b)(a, b), then ∫abf(x) dx=G(b)−G(a)\int_a^b f(x)\,dx = G(b) - G(a).

For a CDF with a density this gives F′(x)=f(x)F'(x) = f(x) at every xx where ff is continuous. Conversely, if FF is continuous and, outside finitely many points, differentiable with a continuous derivative, then f=F′f = F' is a density, with any nonnegative values at the exceptional points. A CDF with a jump has no density, and continuity of FF alone is not enough either.

Lessons Derivatives and the Density-CDF Connection

Densities and CDFs

A density is a function f≥0f \ge 0 with total integral 11, and XX has density ff when P(a<X≤b)=∫abf(x) dxP(a < X \le b) = \int_a^b f(x)\,dx for all a<ba < b. Then

F(x)=∫−∞xf(t) dtF(x) = \int_{-\infty}^{x} f(t)\,dt

is continuous, and P(a<X≤b)=F(b)−F(a)P(a < X \le b) = F(b) - F(a).

  • Single values. Every single value has P(X=c)=0P(X = c) = 0, so including or excluding endpoints never changes a probability. Probability 00 does not mean impossible.
  • Density values. A density value is probability per unit of xx, not a probability, and it can be larger than 11. Only the area over an interval is a probability.
  • Normalizing. If g≥0g \ge 0 has finite positive total area AA, then g/Ag/A is a density.
  • Change of units. For Y=α+cXY = \alpha + cX with c>0c > 0, the density is fY(y)=1c fX((y−α)/c)f_Y(y) = \tfrac{1}{c}\,f_X\bigl((y - \alpha)/c\bigr).

The density f(x)=2xf(x) = 2x on [0,1][0, 1], and 00 elsewhere, has F(x)=x2F(x) = x^2 for 0≤x≤10 \le x \le 1, so P(X>0.5)=0.75P(X > 0.5) = 0.75, and its value f(1)=2f(1) = 2 is larger than 11. The function x(1−x)x(1 - x) on [0,1][0, 1] has area 1/61/6, so 6x(1−x)6x(1 - x) is a density there.

Lessons Probability Densities and CDFs

Point masses and mixed distributions

A value aa with P(X=a)>0P(X = a) > 0 is an atom, or point mass, and its mass equals the jump F(a)−F(a−)F(a) - F(a^-) of the CDF. A distribution has at most countably many atoms. A mixed distribution in the sense of this course has atoms aia_i with masses mim_i of total MM, where 0<M<10 < M < 1, and a continuous part h≥0h \ge 0 with area 1−M1 - M, so that for c<dc < d

P(c<X≤d)=∑c<ai≤dmi+∫cdh(x) dx.\begin{aligned} &P(c < X \le d) \\[0.4em] &\quad = \sum_{c < a_i \le d} m_i + \int_c^d h(x)\,dx . \end{aligned}

A mixed variable has no density, and the endpoints of an event matter again at the atoms, as in P(a≤X≤b)=F(b)−F(a−)P(a \le X \le b) = F(b) - F(a^-). An event of probability 00 need not be empty, and an event of probability 11 is said to happen almost surely. If X=0X = 0 with probability 0.40.4 and otherwise XX is uniform on (0,2)(0, 2), then h=0.3h = 0.3 on (0,2)(0, 2), F(0−)=0F(0^-) = 0, F(0)=0.4F(0) = 0.4 and P(X≤1)=0.7P(X \le 1) = 0.7.

Lessons Point Probabilities and Mixed Distributions

Continuous expectation and variance

All integrals here run over the whole real line.

QuantityFormulaFinite when
MeanE[X]=∫xf(x) dxE[X] = \displaystyle\int x f(x)\,dx∫∣x∣f(x) dx<∞\displaystyle\int \lvert x \rvert f(x)\,dx < \infty
Function of XXE[g(X)]=∫g(x)f(x) dxE[g(X)] = \displaystyle\int g(x) f(x)\,dx∫∣g(x)∣f(x) dx<∞\displaystyle\int \lvert g(x) \rvert f(x)\,dx < \infty
VarianceVar⁡(X)=E[X2]−μ2\operatorname{Var}(X) = E[X^2] - \mu^2E[X2]<∞E[X^2] < \infty
Mixed distributionE[g(X)]=∑ig(ai) mi+∫g(x)h(x) dxE[g(X)] = \displaystyle\sum_i g(a_i)\,m_i + \int g(x) h(x)\,dxboth parts converge absolutely

The second row is the law of the unconscious statistician, and the variance also equals ∫(x−μ)2f(x) dx\int (x - \mu)^2 f(x)\,dx. A density that is 00 outside a bounded interval has finite moments of every order. A nonnegative variable can have an infinite mean, as the density 1/x21/x^2 on [1,∞)[1, \infty) does, and the mean is undefined when the positive and the negative parts are both infinite. The density 2x2x on [0,1][0, 1] has E[X]=2/3E[X] = 2/3, E[X2]=1/2E[X^2] = 1/2 and Var⁡(X)=1/18\operatorname{Var}(X) = 1/18. The mixed example above has E[X]=0.4⋅0+0.6⋅1=0.6E[X] = 0.4 \cdot 0 + 0.6 \cdot 1 = 0.6.

Lessons Continuous Expectation and Variance

Uniform distributions

For a<ba < b, a variable X∼Uniform⁡(a,b)X \sim \operatorname{Uniform}(a, b) has density 1/(b−a)1/(b - a) on (a,b)(a, b) and 00 elsewhere, and for a≤x≤ba \le x \le b

F(x)=x−ab−a.F(x) = \frac{x - a}{b - a}.

For a≤c<d≤ba \le c < d \le b, P(c<X<d)=(d−c)/(b−a)P(c < X < d) = (d - c)/(b - a), with either endpoint included or not. The mean is (a+b)/2(a + b)/2 and the variance is (b−a)2/12(b - a)^2/12. Given that XX lies in a subinterval, XX is uniform on that subinterval. A constant density needs a bounded interval, so no uniform distribution exists on the whole line or on [0,∞)[0, \infty).

For 0<p<10 < p < 1, the pp-quantile of any XX is the smallest qq with F(q)≥pF(q) \ge p, also called the 100p100pth percentile. A median is a number mm with P(X≤m)≥1/2P(X \le m) \ge 1/2 and P(X≥m)≥1/2P(X \ge m) \ge 1/2. For Uniform⁡(a,b)\operatorname{Uniform}(a, b) the pp-quantile is a+p(b−a)a + p(b - a) and the median is the midpoint. For Uniform⁡(2,10)\operatorname{Uniform}(2, 10) the mean is 66, the variance is 64/12=16/364/12 = 16/3 and the 0.250.25-quantile is 44.

Lessons Uniform Distributions

Exponential and Normal Models

Waiting times are often modeled by exponential distributions and measurement errors by normal ones. The exponential distribution has no memory, and every normal probability or quantile reduces to the standard normal CDF Φ\Phi.

Exponential distributions

For a rate λ>0\lambda > 0, a variable T∼Exp⁡(λ)T \sim \operatorname{Exp}(\lambda) has density

f(t)=λe−λtfor t≥0f(t) = \lambda e^{-\lambda t} \quad \text{for } t \ge 0

and f(t)=0f(t) = 0 for t<0t < 0.

QuantityValue
Survival probability P(T>t)P(T > t), for t≥0t \ge 0e−λte^{-\lambda t}
CDF F(t)F(t), for t≥0t \ge 01−e−λt1 - e^{-\lambda t}
Mean and standard deviation1/λ1/\lambda
Variance1/λ21/\lambda^2
pp-quantile, for 0<p<10 < p < 1−ln⁡(1−p)/λ-\ln(1 - p)/\lambda
Median(ln⁡2)/λ(\ln 2)/\lambda

The rate is measured per unit of time, so λt\lambda t has no unit, and the mean 1/λ1/\lambda is a time. Some books use the scale θ=1/λ\theta = 1/\lambda instead. The exponential distribution is memoryless, since for all s,t≥0s, t \ge 0

P(T>s+t∣T>s)=P(T>t)=e−λt,\begin{aligned} &P(T > s + t \mid T > s) \\[0.4em] &\quad = P(T > t) = e^{-\lambda t}, \end{aligned}

and among nonnegative variables with a density it is the only memoryless one. With λ=0.5\lambda = 0.5 per minute, the mean wait is 22 minutes, P(T>3)=e−1.5≈0.223P(T > 3) = e^{-1.5} \approx 0.223 and the median is 2ln⁡2≈1.392\ln 2 \approx 1.39 minutes.

Lessons Exponential Distributions

The normal distribution

For a real μ\mu and σ>0\sigma > 0, a variable X∼N(μ,σ2)X \sim N(\mu, \sigma^2) has density

f(x)=1σ2π e−(x−μ)2/(2σ2)f(x) = \frac{1}{\sigma\sqrt{2\pi}}\, e^{-(x - \mu)^2/(2\sigma^2)}

for every real xx, mean μ\mu, variance σ2\sigma^2 and standard deviation σ\sigma. The density is symmetric about μ\mu, highest there and has inflection points at μ±σ\mu \pm \sigma. Standardizing gives Z=(X−μ)/σ∼N(0,1)Z = (X - \mu)/\sigma \sim N(0, 1), and conversely μ+σZ∼N(μ,σ2)\mu + \sigma Z \sim N(\mu, \sigma^2). More generally aX+b∼N(aμ+b,a2σ2)aX + b \sim N(a\mu + b, a^2\sigma^2) for constants a≠0a \ne 0 and bb. The standard normal CDF Φ(z)=P(Z≤z)\Phi(z) = P(Z \le z) has no elementary formula, satisfies Φ(−z)=1−Φ(z)\Phi(-z) = 1 - \Phi(z) and has Φ(0)=0.5\Phi(0) = 0.5.

For every normal distribution and k>0k > 0, P(∣X−μ∣<kσ)=2Φ(k)−1P(\lvert X - \mu \rvert < k\sigma) = 2\Phi(k) - 1, which is about 0.68270.6827, 0.95450.9545 and 0.99730.9973 for k=1k = 1, 22 and 33. These values are facts about normal distributions only. For other distributions with finite variance, Chebyshev’s inequality guarantees only that this probability is at least 1−1/k21 - 1/k^2.

Lessons The Normal Distribution

Normal probabilities and quantiles

For X∼N(μ,σ2)X \sim N(\mu, \sigma^2) and a<ba < b,

P(a<X<b)=Φ(b−μσ)−Φ(a−μσ),\begin{aligned} P(a < X < b) &= \Phi\Bigl(\frac{b - \mu}{\sigma}\Bigr) \\[0.4em] &\quad - \Phi\Bigl(\frac{a - \mu}{\sigma}\Bigr), \end{aligned}

with the same value when either inequality is not strict. For a threshold cc with z-score z=(c−μ)/σz = (c - \mu)/\sigma, the upper tail is P(X>c)=1−Φ(z)=Φ(−z)P(X > c) = 1 - \Phi(z) = \Phi(-z). For 0<p<10 < p < 1 the pp-quantile is qp=μ+σzpq_p = \mu + \sigma z_p, where zp=Φ−1(p)z_p = \Phi^{-1}(p) and z1−p=−zpz_{1-p} = -z_p. For 0<c<10 < c < 1, the central interval with probability cc is μ±σz(1+c)/2\mu \pm \sigma z_{(1+c)/2}.

zz00111.51.5222.52.533
Φ(z)\Phi(z)0.50.50.84130.84130.93320.93320.97720.97720.99380.99380.99870.9987
pp0.900.900.950.950.9750.9750.990.990.9950.995
zpz_p1.28161.28161.64491.64491.96001.96002.32632.32632.57582.5758

For X∼N(100,152)X \sim N(100, 15^2), P(X>130)=1−Φ(2)≈0.0228P(X > 130) = 1 - \Phi(2) \approx 0.0228, and the 9090th percentile is 100+15(1.2816)≈119.2100 + 15(1.2816) \approx 119.2.

Lessons Normal Probabilities and Quantiles

Choosing a continuous model

ModelValuesWhat it assumesTails
Uniform⁡(a,b)\operatorname{Uniform}(a, b)[a,b][a, b]subintervals of equal length are equally likelynone outside [a,b][a, b]
Exp⁡(λ)\operatorname{Exp}(\lambda)[0,∞)[0, \infty)a waiting time with no memoryP(T>t)=e−λtP(T > t) = e^{-\lambda t}
N(μ,σ2)N(\mu, \sigma^2)every real numbersymmetric variation around μ\muvery thin, P(∣X−μ∣>3σ)≈0.0027P(\lvert X - \mu \rvert > 3\sigma) \approx 0.0027

State the parameter convention with every model, because other books write the exponential distribution with its mean and the normal distribution with its standard deviation. Multiplying by a constant c>0c > 0, as in a change of units, gives

cU∼Uniform⁡(ca,cb),cT∼Exp⁡(λ/c),cX∼N(cμ,c2σ2)\begin{gathered} cU \sim \operatorname{Uniform}(ca, cb), \\[0.4em] cT \sim \operatorname{Exp}(\lambda/c), \\[0.4em] cX \sim N(c\mu, c^2\sigma^2) \end{gathered}

for U∼Uniform⁡(a,b)U \sim \operatorname{Uniform}(a, b), T∼Exp⁡(λ)T \sim \operatorname{Exp}(\lambda) and X∼N(μ,σ2)X \sim N(\mu, \sigma^2). Judge a model by its support, its mechanism and its tails, and check the probabilities that a decision depends on, rather than the look of a curve. Models that agree near the center can differ greatly in the tails.

Lessons Choosing a Continuous Probability Model

Transformations, Approximations and Monte Carlo

The distribution of a function of a random variable follows from its CDF, and uniform random numbers can be turned into draws from any distribution. The central limit theorem explains why sums and averages are approximately normal, and every exact, approximate or simulated answer carries its own kind of error.

The CDF method and inverse-CDF sampling

For Y=g(X)Y = g(X), the CDF method computes

FY(y)=P(g(X)≤y)=P(X∈{x:g(x)≤y})\begin{aligned} F_Y(y) &= P(g(X) \le y) \\[0.4em] &= P\bigl(X \in \{x : g(x) \le y\}\bigr) \end{aligned}

for every real yy. Find the values that YY can take, solve g(x)≤yg(x) \le y on every branch, compute the probability, and differentiate FYF_Y when a density is wanted.

  • Increasing maps. For a continuous, strictly increasing gg, FY(g(x))=FX(x)F_Y(g(x)) = F_X(x). For a strictly decreasing one, FY(g(x))=P(X≥x)F_Y(g(x)) = P(X \ge x).
  • Squares. For a continuous XX and y≥0y \ge 0, P(X2≤y)=FX(y)−FX(−y)P(X^2 \le y) = F_X(\sqrt{y}) - F_X(-\sqrt{y}).
  • Unbounded densities. For X∼Uniform⁡(0,1)X \sim \operatorname{Uniform}(0, 1), the square Y=X2Y = X^2 has FY(y)=yF_Y(y) = \sqrt{y} and density 1/(2y)1/(2\sqrt{y}) on (0,1)(0, 1), which is unbounded and still a valid density.

For any CDF FF, the generalized quantile is Q(u)=inf⁡{x:F(x)≥u}Q(u) = \inf\{x : F(x) \ge u\} for 0<u<10 < u < 1. If U∼Uniform⁡(0,1)U \sim \operatorname{Uniform}(0, 1), then Q(U)Q(U) has CDF FF, which is inverse-CDF sampling, and Q=F−1Q = F^{-1} when FF is continuous and strictly increasing. For Exp⁡(λ)\operatorname{Exp}(\lambda) this gives X=−ln⁡(1−U)/λX = -\ln(1 - U)/\lambda. In the other direction F(X)∼Uniform⁡(0,1)F(X) \sim \operatorname{Uniform}(0, 1) when FF is continuous, but not for discrete distributions.

Lessons Transformations and Inverse-CDF Sampling

The law of large numbers for continuous variables

The Chebyshev bound P(∣Xˉn−μ∣≥ε)≤σ2/(nε2)P(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon) \le \sigma^2/(n\varepsilon^2) uses only the mean, the variance and independence, so the weak law holds for every IID sequence with finite variance, discrete or continuous. For Uniform⁡(0,1)\operatorname{Uniform}(0, 1) observations, σ2=1/12\sigma^2 = 1/12, and a miss of at least 0.050.05 has probability at most 0.050.05 once n≥667n \ge 667. The bound is conservative, and for this model the actual probability is far smaller. Independence matters. If every observation equals the same variable ZZ, then Xˉn=Z\bar{X}_n = Z for every nn and averaging does not concentrate anything. A running average plotted against nn is one path, not a picture of the sampling distribution.

Lessons The Law of Large Numbers for Continuous Variables

The central limit theorem

Let X1,X2,…X_1, X_2, \dots be IID with mean μ\mu and variance 0<σ2<∞0 < \sigma^2 < \infty. Then for every real zz

P(Sn−nμσn≤z)→Φ(z)as n→∞,\begin{aligned} &P\Bigl(\frac{S_n - n\mu}{\sigma\sqrt{n}} \le z\Bigr) \\[0.4em] &\quad \to \Phi(z) \quad \text{as } n \to \infty, \end{aligned}

that is, the standardized sum converges in distribution to N(0,1)N(0, 1). It equals the standardized mean (Xˉn−μ)/(σ/n)(\bar{X}_n - \mu)/(\sigma/\sqrt{n}). For large nn this justifies

Xˉn≈N(μ,σ2n),Sn≈N(nμ,nσ2),\begin{gathered} \bar{X}_n \approx N\Bigl(\mu, \frac{\sigma^2}{n}\Bigr), \\[0.4em] S_n \approx N(n\mu, n\sigma^2), \end{gathered}

but the theorem gives no bound on the error at any fixed nn. If the observations are themselves normal, these laws are exact for every nn. With infinite variance the theorem does not apply, and the average of nn IID standard Cauchy variables is again standard Cauchy for every nn. For 3636 observations with μ=50\mu = 50 and σ=12\sigma = 12, the standard error is 22 and P(Xˉ>53)≈1−Φ(1.5)≈0.067P(\bar{X} > 53) \approx 1 - \Phi(1.5) \approx 0.067.

Lessons The Central Limit Theorem

Poisson and normal approximations

Approximation of Bin⁡(n,p)\operatorname{Bin}(n, p)Use it whenError control
Pois⁡(np)\operatorname{Pois}(np)nn is large and pp is small∣P(X∈A)−P(Y∈A)∣≤np2\lvert P(X \in A) - P(Y \in A) \rvert \le np^2 for every set AA
N(np,np(1−p))N\bigl(np, np(1 - p)\bigr) with continuity correctionnpnp and n(1−p)n(1 - p) are both largenone from the theorem at a fixed nn, and rules such as np≥10np \ge 10 and n(1−p)≥10n(1 - p) \ge 10 are rough guides

The continuity correction lets each integer kk stand for the interval from k−12k - \tfrac12 to k+12k + \tfrac12. For integers a≤ba \le b it approximates P(a≤X≤b)P(a \le X \le b) by P(a−12<Y<b+12)P(a - \tfrac12 < Y < b + \tfrac12) for the normal YY with the same mean and variance. Rewrite strict inequalities first, so X>13X > 13 becomes X≥14X \ge 14 and then Y>13.5Y > 13.5.

The absolute error of an approximation aa to an exact probability p∗>0p_* > 0 is ∣a−p∗∣\lvert a - p_* \rvert, and its relative error is ∣a−p∗∣/p∗\lvert a - p_* \rvert / p_*, the right measure for small tail probabilities. For X∼Bin⁡(100,0.5)X \sim \operatorname{Bin}(100, 0.5), the exact P(X≥60)≈0.02844P(X \ge 60) \approx 0.02844. The corrected normal value 1−Φ(1.9)≈0.028721 - \Phi(1.9) \approx 0.02872 is off by about 11 percent, and the uncorrected 1−Φ(2)≈0.022751 - \Phi(2) \approx 0.02275 by about 2020 percent.

Lessons Poisson and Normal Approximations

Monte Carlo estimation

To estimate θ=E[g(X)]\theta = E[g(X)] with E[∣g(X)∣]<∞E\bigl[\lvert g(X) \rvert\bigr] < \infty, draw X1,…,XnX_1, \dots, X_n independently from the model and average,

θ^n=1n∑i=1ng(Xi).\hat{\theta}_n = \frac{1}{n} \sum_{i=1}^{n} g(X_i).

The estimator is unbiased, and it converges in probability to θ\theta. A probability is the expectation of an indicator, so its estimate is the fraction of draws in which the event occurs. If σ2=Var⁡(g(X))\sigma^2 = \operatorname{Var}\bigl(g(X)\bigr) is finite, the standard error is σ/n\sigma/\sqrt{n}, and in practice σ\sigma is estimated by the sample standard deviation of the values g(Xi)g(X_i). Halving the standard error takes four times as many draws, and the standard error is at most s>0s > 0 when n≥σ2/s2n \ge \sigma^2/s^2.

For large nn the central limit theorem motivates the approximate 9595 percent interval θ^n±1.96 σ/n\hat{\theta}_n \pm 1.96\,\sigma/\sqrt{n}, whose coverage is not guaranteed at a fixed nn. When σ>0\sigma > 0, Chebyshev’s inequality guarantees P(∣θ^n−θ∣≥kσ/n)≤1/k2P\bigl(\lvert \hat{\theta}_n - \theta \rvert \ge k\sigma/\sqrt{n}\bigr) \le 1/k^2 for every nn and every k>0k > 0. Estimating π/4≈0.785\pi/4 \approx 0.785 as the fraction of uniform points in the unit square that land in the quarter disk, 1000010000 points give a standard error of about 0.00410.0041. Record the generator, the seed and nn so that a run can be reproduced.

Lessons Monte Carlo Probability and Expectation

Exact, approximate or simulated answers

Every reported number carries some kind of error, and each kind means something different. Here p∗p_* is the exact probability in the model.

ErrorWhere it comes fromWhat is known about it
Roundingwriting a decimalat most half a unit in the last digit shown
Approximationreplacing the model by a simpler law, value a−p∗a - p_*one fixed number for the given model, event and method, known only when checked or bounded
Simulationfinitely many runs, value p^−p∗\hat{p} - p_*random, with mean 00 and standard error p∗(1−p∗)/n\sqrt{p_*(1 - p_*)/n} for nn independent runs
Model and inputsassumptions or inputs that differ from the real processnot reduced by any calculation inside the model

Use the exact answer when it can be computed. Use an approximation when the exact answer is impractical and the approximation can be checked for the event in question. Use simulation when the model is easy to simulate and hard to calculate, and report its standard error. Recomputing the target over the plausible range of each uncertain input shows how much the conclusion depends on it.

Lessons Choosing Exact, Approximate or Simulated Answers

Random Processes and Introductory Markov Chains

A random process is a family of random variables indexed by time. Bernoulli processes and random walks are built from independent steps, a Poisson process counts arrivals in continuous time, and a Markov chain moves between states by a transition matrix whose powers give probabilities several steps ahead.

Bernoulli processes and random walks

A Bernoulli process is a sequence X1,X2,…X_1, X_2, \dots of independent Bernoulli⁡(p)\operatorname{Bernoulli}(p) trials with 0<p<10 < p < 1. The count Cn=X1+⋯+XnC_n = X_1 + \cdots + X_n is Bin⁡(n,p)\operatorname{Bin}(n, p), and the first success time TT is geometric, with {T>n}={Cn=0}\{T > n\} = \{C_n = 0\} and so P(T>n)=(1−p)nP(T > n) = (1 - p)^n. Counts over disjoint blocks of trials are independent, while the cumulative counts are dependent, with Cov⁡(Cm,Cn)=mp(1−p)>0\operatorname{Cov}(C_m, C_n) = mp(1 - p) > 0 for 1≤m≤n1 \le m \le n.

A simple random walk starts at a fixed integer S0S_0 and moves by independent steps ZiZ_i equal to 11 with probability pp and −1-1 with probability 1−p1 - p, so Sn=S0+Z1+⋯+ZnS_n = S_0 + Z_1 + \cdots + Z_n. For S0=0S_0 = 0 and K∼Bin⁡(n,p)K \sim \operatorname{Bin}(n, p) steps to the right, Sn=2K−nS_n = 2K - n.

Quantity, for S0=0S_0 = 0Value
P(Sn=2k−n)P(S_n = 2k - n), for k=0,…,nk = 0, \dots, n(nk)pk(1−p)n−k\dbinom{n}{k} p^k (1 - p)^{n - k}
Possible positions−n,−n+2,…,n−2,n-n, -n + 2, \dots, n - 2, n
Drift E[Zi]E[Z_i]2p−12p - 1
Mean E[Sn]E[S_n]n(2p−1)n(2p - 1)
Variance Var⁡(Sn)\operatorname{Var}(S_n)4np(1−p)4np(1 - p)

A path with rr steps to the right has probability pr(1−p)n−rp^r (1 - p)^{n - r}. For the symmetric walk, with p=1/2p = 1/2, P(S4=0)=6/16=0.375P(S_4 = 0) = 6/16 = 0.375. Visiting a position at some time up to nn is a different event from ending there at time nn.

Lessons Bernoulli Processes, Simple Random Walks

Poisson processes

A counting process N(t)N(t) counts the arrivals in (0,t](0, t]. It is a homogeneous Poisson process with rate λ>0\lambda > 0 when

  1. it starts at N(0)=0N(0) = 0,
  2. the count in every interval (s,s+t](s, s + t] is Pois⁡(λt)\operatorname{Pois}(\lambda t), which makes the increments stationary, and
  3. the counts in disjoint intervals are independent, which makes the increments independent.

A Poisson count in one interval does not by itself make a Poisson process, because the third condition is part of the definition. The rate is the expected number of arrivals per unit time, E[N(t)]=λtE[N(t)] = \lambda t. At least one arrival in an interval of length tt has probability 1−e−λt1 - e^{-\lambda t}, which is less than λt\lambda t for t>0t > 0. Overlapping counts are dependent, with Cov⁡(N(s),N(t))=λs>0\operatorname{Cov}\bigl(N(s), N(t)\bigr) = \lambda s > 0 for 0<s≤t0 < s \le t.

The waiting times follow from {Tk≤t}={N(t)≥k}\{T_k \le t\} = \{N(t) \ge k\}, where TkT_k is the time of arrival number kk.

  • First arrival. Since {T1>t}={N(t)=0}\{T_1 > t\} = \{N(t) = 0\}, the first arrival time is Exp⁡(λ)\operatorname{Exp}(\lambda).
  • Gaps. The times between consecutive arrivals are independent, each Exp⁡(λ)\operatorname{Exp}(\lambda), and from any fixed time the wait until the next arrival is Exp⁡(λ)\operatorname{Exp}(\lambda) whatever happened before.
  • Later arrivals. The time TkT_k is a sum of kk gaps, with mean k/λk/\lambda and variance k/λ2k/\lambda^2, so it is not exponential for k≥2k \ge 2.

The count in (0,t](0, t] is Pois⁡(λt)\operatorname{Pois}(\lambda t), so the waiting time for arrival number kk has

P(Tk>t)=P(N(t)≤k−1)=∑j=0k−1e−λt(λt)jj!.\begin{aligned} &P(T_k > t) \\[0.4em] &\quad = P\bigl(N(t) \le k - 1\bigr) \\[0.4em] &\quad = \sum_{j=0}^{k-1} \frac{e^{-\lambda t}(\lambda t)^{j}}{j!}. \end{aligned}

With λ=3\lambda = 3 per hour, no arrival in 2020 minutes has probability e−1≈0.368e^{-1} \approx 0.368, and the second arrival comes within an hour with probability 1−4e−3≈0.8011 - 4e^{-3} \approx 0.801.

Lessons Poisson Process Basics, Arrival Counts and Waiting Times

Markov chains and transition matrices

A sequence X0,X1,X2,…X_0, X_1, X_2, \dots with values in a finite or countable state space SS is a Markov chain when the next state depends on the past only through the present state. For every nn, all states ii and jj and every event HH that fixes X0,…,Xn−1X_0, \dots, X_{n-1}, whenever P(Xn=i,H)>0P(X_n = i, H) > 0,

P(Xn+1=j∣Xn=i,H)=P(Xn+1=j∣Xn=i).\begin{aligned} &P(X_{n+1} = j \mid X_n = i, H) \\[0.4em] &\quad = P(X_{n+1} = j \mid X_n = i). \end{aligned}

The chain is time-homogeneous when these probabilities PijP_{ij} do not depend on nn, a separate assumption. The transition matrix P=(Pij)P = (P_{ij}) has row ii for the current state and column jj for the next state, nonnegative entries and rows that add to 11. With πn\pi_n the row vector of the probabilities P(Xn=i)P(X_n = i),

QuantityFormula
Path probabilityP(X0=i0,…,Xn=in)=π0(i0) Pi0i1⋯Pin−1inP(X_0 = i_0, \dots, X_n = i_n) = \pi_0(i_0)\,P_{i_0 i_1} \cdots P_{i_{n-1} i_n}
One stepπn+1=πnP\pi_{n+1} = \pi_n P
nn stepsπn=π0Pn\pi_n = \pi_0 P^n
nn-step transition probabilityP(Xm+n=j∣Xm=i)=(Pn)ijP(X_{m+n} = j \mid X_m = i) = (P^n)_{ij}
Chapman-Kolmogorov relationPm+n=PmPnP^{m+n} = P^m P^n

Under the column convention of some books every matrix and vector is transposed, and the two conventions must not be mixed. The probability of being in jj at time nn is an entry of π0Pn\pi_0 P^n, while for a start i≠ji \ne j the probability of visiting jj at some time up to nn is at least as large and is found by making jj absorbing. For two states AA and BB with

P=[0.80.20.30.7],P2=[0.70.30.450.55],\begin{gathered} P = \begin{bmatrix} 0.8 & 0.2 \\ 0.3 & 0.7 \end{bmatrix}, \\[0.4em] P^2 = \begin{bmatrix} 0.7 & 0.3 \\ 0.45 & 0.55 \end{bmatrix}, \end{gathered}

a chain that starts in AA is in AA two steps later with probability 0.70.7.

Lessons Markov Chains and Transition Matrices, Multi-Step Markov Probabilities

Stationary distributions

A row vector π\pi is a stationary distribution of a chain on a finite state space when

πP=π,π(j)≥0 for every j,∑jπ(j)=1.\begin{gathered} \pi P = \pi, \\[0.4em] \pi(j) \ge 0 \text{ for every } j, \\[0.4em] \sum_{j} \pi(j) = 1. \end{gathered}

A chain started from π\pi keeps the distribution π\pi at every step. The equations π(j)=∑iπ(i)Pij\pi(j) = \sum_i \pi(i) P_{ij} are the balance equations. One of them always follows from the others, and the normalization takes its place. Equivalently, at every state the probability flow out to other states equals the flow in from other states. The pairwise condition π(i)Pij=π(j)Pji\pi(i) P_{ij} = \pi(j) P_{ji}, called detailed balance, is sufficient but not necessary.

For a finite chain,

  • at least one stationary distribution exists,
  • if the chain is irreducible, so that every state can be reached from every other state, the stationary distribution is unique, and
  • if the chain is irreducible and aperiodic, then πn→π\pi_n \to \pi from every initial distribution.

The period of a state ii is the greatest common divisor of the step counts n≥1n \ge 1 with (Pn)ii>0(P^n)_{ii} > 0, and a state with Pii>0P_{ii} > 0 has period 11. The identity matrix makes every distribution stationary, and the matrix that swaps two states has the unique stationary distribution (1/2,1/2)(1/2, 1/2), yet from a fixed start it alternates forever. A two-state chain with PAB=aP_{AB} = a and PBA=bP_{BA} = b, where a+b>0a + b > 0, has

π=(ba+b,aa+b),\pi = \Bigl(\frac{b}{a + b}, \frac{a}{a + b}\Bigr),

and πn(A)−π(A)=(1−a−b)n(π0(A)−π(A))\pi_n(A) - \pi(A) = (1 - a - b)^n \bigl(\pi_0(A) - \pi(A)\bigr). For the two-state matrix of the previous topic, a=0.2a = 0.2 and b=0.3b = 0.3, so π=(0.6,0.4)\pi = (0.6, 0.4) and the gap halves at every step.

Lessons Stationary Distributions

Hitting times and absorption

For a nonempty set DD of target states, the hitting time TD=min⁡{n≥0:Xn∈D}T_D = \min\{n \ge 0 : X_n \in D\} is the first time the chain is in DD, with TD=∞T_D = \infty if it never gets there. A state ii is absorbing when Pii=1P_{ii} = 1. Write PiP_i and EiE_i for a chain started at ii. Conditioning on the first step gives linear equations.

QuantityBoundary valuesEquation for ii outside DD
Hitting probability hi=Pi(TD<∞)h_i = P_i(T_D < \infty)hi=1h_i = 1 on DD, and hi=0h_i = 0 where DD cannot be reachedhi=∑jPijhjh_i = \sum_j P_{ij} h_j
Expected hitting time ki=Ei[TD]k_i = E_i[T_D]ki=0k_i = 0 on DDki=1+∑jPijkjk_i = 1 + \sum_j P_{ij} k_j

On a finite state space the probability equations with both kinds of boundary values have exactly one solution, and if DD can be reached from every state, every kik_i is finite. If Pi(TD=∞)>0P_i(T_D = \infty) > 0, then Ei[TD]=∞E_i[T_D] = \infty, so check finiteness before solving for expected times. For the symmetric walk on {0,1,…,N}\{0, 1, \dots, N\} absorbed at 00 and NN, the walk started at ii reaches NN before 00 with probability i/Ni/N, and the expected time to absorption is i(N−i)i(N - i). For N=3N = 3 and i=1i = 1 these are 1/31/3 and 22.

Lessons Hitting Times and Absorption

Choosing and checking Markov models

  • State and time step. A state definition gives each observation time exactly one label from a fixed list, and the time step says what separates XnX_n from Xn+1X_{n+1}. A matrix for one step does not determine a matrix for a shorter step.
  • Markov assumption. The Markov property is a claim about the real process under the chosen states, and no matrix or diagram can prove it. A refined state that records more of the history can make it hold.
  • Empirical matrix. If state ii is followed by state jj in NijN_{ij} of the NiN_i observed departures from ii, the estimate is P^ij=Nij/Ni\hat{P}_{ij} = N_{ij}/N_i for every ii with Ni>0N_i > 0. These estimates carry sampling error.
  • Checks. Split the departures from one state by time period to check time homogeneity, or by earlier history to check the Markov assumption, and compare the estimated rows. A difference may be sampling variation, and agreement does not prove the assumption.
  • Limits. Every output is exact for the model and describes the real process only as far as the states, the time step and the assumptions fit it. A simulation of the model checks the program, not the model.

Lessons Choosing and Checking Markov Models

Integrated Probability Investigations

The last two lessons build complete models from stated assumptions. Each one computes exact answers, checks part of the model by simulation and says what the model cannot show.

Building and checking a complete model

  1. Specify. Name the experiment, the events and random variables with their supports, the numerical inputs and the assumptions that link them, such as independence, replacement and rates. Everything else is an output, not a free choice.
  2. Build the joint model. Turn conditional rates into joint probabilities with the multiplication rule, then use total probability and Bayes’ theorem.
  3. Combine parts carefully. Multiply probabilities across parts of the model only where independence was assumed. A fixed batch of nn items gives a binomial count, while a fixed time window of a Poisson process holds a random, Poisson number of items.
  4. Compute exactly. Derive each answer from the specification and keep its conditions with it.
  5. Test sensitivity. Change one input or assumption at a time and see which conclusions move.
  6. Check by simulation. Simulate a submodel with a recorded generator and seed, and compare the estimate with the exact value using its Monte Carlo standard error. Agreement supports the program, not the claim that the model describes a real system.

In the constructed inspection model of the first investigation, an item is faulty with probability P(F)=0.1P(F) = 0.1, and an alert is raised with probabilities P(A∣F)=0.8P(A \mid F) = 0.8 and P(A∣Fc)=0.2P(A \mid F^{c}) = 0.2. Then P(A)=0.08+0.18=0.26P(A) = 0.08 + 0.18 = 0.26 and P(F∣A)=0.08/0.26=4/13≈0.308P(F \mid A) = 0.08/0.26 = 4/13 \approx 0.308. A review takes 1212 minutes for a faulty alerted item, 33 minutes for any other alerted item and none without an alert, so the expected review time per item is 12(0.08)+3(0.18)=1.512(0.08) + 3(0.18) = 1.5 minutes. Among 1010 independent items the number of alerts is Bin⁡(10,0.26)\operatorname{Bin}(10, 0.26), with mean 2.62.6, and at least one alert occurs with probability 1−0.7410≈0.9511 - 0.74^{10} \approx 0.951.

Lessons A Discrete Probability Investigation, A Complete Introduction to Probability Investigation