Random Variables and Distributions
A random variable X is a map from the sample space Ω to a set S.
E.g. let X be the RV that counts the number of heads for 2 coin flips. Then Ω={HH,HT,TH,TT} and S={0,1,2}.
A distribution of a random variable is a mapping from events (certain subset combinations of Ω, this is a very non-rigorous definition) to [0,1]. E.g. for the example above the distribution is the collection of probabilities P(X=x) for x∈S,
P(X=0)P(X=1)P(X=2)=P({TT})=41=P({HT,TH})=21=P({HH})=41
For discrete cases the distribution is given via the probability mass function (PMF),
pX(x)=P(X=x),x∈S
remember X is the RV, x is a given value.
For continuous distributions we give the distribution with the probability density function (pdf), pX(x) or fX(x), defined by
P(a≤X≤b)=∫abpX(x)dxand∫RpX(x)dx=1
The cumulative distribution function (CDF) is
FX(x)=P(X≤x)
So for any RV, P(X=x) or P(x1≤X≤x2) is a specific case, not the distribution itself. The distribution is defined through a PMF pX(x) (discrete) or a CDF FX(x) (all RVs), which may define a pdf pX(x) (continuous).
We denote the distribution of an RV with the ∼ notation, i.e. X∼D(θ) means X is distributed with D using parameters θ. E.g. X∼N(0,1) means X is normally distributed with mean 0 and variance 1.
Joint Distributions
A joint distribution is the distribution induced by multiple RVs together. E.g. remember the distribution of X defined P(X=x) for all x∈{0,1,2}. Now let Y be the RV that is 1 if the first flip is heads, 0 otherwise. Then the joint distribution of X,Y is
P(X=0,Y=0)P(X=1,Y=0)P(X=2,Y=0)=P({TT})=41=P({TH})=41=P(∅)=0P(X=0,Y=1)P(X=1,Y=1)P(X=2,Y=1)=P(∅)=0=P({HT})=41=P({HH})=41
The pdf or pmf of the joint distribution of 2 RVs X and Y is denoted pX,Y(x,y), or simply p(x,y). If discrete, pX,Y(x,y)=P(X=x,Y=y).
A marginal distribution is the distribution of only one RV in the context of a joint. E.g. pX(x),pY(y) are the marginals of X and Y, pX,Y(x,y) is the joint distribution.
For any joint distribution, we can recover a marginal by integrating the other out,
pX(x)=∫pX,Y(x,y)dy,collapses topX(x)=y∑pX,Y(x,y) in discrete
If the joint distribution factorizes, the RVs are independent (marginally independent). If pX,Y(x,y)=pX(x)pY(y) then X and Y are independent, and vice versa. Also denoted X⊥⊥Y.
Conditional Distributions
A conditional distribution is the distribution of one or multiple RVs conditioned on some other RVs. E.g. from the last example, in the conditional distribution of X∣Y,
P(X=0∣Y=0)=21
as Y=0 means X can only be 0 or 1 with equal probability.
pX∣Y(x∣y), or p(x∣y), is used to denote the pdf or pmf of the conditional distribution. Again p(x∣Y=i) is conditioning on a specific realization of Y, while p(x∣y) is the whole conditional distribution.
p(x∣y)=p(y)p(x,y)
If X and Y are independent, p(x∣y)=p(x), as information on Y doesn't give any information on X.
Note that abuse of notation is very common and not necessarily incorrect. For example, let D be a random variable with D=1 if someone has a disease and 0 if not. Then P(Sick)=P(D=1) would be an OK understanding without need for such a definition.
Law of Total Probability
The law of total probability states the probability of an event is the total probability of its different cases. For an event A,
p(A)=∫p(A∣Y=y)p(y)dyory∑p(A∣Y=y)P(Y=y)
E.g. from the example,
P(X=2)=P(X=2∣Y=0)P(Y=0)+P(X=2∣Y=1)P(Y=1)=0+21⋅21=41
Conditional Independence
RVs X and Y are conditionally independent given an RV Z if
- P(X∣Y,Z)=P(X∣Z),
- P(Y∣X,Z)=P(Y∣Z),
- P(X,Y∣Z)=P(X∣Z)⋅P(Y∣Z).
1 and 2 say knowledge of the other RV doesn't matter given Z, 3 says the joint distribution factorizes given Z. Also denoted X⊥⊥Y∣Z.
This generalizes to more RVs, e.g.
X1,X2,X3⊥⊥Y1,Y2∣Z1,Z2⟹P(X1,X2,X3,Y1,Y2∣Z1,Z2)=P(X1,X2,X3∣Z1,Z2)P(Y1,Y2∣Z1,Z2)
Semi-graphoid axioms For sets of RVs X,Y,Z,W,
- X⊥⊥Y∣Z⟺Y⊥⊥X∣Z,
- X⊥⊥Y∪W∣Z⟺X⊥⊥W∣Z and X⊥⊥Y∣Z∪W.
Bayes' Rule and Chain Rule
Bayes' Rule For RVs A,B,
P(A∣B)=P(B)P(B∣A)P(A)
Chain Rule For RVs X1,…,Xn,
P(X1,…,Xn)=i=1∏nP(Xi∣Xi−1,…,X1)