Probability basics and set theory
The sample space of an experiment is the set of all possible outcomes of the experiment. An event is a subset of the sample space , and we say that occurred if the actual outcome is in .
De Morgan’s Laws
, jo a or b me nhi hai vo a me bhi nhi hia aur b me bhi nhi hia
Set theory notes
Intersection distributes over Union (just like numbers):
Union distributes over Intersection (this is the one that breaks regular math logic):
Commutative laws: and
Associative laws: and
Identity laws: and
Naive definition of probability
Let be an event for an experiment with a finite sample space .
The naive probability of is:
That is:
It's naive because it assumes outcomes to be equally likely, for example, heads and tails.
Counting
Multiplication rule
Consider a compound experiment consisting of two sub-experiments, Experiment A and Experiment B. Suppose that Experiment A has a possible outcome, and for each of those outcomes, Experiment B has b possible outcomes. Then the compound experiment has ab possible outcomes.
Q. Imagine you roll two standard 6-sided dice (a Red die and a Blue die) and you want to know how many different pairs of numbers you can get, where order doesn't matter (meaning a 3 and a 5 is the same thing as a 5 and a 3).
Ans. The trap is that you can’t just straight up divide by two. 36/2
Consider n objects and making k choices from them, one at a time with replacement
Then there are n^k possible outcomes
without replacement
N. N-1. N-2 …. N-k+1
Permutation of N objects -> N!
Birthday problem
(Birthday problem). There are k people in a room. Assume each
person’s birthday is equally likely to be any of the 365 days of the year (we exclude
February 29), and that people’s birthdays are independent (we will define indepen-
dence formally later, but intuitively it means that knowing some people’s birthdays
gives us no information about other people’s birthdays; this would not hold if, e.g.,
we knew that two of the people were twins). What is the probability that at least
one pair of people in the group have the same birthday?
Team problem
Example 1.4.13 (Committees and teams). Consider a group of four people.
(a) How many ways are there to choose a two-person committee?
(b) How many ways are there to break the people into two teams of two?
Binomial coefficient formula
For k ≤ n, we have
For k > n, we have
Proof. Let be a set with . Any subset of has size at most n, so for k > n. Now let k ≤ n. By Theorem 1.4.8, there are ways to make an ordered choice of k elements without replacement. This overcounts each subset of interest by a factor of k!
I was not able to get a feel for why we divide by (k!), but then I thought about it like this. Suppose there are (x) ways to do an unordered selection of (k) elements from (n) elements. Once you have selected those (k) elements, there are (k!) ways to order them. You can think of these as two independent experiments, and because they are independent, their counts can be multiplied. Another way to see it is as branches of a tree: for every unordered selection, there are (k!) possible permutations. Therefore, the number of ordered selections is equal to the number of unordered selections multiplied by (k!). So if you know the number of ordered selections and want to find the number of unordered selections, you divide by (k!). In other words, the number of unordered selections equals the number of ordered selections divided by (k!).
Q. How many ways are there to permute the letters in the word STATISTICS?
Q. Which of the following events has the highest probability?
A: At least one 6 appears when 6 fair dice are rolled.
B: At least two 6’s appear when 12 fair dice are rolled.
Q. How many ways are there to choose k times from a set of n objects with replacement, if order doesn’t matter
don’t use this bose-einstien question above when events are not equi likely
As another example, with n= 365 days in a year and k people, how many possible unordered birthday lists are there? For example, for k = 3, we want to count lists like (May 1, March 31, April 11), where all permutations are considered equivalent. We can’t do a simple adjustment for overcounting such as nk/3! since, e.g., there are 6 permutations of (May 1, March 31, April 11) but only 3 permutations of (March 31, March 31, April 11). By Bose-Einstein, the number of lists isn+k−1 k . But the ordered birthday lists are equally likely, not the unordered lists, so the Bose-Einstein value should not be used in calculating birthday probabilities
Binomial identities
Story proof : Consider a student organization consisting of mjuniors and nseniors, from which a committee of size k will be chosen. There are m+n k possibilities. If there are j juniors in the committee, then there must be k−j seniors in the committee. The right-hand side of the identity sums up the cases for j
Q. The number of ways to break 2n people into n partnerships.
Ans. There are actually two ways to think about this.
Probability axioms
, .
If are disjoint events, then
Saying that these events are disjoint means that they are mutually exclusive: for .
Any function (mapping events to numbers in the interval ) that satisfies the two axioms is considered a valid probability function. However, the axioms don’t tell us how probability should be interpreted; different schools of thought exist.
Frequentist and Bayesian interpretations
The frequentist view of probability is that it represents a long-run frequency over a large number of repetitions of an experiment: if we say a coin has probability of Heads, that means the coin would land Heads 50% of the time if we tossed it over and over and over.
The Bayesian view of probability is that it represents a degree of belief about the event in question, so we can assign probabilities to hypotheses like “candidate A will win the election” or “the defendant is guilty” even if it isn’t possible to repeat the same election or the same crime over and over again.
The Bayesian and frequentist perspectives are complementary, and both will be helpful for developing intuition in later chapters.
Some basic consequences of the axioms:
P(Aᶜ) = 1 - P(A).
If A ⊆ B, then P(A) ≤ P(B).
P(A ∪ B) = P(A) + P(B) - P(A ∩ B).
Inclusion-exclusion
For any events ,
Q. Consider a well-shuffled deck of n cards, labeled 1 through n. You flip over the cards one by one, saying the numbers 1 through n as you do so. You win the game if, at some point, the number you say aloud is the same as the number on the card being flipped over (for example, if the 7th card in the deck has the label 7). What is the probability of winning?
Ans. there are two ways to solve this question, one through inclusion exclusion and other through recursion.
Conditional probability
If A and B are events with P(B) > 0, then the conditional probability of A given B, denoted by , is defined as
Similarly, conditioning on both B and E means conditioning on their intersection:
From the definition of conditional probability,
Probability of the intersection of n events
For any events A1, ..., An with P(A1 ∩ A2 ∩ ... ∩ A(n-1)) > 0,
The commas denote intersections, e.g. is .
The intuition: drawing cards without replacement
Imagine you have a standard deck of 52 cards. You want to draw 3 cards from the top of the deck, one by one. You want to find the probability of a very specific outcome:
: Your 1st card is an Ace.
: Your 2nd card is a King.
: Your 3rd card is a Queen.
You want to find the probability that all three happen: . How do you calculate this naturally?
- First, what is the probability that the 1st card is an Ace? There are 4 Aces out of 52 cards:
- Next, assuming you already drew that Ace, what is the probability that the 2nd card is a King? There are still 4 Kings left, but only 51 cards total remaining in the deck. This is a conditional probability:
- Finally, assuming you already have the Ace and the King out of the deck, what is the probability that the 3rd card is a Queen? There are 4 Queens left out of 50 cards remaining. This is:
To find the final probability of the whole sequence, you just multiply them together:
Look at that! Your natural way of solving
note : if you look at the RHS of the formula it does not care about the order, but if you look at the LHS it would first look like it cares about the order but if you look closely it does not, because if it would have been than it would have written P(A2).P(A1/A2) as a saperate probbality and added that but they have’nt
Conditional versions of probability results
Any of the results we have derived about probability are still valid if we replace all unconditional probabilities with probabilities conditional on E. In particular:
Conditional probabilities are between 0 and 1.
P(S|E) = 1, P(∅|E) = 0.
If A1, A2, ... are disjoint, then
P(Aᶜ|E) = 1 - P(A|E).
Inclusion-exclusion: P(A ∪ B|E) = P(A|E) + P(B|E) - P(A ∩ B|E).
Proof for the disjoint case. Define . Second, if are disjoint events, then
LOTP with extra conditioning
Let be a partition of . Provided that P(Ai ∩ E) > 0 for all i, we have
Law of total probability
Let be a partition of the sample space (i.e., the are disjoint events and their union is ), with P(Ai) > 0 for all i. Then
Proof. Since the form a partition of , we can decompose as
This is like chopping into the smaller pieces through . By the second axiom of probability, because these pieces are disjoint, we can add their probabilities to get :
Now we can apply the conditional probability multiplication rule to each of the :
Q. You have one fair coin, and one biased coin which lands Heads with probability 3/4. You pick one of the coins at random and flip it three times. It lands Heads all three times. Given this information, what is the probability that the coin you picked is the fair one?
Independence
Events A and B are independent if
If P(A) > 0 and P(B) > 0, then this is equivalent to
and also equivalent to .
Independence is completely different from disjointness. If A and B are disjoint, then , so disjoint events can be independent only if P(A) = 0 or P(B) = 0. Knowing that A occurs tells us that B definitely did not occur, so A clearly conveys information about B, meaning the two events are not independent (except if A or B already has zero probability).
Consequences of event independence
If A and B are independent, then A and Bᶜ are independent, Aᶜ and B are independent, and Aᶜ and Bᶜ are independent.
Proof idea:
Independence of three events
Events A, B, and C are said to be independent if all of the following equations hold:
If the first three conditions hold, we say that A, B, and C are pairwise independent.
Pairwise independence does not imply independence: it is possible that just learning about A or just learning about B is of no use in predicting whether C occurred, but learning that both A and B occurred could still be highly relevant for C.
On the other hand, does not imply pairwise independence; this can be seen quickly by looking at the extreme case P(A) = 0, when the equation becomes 0 = 0, which tells us nothing about B and C.
Independence of many events
For n events to be independent, we require:
Any pair to satisfy for i ≠ j.
Any triplet to satisfy for i, j, k distinct.
Similarly for all quadruplets, quintuplets, and so on.
This can quickly become unwieldy, but later we will discuss other ways to think about independence. For infinitely many events, we say that they are independent if every finite subset of the events is independent.
Conditional independence
Events A and B are said to be conditionally independent given E if
It is easy to make terrible blunders stemming from confusing independence and conditional independence.
Two events can be conditionally independent given E, but not independent given Eᶜ.
Two events can be conditionally independent given E, but not independent.
Two events can be independent, but not conditionally independent given E.
In particular,
does not imply
Random variables
A random variable is a function from the sample space to the real numbers.
So if the sample space is S, then a random variable X takes one outcome from S as input and returns a real number for that outcome.
In notation:
The important thing is: a random variable is defined outcome by outcome. It looks at one outcome and assigns a number to it.
Example: tossing two coins
Suppose we toss two coins. The sample space is:
Now define a random variable X as the number of heads in the outcome.
Then:
X(HH) = 2
X(HT) = 1
X(TH) = 1
X(TT) = 0
So this random variable can take the values 0, 1, and 2.
The random variable could have been something else too. For example, another random variable could be whether the outcome has at least one head:
X(HH) = 1
X(HT) = 1
X(TH) = 1
X(TT) = 0
Here 1 means “yes, at least one head” and 0 means “no heads”.
Discrete and continuous random variables
Random variables can be discrete or continuous.
A discrete random variable takes countable values, like 0, 1, 2, 3, and so on.
A continuous random variable can take values over an interval, like any real number between 0 and 1.
One subtle point: even if the sample space is continuous, the random variable can still be discrete.
For example, suppose a person arrives at a bus stop at some random time between 0 and 60 minutes. The sample space is continuous because the arrival time could be 12.1 minutes, 12.11 minutes, 12.111 minutes, and so on.
But define X like this:
X = 1 if the person arrives in the first 30 minutes
X = 0 if the person arrives after 30 minutes
Here the sample space is continuous, but the random variable X is discrete because it only takes two values: 0 and 1.
What a random variable is allowed to look at
A random variable can only look at the outcome it is being applied to. It cannot look across all outcomes and calculate something global about the whole sample space.
For example, if we toss two coins, it is not correct to define a random variable as “the probability of getting at least one head”. That probability needs us to look across multiple outcomes in the sample space.
But it is completely fine to define a random variable as “does this outcome have at least one head?”
That random variable only looks at the single outcome:
HH has at least one head, so X(HH) = 1
HT has at least one head, so X(HT) = 1
TH has at least one head, so X(TH) = 1
TT has no head, so X(TT) = 0
So the difference is:
Probability of at least one head: talks about the whole experiment/sample space.
Indicator random variable for at least one head: talks about one outcome at a time and returns 1 or 0.
Probabilities of values of a random variable
Once we have assigned a random variable to the outcomes, we can use it to calculate probabilities over specific values of that random variable.
For example, suppose X is the number of heads in two coin tosses. Then we can ask questions like:
What is P(X = 1)?
What is P(X > 1)?
These are really questions about which outcomes in the sample space make the random variable take that value.
For two coin tosses:
X = 1 happens for HT and TH, so P(X = 1) = P({HT, TH}).
X > 1 happens only for HH, so P(X > 1) = P({HH}).
So after defining X, we stop talking directly about raw outcomes and start talking about events like X = 1, X > 1, X ≤ 2, and so on.
Probability mass function
For a discrete random variable, the probability mass function (PMF) tells us how much probability mass each possible value of the random variable gets.
Think of it like a graph:
On the x-axis, write all the values the random variable can take.
On the y-axis, write the probability that the random variable is equal to that value.
For example, if X is the number of heads in two fair coin tosses, then X can take the values 0, 1, and 2.
The PMF is:
xP(X = x)00.2510.5020.25
So the graph would put probability mass 0.25 on 0, probability mass 0.50 on 1, and probability mass 0.25 on 2.
The important thing is that all the probabilities in a PMF must add up to 1:
In general:
So a PMF shows how the total probability mass is distributed across the possible values of a discrete random variable.
Bernoulli trial
An experiment that can result in either a “success” or a “failure” (but not both) is called a Bernoulli trial.
A Bernoulli random variable can be thought of as the indicator of success in a Bernoulli trial: it equals 1 if success occurs and 0 if failure occurs.
The important clarification: a Bernoulli trial does not mean the underlying sample space S must have only two outcomes. It means we are viewing the sample space through a binary lens, using a random variable that collapses the outcome into exactly two values:
1 for success
0 for failure
Case 1: the sample space is already binary
Experiment: flip a single coin.
Define X by:
X(H) = 1
X(T) = 0
Here, both the sample space and the random variable are naturally binary.
Case 2: the sample space has many outcomes, but the random variable is binary
Example: roll a die.
There are 6 outcomes. But define X as: “did I roll a 6?”
The underlying experiment has 6 outcomes, but X is still a Bernoulli random variable because it only takes the values 0 and 1.
Case 3: the sample space is continuous, but the random variable is binary
Suppose we measure the exact lifespan of a laptop battery in hours.
There are infinitely many possible outcomes. But define Y as: “does the battery last more than 5 hours?”
This is also a Bernoulli random variable. The sample space is continuous, but the random variable only outputs 0 or 1.
Binomial distribution
Suppose that n independent Bernoulli trials are performed, each with the same success probability p. Let X be the number of successes.
The distribution of X is called the Binomial distribution with parameters n and p.
We write to mean that X has the Binomial distribution with parameters n and p, where n is a positive integer and 0 < p < 1.
Binomial PMF
If , then the PMF of X is
You should be able to derive this yourself.
Theorem 3.3.7
Let , and let q = 1 - p. We often use q to denote the failure probability of a Bernoulli trial.
Then:
Hypergeometric distribution
Consider an urn with w white balls and b black balls. We draw n balls out of the urn at random without replacement, such that all samples of size n from the w + b balls are equally likely.
Let X be the number of white balls in the sample. Then X is said to have the Hypergeometric distribution with parameters w, b, and n. We denote this by:
With replacement vs. without replacement
Imagine an urn with w = 6 white balls and b = 4 black balls. Total balls = 10. You want to draw n = 5 balls.
With replacement (Binomial): You draw a ball, write down its color, and put it back. Every single time you reach into the urn, the probability of getting a white ball is exactly the same:
Because the probability never changes, these are independent Bernoulli trials, which is exactly the setup for a Binomial distribution.
Without replacement (Hypergeometric): You draw a ball and keep it out. Now, the universe changes after every draw. If you draw a white ball first, there are fewer white balls left, so the probability of getting a white ball on the next turn drops.
Because the trials are dependent, the Binomial formula breaks. We need a new tool: the Hypergeometric distribution.
Breaking down the Hypergeometric PMF formula
The probability of getting exactly k white balls in your sample of size n is:
Discrete uniform distribution
We write:
The core story
You choose exactly one number from a finite set of possibilities, where every single choice has the exact same likelihood of being picked. This is the random variable version of the naive definition of probability.
Parameter: C is a finite, nonempty set of numbers (the choices).
Size: |C| represents the total count of elements inside that set.
The probability mass function (PMF)
Because the total probability of all choices must sum to 1, the probability of picking any specific single number x is completely locked in by the size of the set:
Calculating subsets (events)
If you want to find the probability that your chosen number falls into a specific target group A, where A is a subset of C, the problem simplifies to basic counting:
Key takeaways for intuition
- Uniform = perfectly equal: You cannot ch
Cumulative distribution function
Unlike the PMF, which only discrete random variables possess, the CDF is defined for all random variables.
Definition 3.6.1
The cumulative distribution function (CDF) of a random variable X is the function given by:
The CDF of a discrete random variable consists of jumps and flat regions.
The height of a jump in the CDF at x is equal to the value of the PMF at x.
Valid CDFs
Any CDF F has the following properties.
Increasing: If x1 ≤ x2, then F(x1) ≤ F(x2).
Right-continuous: the CDF is continuous except possibly for having some jumps. Wherever there is a jump, the CDF is continuous from the right. That is, for any a, we have
- Convergence to 0 and 1 in the limits:
and
A concrete example: rolling a die
Let X be the result of a fair 6-sided die roll. Let’s look at the CDF at a = 3, which means finding:
Because a die can only land on whole numbers, the graph of this CDF looks like a staircase.
For any number just below 3, like 2.99, the probability is only , because you could have rolled a 1 or a 2.
The left side:
What it says in plain English: as you move infinitely far to the left on the x-axis, the value of the CDF drops to exactly 0.
The intuition: remember that F(x) represents .
Functions of random variables
A function of a random variable is also a random variable.
That is, if X is a random variable, then , , and are also random variables, as is for any function .
Suppose we define a new random variable:
How do we find the PMF of this new variable Y?
If we already know the PMF of X, then we find the probabilities of Y by looking at which values of X get mapped to each value of Y.
One-to-one case
If g is one-to-one, every unique input gives a unique output. There are no duplicates or ties.
Examples:
is one-to-one.
is one-to-one on nonnegative x.
is not one-to-one on all real numbers, because both 2 and -2 map to 4.
If g is one-to-one, the probabilities do not change. Only the labels change.
Concrete example
Let X have the following PMF:
Now define:
Here , which is one-to-one.
The possible values of Y are 10, 20, and 30. The probabilities stay exactly the same:
PMF of g(X)
Let X be a discrete random variable and let .
The support of is the set of all y such that for at least one x in the support of X.
The PMF of is:
This is the rule when g is not one-to-one: collect all the x values that collapse into the same y value, and add their probabilities.
For example, if , then both X = 2 and X = -2 map to Y = 4. So:
Functions of two random variables
Given an experiment with sample space S, if X and Y are random variables that map to X(s) and Y(s) respectively, then is the random variable that maps s to .
When you move from a function of one random variable, , to a function of two random variables, , you are combining two inputs to create a single output.
Examples:
From first principles, the one-to-one and many-to-one logic works the same way as before, but now the inputs are pairs instead of single values x.
The one-to-one case
For to be one-to-one, every unique pair of inputs must give a unique output.
If that happens, you just change the label and keep the probability of that specific pair:
where z is the unique value produced by the pair .
This is extremely rare for normal functions of two variables.
For example, addition is not one-to-one. The output 3 can come from many pairs:
(1, 2)
(2, 1)
(0, 3)
(4, -1)
An example of a one-to-one two-variable function can be something like:
if X and Y are single-digit integers.
If X = 2 and Y = 3, then g(2,3) = 23. No other pair of single digits gives 23, so:
The many-to-one case
This is the standard case.
Functions like , , or naturally collapse many distinct pairs into the same final value z.
So we use the same collapsing/summing rule as before, except now we sum over pairs:
When you take a function of two random variables, , you are doing dimensional reduction: you are taking a two-dimensional grid of possibilities and flattening it down onto a single one-dimensional number line
Independence of two random variables
Random variables X and Y are said to be independent if, for all real numbers x and y,
In the discrete case, this is equivalent to:
Independence of many random variables
Random variables X1, ..., Xn are independent if, for all real numbers x1, ..., xn,
For infinitely many random variables, we say that they are independent if every finite subset of the random variables is independent.
This looks simpler than independence for many events, where we had to check pairs, triplets, and so on. But here the equality has to hold for all possible values x1, ..., xn. That is infinitely many conditions. If we can find even one list of values where the equality fails, then the random variables are not independent.
Why group independence implies pairwise independence
For three random variables, independence says:
What if we only want to prove that X1 and X2 are independent, ignoring X3?
The trick is to push x3 all the way to infinity.
As x goes to ∞, a CDF becomes 1. So P(X3 ≤ ∞) becomes 1 and vanishes from both sides.
We are left with:
So if a whole group is independent, any pair you pick out of that group is also independent. This is pairwise independence.
Functions of independent random variables
If X and Y are independent random variables, then any function of X is independent of any function of Y.
Independent and identically distributed (i.i.d.)
We often work with random variables that are independent and have the same distribution. We call such random variables independent and identically distributed, or i.i.d. for short.
Independent vs. identically distributed
“Independent” and “identically distributed” are two often-confused but completely different concepts.
Random variables are independent if they provide no information about each other.
Random variables are identically distributed if they have the same PMF, or equivalently the same CDF.
Whether two random variables are independent has nothing to do with whether they have the same distribution.
Theorem 3.8.8
If X ∼ Bin(n,p), viewed as the number of successes in n independent Bernoulli trials with success probability p, then we can write:
where the Xi are i.i.d. Bern(p).
Theorem 3.8.9
If X ∼ Bin(n,p), Y ∼ Bin(m,p), and X is independent of Y, then:
For these two theorems, looking for a heavy mathematical proof is kind of stupid. You can just think through them logically and they make sense.
Conditional independence of random variables
Random variables X and Y are conditionally independent given a random variable Z if, for all real numbers x and y and all z in the support of Z,
For discrete random variables, an equivalent definition is:
This is the definition of independence, except that we condition on Z = z everywhere, and require the equality to hold for all z in the support of Z.
Conditional PMF
For any discrete random variables X and Z, the function P(X=x|Z=z), when considered as a function of x for fixed z, is called the conditional PMF of X given Z = z.
Fisher exact test
A scientist wishes to study whether women or men are more likely to have a certain disease, or whether they are equally likely.
A random sample of n women and m men is gathered, and each person is tested for the disease. Assume the test is completely accurate.
The numbers of women and men in the sample who have the disease are X and Y respectively, with X ∼ Bin(n,p1) and Y ∼ Bin(m,p2), independently.
Here p1 and p2 are unknown, and we are interested in testing whether p1 = p2. This is known as a null hypothesis in statistics.
Now suppose p1 = p2.
Suppose X + Y = r. Then find the conditional probability of X = x given X + Y = r.
By Bayes’ rule:
Since X + Y = r and X = x means Y = r - x,
Theorem 3.9.2
If X ∼ Bin(n,p), Y ∼ Bin(m,p), and X is independent of Y, then the conditional distribution of X given X + Y = r is:
Theorem 3.9.3
If X ∼ HGeom(w,b,n) and N = w + b goes to ∞ such that
remains fixed, then the PMF of X converges to the Bin(n,p) PMF.
Why we cannot just let w or b go to infinity separately
If w and b move separately, the nature of the problem collapses.
Scenario A: b goes to infinity but w stays fixed. If there are only w = 5 white balls and the black balls grow to infinity, then the proportion of white balls becomes 0. If you draw n balls from this urn, you will get exactly 0 white balls every single time. It becomes deterministic and uninteresting.
Scenario B: w goes to infinity but b stays fixed. Then the proportion of white balls becomes 1. If you draw n balls, you will get n white balls every single time.
Expectation
For a discrete random variable with possible values ,
Let and . Then
Expectation depends only on distribution
If and are discrete random variables with the same distribution, then
if either side exists.
Linearity of expectation
For any random variables and any constant ,
Binomial expectation
For , let’s find .
This is that you can write it as a sum of Bernoullis, right?
where each .
And so you can take expectation on both sides using linearity of expectation:
Since each Bernoulli has expectation ,
Make sense?
Hypergeometric expectation
Let , interpreted as the number of white balls in a sample of size drawn without replacement from an urn with white and black balls.
As in the Binomial case, we can write as a sum of Bernoulli random variables:
where equals 1 if the th ball in the sample is white and 0 otherwise.
By symmetry,
with
since unconditionally the th ball drawn is equally likely to be any of the balls.
Unlike in the Binomial case, the are not independent, since the sampling is without replacement: given that a ball in the sample is white, there is a lower chance that another ball in the sample is white.
However, linearity still holds for dependent random variables. Thus,
So, the first time when I read this, I was shocked because if you look at this, you can break it down as indicators: , where each one is asking whether that draw is a white ball.
Now they have taken the individual probabilities for the expectations and just added them.
The issue is that they are indicator random variables, so each one is 0 or 1, right?
Now, the issue is, you are saying that the probability changes after I pick the first ball. It does change conditionally. But unconditionally, the probability that the th ball is white is still
Okay, makes sense.
But for calculating the probability of the whole sequence, dependence matters. There we cannot simply multiply individual probabilities like in the Binomial case. We would have to take the conditional probability route.
But for expectation, we are not multiplying the indicators. We are adding them. And linearity of expectation works even when the random variables are dependent.
Make sense?
Geometric distribution
Consider a sequence of independent Bernoulli trials, each with the same success probability , with trials performed until a success occurs.
Let be the number of failures before the first successful trial. Then has the Geometric distribution with parameter ; we denote this by
If , then
for .
The expectation is
Geometric CDF
If , then the CDF of is
Negative Binomial distribution
In a sequence of independent Bernoulli trials with success probability , if is the number of failures before the th success, then is said to have the Negative Binomial distribution with parameters and , denoted
Negative Binomial PMF
If , then the PMF of is
for , where .
Theorem 4.3.10
Let , viewed as the number of failures before the th success in a sequence of independent Bernoulli trials with success probability .
Then we can write
where the are i.i.d. .
A Negative Binomial random variable is just a collection of independent Geometric random variables stacked back-to-back.
Concrete timeline
Imagine you are tossing a coin where Heads = Success ( ) and Tails = Failure ( ). You want to keep tossing until you see a total of successes.
Let be the total number of failures you accumulate before that 3rd success happens. By definition,
Suppose you start flipping, and this is the exact sequence of outcomes you get:
Let's divide this timeline into eras, using the successes as the borders:
Era 1, before the 1st success: you flipped before getting your first , so .
Era 2, between the 1st and 2nd success: right after the first success, you flipped before getting your second , so .
Era 3, between the 2nd and 3rd success: right after the second success, you flipped before getting your third , so .
Now count the grand total number of failures in the entire sequence:
Notice that the total number of failures is exactly the sum of the failures in each individual era:
Why are the variables i.i.d. Geometric?
Each era starts fresh after a success. Since the Bernoulli trials are independent and the success probability is the same every time, the number of failures before the next success has the same distribution each time.
So if , by the previous theorem we can write
where the are i.i.d. .
By linearity,
So,
Indicator random variables
The indicator random variable , or , for an event is defined to be 1 if occurs and 0 otherwise.
Indicator r.v. properties
Let and be events. Then the following properties hold.
for any positive integer .
.
.
.
Fundamental bridge between probability and expectation
There is a one-to-one correspondence between events and indicator random variables, and the probability of an event is the expected value of its indicator random variable :
Expectation via survival function
Let be a nonnegative integer-valued random variable. Let be the CDF of , and
The function is called the survival function of .
Then
Since , this means
Equivalently, for nonnegative integer-valued ,
Step 1: The setup, bounding
For simplicity, we prove the result only for the case that is bounded, i.e. there is a nonnegative integer such that is always at most .
The authors are making a simplifying assumption. They are saying: let's pretend cannot be infinitely large. There is some maximum cap, which we will call .
For example, if you roll a 6-sided die, is bounded by .
Step 2: The indicator trick
We can represent as a sum of indicator random variables:
where
An indicator variable is a switch: it outputs 1 if the condition inside the parenthesis is true, and 0 if it is false.
Here, the condition is: is greater than or equal to ?
For example, if occurs, then through equal 1 while the other indicators equal 0.
Let's write out what happens if , assuming the maximum bound is :
Now, add them all up:
The sum of these indicators is exactly equal to 7, which is our value of .
No matter what integer actually turns out to be, this trick always works. The sum of the indicators literally counts up to .
Step 3: Taking the expectation
Now we look at the big line of equations:
Linearity of expectation allows us to put an in front of every single indicator variable inside the sum. As we discussed earlier, linearity works perfectly even if these indicators are dependent on each other.
The Fundamental Bridge states that the expected value of any 0-1 indicator variable is just the probability that it equals 1. The probability that is simply the probability that the condition is true:
So at this point, we have proven that
LOTUS
If is a discrete random variable and is a function from to , then
where the sum is taken over all possible values of .
If is a one-to-one function, like , the proof is trivial because every unique maps to exactly one unique .
Variance
The variance of a random variable is
Variance measures how far is from its mean on average. But instead of taking the average deviation from the mean, we take the average squared deviation.
Why square it? Because
by linearity of expectation. Positive and negative deviations cancel each other out. Squaring makes both sides contribute positively to the overall spread.
One issue is that variance has squared units. If is measured in dollars, then is measured in squared dollars. To get back to the original units, we take the square root. This is the standard deviation:
Shortcut formula for variance
For any random variable ,
Proof. Let . Then
So,
Basic variance facts
for any constant .
Intuitively, shifting a distribution left or right changes its center, but not its spread.
for any constant .
If and are independent, then
Also,
with equality if and only if for some constant .
Variance of a Binomial random variable
Let
We can find the variance of using indicator random variables, which avoids a tedious direct sum.
Write
where is the indicator of the th trial being a success.
Each is Bernoulli with success probability , so
Also, since only takes values 0 and 1,
Therefore,
So
Since the Bernoulli trials are independent, the indicators are independent. Thus,
So,
Finding using pair counting
Another way to approach variance is to first find and then use
But directly finding can be annoying. A nicer trick is to look at
Why? Because
So if we know , then we know something about , and from there we can recover since
Thus,
Now suppose , so is the number of successes in independent Bernoulli trials.
Think of as counting the number of successful pairs of trials. Instead of looking at the total count directly, place a Yes/No sensor on every possible pair of trials.
There are
possible pairs.
For one specific pair, say trials and , define an indicator variable that equals 1 if both trials are successes and 0 otherwise.
The probability that this specific sensor turns on is
since the trials are independent.
By the Fundamental Bridge,
Now use linearity of expectation across all pair sensors:
Since
we get
And therefore
Finally,
So
Poisson distribution
A random variable has a Poisson distribution with parameter if it counts the number of times an event occurs in a fixed interval of time, space, or some other unit, when the average rate is .
We write:
Poisson PMF
If , then
for .
Mean and expectation
For ,
So the mean of a Poisson random variable is .
Variance
For ,
So for a Poisson random variable, the mean and variance are the same.
Theorem 4.8.1: Sum of independent Poissons
If , , and is independent of , then
Theorem 4.8.2: Poisson given a sum of Poissons
If , , and is independent of , then the conditional distribution of given is
So once we know the total count is , the question becomes: how many of those events came from the first Poisson source?
Theorem 4.8.3: Poisson approximation to Binomial
If and we let and such that
remains fixed, then the PMF of converges to the PMF.
More generally, the same conclusion holds if and in such a way that converges to a constant .
Continuous random variables
A random variable has a continuous distribution if its CDF is differentiable. We also allow endpoints, or finitely many points, where the CDF is continuous but not differentiable, as long as the CDF is differentiable everywhere else.
A continuous random variable is a random variable with a continuous distribution.
For discrete random variables, the CDF is awkward to work with because it has jumps. Its derivative is almost useless because it is undefined at the jumps and 0 everywhere else.
But for continuous random variables, the CDF is often convenient to work with, and its derivative is very useful. This derivative is called the probability density function.
Probability density function
For a continuous random variable with CDF , the probability density function, or PDF, is the derivative of the CDF:
The support of , and of its distribution, is the set of all where
An important difference between continuous and discrete random variables is that for a continuous random variable,
for every single value .
This is because is the height of a jump in the CDF at , but the CDF of a continuous random variable has no jumps. Since the PMF of a continuous random variable would just be 0 everywhere, we work with a PDF instead.
PDF to CDF
Let be a continuous random variable with PDF . Then the CDF of is
Why do we integrate from to ?
Because means
So we are adding up all the density from the far left up to .
Another way to see it: since is the derivative of , integrating gives back , but an indefinite integral comes with a constant. To pin down that constant, we use the fact that
So,
That is why the lower limit is .
Probabilities of intervals
Since the PDF determines the distribution, we can use it to find the probability that falls inside an interval.
For a continuous random variable, endpoints do not matter because individual points have probability 0:
This carefree endpoint logic works for continuous random variables, but not for discrete random variables.
Using the CDF,
Using the PDF, this becomes
So the probability of landing between and is the area under the PDF from to .
Valid PDFs
A function is a valid PDF only if it satisfies two conditions.
- Nonnegative:
for all .
- Integrates to 1:
The first condition says density cannot be negative.
The second condition says the total probability over the whole real line must be 1.
Expectation of a continuous random variable
For a continuous random variable with PDF , the expected value is
Why do we write it like this?
For a discrete random variable, expectation looks like
But for a continuous random variable, we cannot use directly, because
for every exact value .
So instead of taking the probability at one exact point, we look at a tiny interval near . The probability of landing in a tiny interval of width is approximately
You can think of this as a very thin rectangle:
height:
width:
area:
That area represents a tiny piece of probability mass near .
So the contribution of values near to the expectation is approximately
Now we add these tiny contributions over all possible values of . Since the pieces are infinitely small and we are adding infinitely many of them, the sum becomes an integral:
So the continuous expectation formula is just the continuous version of the discrete weighted average. Instead of multiplying each value by , we multiply each value by the tiny probability mass around it, and then integrate over the whole real line.
Location and scale transformations
Suppose you have a random variable .
If you create a new random variable by adding a constant , like
then you are changing the location.
Visually, if you graph the PDF of , adding does not change the shape of the curve. It just slides the whole curve to the right by units. If is negative, it slides the curve to the left.
Now suppose you multiply the random variable by a positive constant , like
Then you are changing the scale.
Visually, this stretches or compresses the distribution. If , the distribution spreads out, so it becomes wider and shorter. If , the distribution gets squeezed together, so it becomes narrower and taller.
Uniform distribution example
If is a Uniform random variable on the standard interval , how do we make it Uniform on ?
The width needs to change from to , so we multiply by .
The starting point needs to shift from to , so we add .
Therefore the new random variable is
So this is a location-scale transformation: first we scale the interval by , then we shift it by .
Why this is mostly a continuous distribution technique
This location-scale technique does not apply cleanly to families of discrete distributions with fixed support.
For example, if
then the support of is
If we shift it, like , or scale it, like , the possible values change. The new random variable no longer has support , so it is no longer Binomial in the usual sense.
So for fixed-support discrete distributions, shifting or scaling usually takes us outside the original distribution family.
Universality of the Uniform
Theorem 5.3.1
Let be a CDF which is continuous and strictly increasing on the support of the distribution. This ensures that the inverse function exists as a function from to .
Then we have the following results.
- If and
then is a random variable with CDF .
- If is a random variable with CDF , then
I don't really understand this theorem, not at all.
Survival function for continuous random variables
The survival function of a random variable with CDF is the function given by
So instead of asking “what is the probability that is less than or equal to ?”, the survival function asks “what is the probability that survives past ?”
Expectation by integrating the survival function
Let be a nonnegative random variable. Its expectation can be found by integrating its survival function:
This theorem says: if can never be negative, meaning , then you do not need the PDF at all. You can just integrate the survival function directly to get the mean.
Step 1: The indicator trick
The proof starts with a clever trick using an indicator function, written as .
An indicator function is just a light switch:
It outputs if the statement inside is true, here .
It outputs if the statement inside is false, here .
Imagine turns out to be exactly . Let's integrate this indicator switch from to with respect to :
As goes from up to :
While is between and , the statement is true, so the indicator is .
Once passes , like , the statement becomes false, so the indicator drops to .
So the integral is just adding up 1s from to :
Notice that the answer is exactly the number we started with. This means we can write any nonnegative random value of as an integral of its indicator switch:
Step 2: Taking the expectation
Now that we have rewritten using that integral, we take the expected value of both sides:
The proof then swaps the expectation symbol and the integral symbol:
The book mentions that this requires real analysis to rigorously justify, but conceptually, both expectation and integration are forms of adding things up, so you can think of sliding one past the other.
Step 3: The expectation of an indicator is a probability
What is the expected value of a light switch that is either or ?
By the definition of expectation:
So,
Therefore, the expected value of our indicator is simply the probability that the condition is true:
Substitute that back into our equation:
Because is just a dummy variable for integration, we can change it back to to match the theorem statement:
Normal distribution
Standard Normal distribution
A continuous random variable is said to have the standard Normal distribution if its PDF is given by
We write this as
since has mean and variance .
The constant in front of the PDF may look surprising because why is something with needed in front of something with , when there are no circles in sight? But it is exactly what is needed to make the PDF integrate to .
Such constants are called normalizing constants because they normalize the total area under the PDF to .
The standard Normal CDF is the accumulated area under the PDF:
Some people, upon seeing for the first time, feel annoyed that it is left as an integral. But there is no real choice here: it is mathematically impossible to find a closed-form expression for the antiderivative of using familiar functions like polynomials or exponentials.
But closed-form or not, it is still a well-defined function. If we give an input , it returns the accumulated area under the PDF from up to .
Symmetry of the standard Normal
The PDF satisfies
so is an even function.
The area under the PDF curve to the left of , which is
equals the area to the right of , which is
In general,
This can be seen visually by looking at the PDF curve. Mathematically, we can substitute and use the fact that PDFs integrate to :
Also, if
then
as well.
To see this, look at the CDF of :
But by symmetry,
So has the same CDF as .
Normal distribution
If
then
is said to have the Normal distribution with mean and variance , where is any real number and .
We write
It is clear from properties of expectation and variance that really has mean and variance :
and
Note that we multiply by the standard deviation , not by . Otherwise the units would be wrong and would have variance .
Standardization
If we can get from to , then we can also get from back to .
For
the standardized version of is
This process is called standardization.
Normal CDF and PDF
Let
Then the CDF of is
and the PDF of is
Proof for the CDF:
Then we differentiate to get the PDF, remembering the chain rule:
We can also write the PDF as
The 68-95-99.7 rule
If
then
and
Often it is easier to apply this rule after standardizing:
and
Exponential distribution
The story of the Exponential distribution is analogous to waiting for success, but now we are waiting in continuous time.
Successes arrive at a rate of successes per unit of time. The average number of successes in a time interval of length is , though the actual number of successes varies randomly.
An Exponential random variable represents the waiting time until the first arrival of a success.
Definition
A continuous random variable is said to have the Exponential distribution with parameter , where , if its PDF is
We denote this by
The corresponding CDF is
Scaling from Expo(1)
If
then
since
Conversely, if
then
For
we have
and
Memoryless property
The Exponential distribution has a very special property called the memoryless property.
It says that even if you have waited for hours or days without success, the success is not any more likely to arrive soon. In fact, you might as well have just started waiting.
A continuous distribution is said to have the memoryless property if a random variable from that distribution satisfies
If is a positive continuous random variable with the memoryless property, then has an Exponential distribution.
Ordering i.i.d. continuous random variables
Let be i.i.d. from a continuous distribution. Then
for any permutation of .
Method 1: step-by-step chain rule proof
Let be the event that the th variable in the sequence satisfies the inequality relative to the previous ones.
We break down the intersection using the chain rule of probability:
For two i.i.d. variables,
Given , introduce . For the chain
to hold, must be the largest of the variables currently in play. Because the variables are i.i.d., any of the is equally likely to be the largest:
In general, given that the first variables are already perfectly ordered, we introduce . For the chain to continue, must be the largest of the variables currently in play.
Because they are i.i.d.,
Multiplying these conditional probabilities together gives
Method 2: symmetry proof
There are exactly possible strict orderings of distinct numbers.
Because the random variables are continuous, the probability of any two variables being exactly equal is zero:
So the strict orderings partition the sample space almost everywhere. Their probabilities must sum to :
Because the variables are independent and identically distributed, they are completely interchangeable. There is no distinguishing statistical feature attached to any particular label.
By symmetry, every one of the possible orderings must have the same probability:
Since equal pieces sum to , the probability of any single chosen ordering is
Moments
Moments are numerical summaries of a distribution. We have already seen the mean and variance. Now we add two other important summaries: median and mode.
Median
We say that is a median of a random variable if
and
Intuitively, the median is a value such that half the mass of the distribution falls on either side of , or as close to half as possible for discrete random variables.
The simplest case is when the CDF of hits exactly at . But because some CDFs have jumps, this definition is more flexible.
If the CDF is continuous and strictly increasing, then the median is unique and is given by
Mode
For a discrete random variable , we say that is a mode of if it maximizes the PMF:
for all .
For a continuous random variable with PDF , we say that is a mode if it maximizes the PDF:
for all .
So the mode is the value with the greatest mass or density out of all values in the support of .
A distribution can have more than one mode. It can also have more than one median. For example, a distribution could have two modes at and , and infinitely many medians across the interval .
Mean, median, and optimization
Let be a random variable with mean , and let be a median of .
Then:
- The value of that minimizes the mean squared error
is
- A value of that minimizes the mean absolute error
is
So the mean is the best single-number summary if your loss is squared distance, while the median is the best single-number summary if your loss is absolute distance.
Kinds of moments
Let be a random variable with mean and variance .
For any positive integer :
The th moment of is .
The th central moment is .
The th standardized moment is
Throughout this definition, “if it exists” is left implicit.
In particular, the mean is the first moment, and the variance is the second central moment.
The word moment is borrowed from physics.
Skewness
The skewness of a random variable with mean and variance is the third standardized moment of :
Skewness measures asymmetry. A distribution with a long right tail has positive skewness, and a distribution with a long left tail has negative skewness.
Symmetry of a random variable
We say that a random variable has a symmetric distribution about if
has the same distribution as
We also say that is symmetric, or that the distribution of is symmetric; these all mean the same thing.
The number in the definition must be if the mean exists, since
which simplifies to
Because of this, it is common to say “ is symmetric” as shorthand for “ is symmetric about its mean,” if the mean exists.
The number is also a median of the distribution. If has the same distribution as , then
so
This implies
showing that
and
So for a symmetric distribution, the center of symmetry is also a median.
Symmetry about 0
Sometimes people say “ is symmetric” to mean “ is symmetric about .”
If is symmetric about , then is symmetric about .
Symmetry about is especially convenient because then and have the same distribution. If is continuous, then its PDF is an even function.
Joint distributions
We noted earlier that the individual distributions of two random variables do not tell us whether the random variables are independent or dependent.
Knowing the PMF of and the PMF of separately only tells us how each variable behaves alone. It does not tell us how they move together.
Joint CDF
The joint CDF of random variables and is the function defined by
For random variables, the joint CDF is defined similarly.
But for discrete random variables, the joint CDF is not very pleasant to work with. Just like the one-variable discrete CDF, it has jumps and flat regions. So for discrete random variables, we usually work with the joint PMF instead.
Joint PMF
For discrete random variables and , the joint PMF is
The joint PMF tells us the probability of every possible pair .
Because some pair of values must happen, all the probabilities in the joint PMF must add up to :
Marginal PMF
The marginal PMF of is obtained by summing out :
Similarly,
This is called marginalization because we are collapsing the full two-variable table down to one variable.
Conditional PMF
For discrete random variables and , the conditional PMF of given is
This is just the usual conditional probability definition, but written for random variables.
Once we condition on , we are living in the new world where has already happened. Inside that world, still has to take one of its possible values. So the conditional probabilities over all possible values must add up to :
Similarly, if we know that has happened and we are looking at the conditional PMF of given , then we are now in the world where is fixed. Something out of all the possible values must happen, so
This is the main intuition: conditioning changes the universe, but inside the new universe the probabilities still have to behave like a full distribution.
Getting marginals from the joint CDF
The marginal CDF of can be recovered from the joint CDF by sending to infinity:
The reason is that as , the event becomes guaranteed, so only remains.
Bayes' rule for conditional PMFs
We can relate the conditional distribution of given to the conditional distribution of given using Bayes' rule:
LOTP for marginal PMFs
Using the law of total probability, we can also get the marginal PMF of as a weighted average of conditional PMFs:
Here the weights are the probabilities .
Bayes and LOTP: discrete/continuous summary
Here are the four versions of Bayes’ rule, depending on whether X and Y are discrete or continuous.
Y discrete
Y continuous
X discrete
And here are the four versions of LOTP. The top row gives expressions for , while the bottom row gives expressions for .
Y discrete
Y continuous
X discrete
Continuous joint distributions
For continuous random variables, the joint CDF is still
Joint PDF
If and are continuous with joint CDF , their joint PDF is the derivative of the joint CDF with respect to both variables:
A valid joint PDF must satisfy:
and
In the one-variable continuous case, the PDF is the function we integrate to get the probability of an interval. Similarly, the joint PDF is the function we integrate to get the probability of a two-dimensional region.
For example,
Marginal PDF
For continuous random variables and with joint PDF , the marginal PDF of is
This is the PDF of when we view individually rather than jointly with .
The same idea works with more than two random variables. For example, if we have the joint PDF of but want the joint PDF of , we integrate out the variables we do not want:
Marginalization means: keep the variables you care about, and sum or integrate over all possible values of the variables you are removing.
Conditional PDF
For continuous random variables and with joint PDF , the conditional PDF of given is
This is like taking the slice of the joint PDF at the fixed value , and then renormalizing it so that the total area over becomes .
If , then conditioning on is not defined in the usual way, because the denominator would be zero.
The slightly weird thing is that for a continuous random variable,
So how can we condition on at all? Rigorously, we are really conditioning on a tiny interval around , like
and then taking the limit as .
We usually do not fuss over this technicality because the formulas work exactly the way we want.
Continuous Bayes' rule and LOTP
For continuous random variables and , Bayes' rule becomes
The law of total probability becomes
This is the continuous version of the weighted average idea. In the discrete case, we summed over all possible values of . In the continuous case, we integrate over all possible values of .
The LOTP formula follows from marginalization:
If instead we plug in
then we get
So for any with ,
This matches the earlier discrete intuition: once we know that has happened, we are in a new world. Inside that new world, must take some value, so the conditional distribution over all possible values must add up to .
Independence of continuous random variables
Random variables and are independent if for all and ,
If and are continuous with joint PDF , this is equivalent to
for all .
It is also equivalent to saying
whenever .
That last equation says: once we know , the distribution of does not change. So gives us no information about .
Factorization and independence
Suppose the joint PDF factors as
for all and , where and are nonnegative functions.
Then and are independent.
At first this feels obvious: if breaks cleanly into an -part and a -part, then the variables should be independent.
But there is a hidden trap: just because the joint PDF splits does not mean the two pieces are themselves valid PDFs.
For example,
This splits into
and
But is not a valid PDF on , because
A valid PDF must integrate to . So the pieces may need to be rescaled before they become the true marginal PDFs.
The proof handles this by letting
Then rewrite the joint PDF as
Now integrates to , so it behaves like a valid PDF. When we integrate out , we get
So the true marginal PDF of is . Similarly, the true marginal PDF of is .
Therefore,
which proves independence.
The point is: factorization shows independence, but the factors may need a constant adjustment before they are literally the marginal PDFs.
2D LOTUS
Let be a function from to .
If and are discrete, then
If and are continuous with joint PDF , then
This is just LOTUS with two inputs instead of one. Instead of weighting each value by the PMF or PDF of one random variable, we weight each pair by the joint distribution of .
Covariance and correlation
Positive covariance between and indicates that when goes up, also tends to go up. Negative covariance indicates that when goes up, tends to go down.
Covariance
The covariance between random variables and is
Multiplying this out and using linearity, we get the equivalent formula
Independence and covariance
If and are independent, then they are uncorrelated:
The converse is false. If two random variables are uncorrelated, that does not necessarily mean they are independent.
Independence is a much stronger condition. It says the full joint behavior factors cleanly. Covariance only checks one kind of linear relationship.
Covariance properties
Covariance has the following key properties.
.
.
for any constant .
for any constant .
.
.
.
For random variables ,
So variance of a sum is not just the sum of variances unless the covariance terms vanish.
Correlation
The correlation between random variables and is
Correlation is the standardized version of covariance. Covariance depends on the units of and , but correlation is unitless.
For any random variables and with positive variances,
Multinomial distribution
Story
Each of objects is independently placed into one of categories.
An object is placed into category with probability , where the are nonnegative and
Let be the number of objects in category 1, the number of objects in category 2, and so on. Then
The random vector
is said to have the Multinomial distribution with parameters and .
We write
We call a random vector because it is a vector of random variables.
Multinomial joint PMF
If
then the joint PMF is
for satisfying
The factorial part counts how many ways the category labels can appear across the objects, and the probability part gives the probability of any one such arrangement.
Multinomial marginals
The marginals of a Multinomial are Binomial.
Specifically, if
then
This makes sense because if we only care whether each object lands in category or not, then each object becomes a Bernoulli trial with success probability .
Multinomial lumping
If
then for any distinct and ,
Merging categories keeps the distribution Multinomial. For example, merging categories 1 and 2 gives
The intuition is simple: if two categories are treated as one combined bucket, their probabilities add.
Multinomial conditioning
If
then conditioning on leaves objects to be distributed among the remaining categories.
So
where
This is the same “new world” idea from conditional probability. Once we know category 1 already got objects, we only look at the remaining categories, and their probabilities need to be renormalized so they add to 1.
Covariance in a Multinomial
Let
where .
For ,
The covariance is negative because the category counts compete with each other. If more objects land in category , fewer objects are available to land in category .
Multivariate Normal distribution
A -dimensional random vector
is said to have a Multivariate Normal distribution if every linear combination of the components has a Normal distribution.
That is, for any constants ,
must have a Normal distribution.
If the linear combination is just a constant, such as when all , we still count it as Normal, but as a degenerate Normal with variance .
The important special case when is called the Bivariate Normal distribution.
Marginals of an MVN
If
is Multivariate Normal, then each individual component is Normal.
For example, to get the marginal distribution of , choose and all the other . Then the linear combination is just , so must be Normal.
But the converse is false. It is possible for to each be Normally distributed individually, while the vector
is not Multivariate Normal.
Subvectors of an MVN
If
is Multivariate Normal, then
is also Multivariate Normal.
The reason is simple: any linear combination
can be viewed as a linear combination of where the coefficient of is :
Since the full vector is MVN, this linear combination is Normal. Therefore the subvector is MVN.
Combining independent MVN vectors
If
and
are Multivariate Normal random vectors, and is independent of , then the combined vector
is also Multivariate Normal.
Parameters of an MVN
A Multivariate Normal distribution is fully specified by:
The mean of each component.
The variance of each component.
The covariance, or correlation, between every pair of components.
Equivalently, the parameters are:
- The mean vector
where
- The covariance matrix, whose row , column entry is
For a Bivariate Normal random vector , we need five parameters:
Standard Bivariate Normal PDF
If is Bivariate Normal with standard Normal marginals and correlation , then its joint PDF is
where
So the correlation parameter controls how much the joint density tilts away from the independent circular-looking case.
Uncorrelated implies independent inside an MVN
For general random variables, uncorrelated does not imply independent.
But inside a Multivariate Normal random vector, uncorrelated does imply independent.
More generally, if
can be split into two subvectors
and every component of is uncorrelated with every component of , then and are independent.
In particular, if is Bivariate Normal and
then and are independent.
This is a special property of the Multivariate Normal family. Outside the MVN world, zero correlation is not enough to conclude independence.
Conditional expectation
Conditional expectation given an event
Let be an event with positive probability.
If is a discrete random variable, then the conditional expectation of given is
where the sum is over the support of .
If is a continuous random variable with PDF , then
where the conditional PDF is defined as the derivative of the conditional CDF
It can also be computed by a hybrid version of Bayes' rule:
Law of total expectation
Let be a partition of the sample space, with for all , and let be a random variable on this sample space. Then
This is basically LOTP, but for expectation instead of probability. We split the universe into cases, find the average value of inside each case, and then take a weighted average using the probabilities of the cases.
Conditional expectation given a random variable
The key to understanding is first to understand .
Since is an event, is just the conditional expectation of given this event. We compute it using the conditional distribution of given .
If is discrete, we use the conditional PMF in place of the unconditional PMF :
If is continuous, we use the conditional PDF in place of the unconditional PDF:
Now is the random variable you get by plugging the random value of into this function.
So if
then
This is why conditional expectation given a random variable is itself a random variable. Before we observe , we do not know which conditional mean we will use. After is known, the value of becomes fixed.
Properties of conditional expectation
Conditional expectation has some very useful properties.
Dropping what is independent
If and are independent, then
This makes sense: if knowing gives no information about , then the best conditional guess for is just its ordinary mean.
Taking out what is known
For any function ,
The reason is that once we condition on , anything that is purely a function of is already known. So it behaves like a constant inside the conditional expectation.
Linearity
Conditional expectation is linear:
and for any constant ,
Adam's law
Adam's law says
The intuition is: first average within each value of , then average those conditional averages over the distribution of . You get back the overall average of .
Projection interpretation
The random variable
is called the residual from using to predict .
This residual is uncorrelated with for any function . In other words, after subtracting off the best prediction of based on , there is no remaining linear relationship with any function of .
Conditional variance
The conditional variance of given is
This is equivalent to the shortcut formula
So conditional variance measures the remaining spread of after is known.