The basic idea of conditioning is the re-evaluation of the probabilities when new information becomes available in terms of the occurrence of given events. The idea can be extended to random variables: it is of interest to re-evaluate the density, or distribution function, of the random variable when new information becomes available. Discrete and continuous random variables are treated in parallel, pointing out the differences where necessary.
There are at least three different types of events with respect to which the distribution function (or density) of a random variable can be conditioned.
Type 1: the event E⊂Ω is not defined in terms of X
The conditional DF is defined as
FX∣E(x)=P(X≤x∣E).
In principle FX∣E(x)=P(X≤x∣E)=P(E)P([X≤x]∩E), but in practice, very often, FX∣E(x) is part of the data of the problem at hand and it is not computed.
The conditional density, discrete, absolutely continuous or mixed, is defined similarly:
discrete: pX∣E(xi)=P(X=xi∣E) for all xi∈X;
absolutely continuous: fX∣E(x∣E)=dxdFX∣E(x) for all x∈R.
Example (urn with coins). An urn contains 2 biased coins with P(H)=p=21 and 1 fair coin with P(H)=21. One coin is drawn from the urn; let E= "the coin drawn is biased". The random variable X which models one toss of the coin drawn has conditional density (convince yourself)
pX∣E(x)=px(1−p)1−x,x∈{0,1}(0=Tails,1=Heads),
while
pX∣Ec(x)=(21)x(1−21)1−x=21,x∈{0,1}.
By the law of total probability one can also compute the mixture density
(P(E)=32 and P(Ec)=31: two biased coins out of three.) Mixture densities are an example of application of conditioning for random variables; more on this later.
Type 2: the event is defined in terms of X itself
E=[X∈B] for some B.
Example (geometric, memoryless). Let X∼Ge(p) geometric, with density pX(k)=(1−p)k−1p1(k−1). Consider the event E=[X>h]. The conditional density pX∣E(k)≡pX∣[X>h](k) is
As is already well known, pX∣Y(xi∣yj) is a density over X (for each fixed yj) and pY∣X(yj∣xi) is a density over Y.
Exercise (left by the notes). Compute ∑i,jpX∣Y(xi∣yj). Hint: for each fixed yj the sum over i is 1, so the double sum equals the number of values yj (of positive probability).
Remark. In practice the data of a problem are very often pX∣Y(xi∣yj) and pY(yj), or alternatively pY∣X(yj∣xi) and pX(xi). From the data it is then possible to construct the joint density pXY(xi,yj).
Idea. Re-evaluate the DF or density of X when an event is known to occur.
Type 1: E unrelated to X.FX∣E(x)=P(X≤x∣E)=P(E)P([X≤x]∩E) (often given as data); pX∣E(xi)=P(X=xi∣E); fX∣E=dxdFX∣E.
Urn (2 biased coins with p, 1 fair): pX∣E(x)=px(1−p)1−x, pX∣Ec(x)=21, mixture pX(x)=32px(1−p)1−x+31⋅21.
Type 2: E=[X∈B]. Geometric X∼Ge(p), E=[X>h]: pX∣E(k)=P(X>h)P(X=k)1(k−h−1)=(1−p)k−h−1p1(k−h−1)=pX(k−h) (memoryless; P(X>h)=(1−p)h).
Type 3: E=[Y=yj] (discrete).pX∣Y(xi∣yj)=pY(yj)pXY(xi,yj),pY∣X(yj∣xi)=pX(xi)pXY(xi,yj);
each is a density (sums to 1 over its own variable).
Joint from data: pXY=pX∣YpY=pY∣XpX.
Bayes: pY∣X(yj∣xi)=∑yℓpX∣Y(xi∣yℓ)pY(yℓ)pX∣Y(xi∣yj)pY(yj).
Typical mistakes. Dividing by the wrong marginal (pY for pX∣Y, pX for pY∣X); forgetting the indicator 1(k−h−1) (the conditional density vanishes for k≤h); weighting a mixture with the wrong P(E), P(Ec).