A parcel is selected from a constructed shipping model, and you learn that it took the express route. The question of how likely an inspection is now concerns express parcels only, so the overall inspection rate may no longer be the right answer. This lesson shows how to turn the matching row of a joint table into a complete distribution given that information, how to compute a mean from it, and how to keep conditional, marginal and joint probabilities apart.
Key terms
Conditional probability mass function
Definition Let and be discrete random variables with joint PMF , and let be a value with . The conditional PMF of given is
for every real , which is the conditional probability . For fixed it is a PMF in . Its masses are nonnegative and add to , since the numerators add to . It is positive exactly at the values with , which form the conditional support. If , the conditional PMF given is not defined. The conditional PMF of given is defined in the same way when .
In plain words Learning that keeps only the outcomes in row of the joint table. The conditional PMF spreads all of the probability over that row, in the same proportions the row already had.
Example In the parcel model, for express and for standard routing, and for an extra inspection and for none. The joint table with its margins is
Given , the conditional masses are and , which add to . Among express parcels the inspection probability is , compared with over all parcels.
Renormalizing a row or column
Definition To find the conditional PMF of given from a joint table, take row , check that its total is positive, and divide every entry of the row by that total. To find the conditional PMF of given , do the same with column and its total . Dividing by one common positive number keeps every ratio between entries of the row or column, keeps zero entries at zero and makes the new total .
In plain words The selected row or column becomes the whole world. Its entries keep their relative sizes and are rescaled so that they add to one.
Example In the parcel table the row has entries and with total , so given standard routing, equals or with probabilities and . The row has entries and in the ratio to , and they become and . So the inspection probability is for standard parcels, for express parcels and overall. The overall value lies between the two conditional values because it is a weighted average of them, but it equals neither. A zero entry stays zero. Toss a fair coin twice, and let be the number of heads on the first toss and the total number of heads. The row has entries , and for , so given the total is or with probability each, and the conditional support is .
Reversed conditioning
Definition Let and . The probabilities and have the same numerator , but the first divides it by the row total and the second by the column total . They are linked by Bayes’ theorem,
When , the two conditional probabilities are equal exactly when .
In plain words Read what comes after the bar first. It names the group you are working inside, and that group decides the denominator. Swapping the two sides of the bar asks a different question.
Example In the parcel table, inspection among express parcels uses the row , which gives . Express routing among inspected parcels uses the column , which gives . So
The same cell is divided by two different totals. Renormalizing the whole column gives the conditional PMF of given , with mass at and at . Bayes’ theorem reaches the reversed value from the conditional probability and the two margins, since .
Conditional mean from a conditional PMF
Definition Let . The conditional mean of given is the mean of the conditional PMF,
where the sum runs over the conditional support. It exists when is finite, which always holds when has finitely many possible values. It is a number attached to the value , and it need not be a possible value of .
In plain words Find the right conditional distribution first, then average with its weights. Averaging with the raw joint masses of the row skips the division by the row total and in general gives a wrong answer.
Example In a constructed timing model, a task belongs to group A, coded , or to group B, coded , and it takes or minutes.
| , group A | |||
| , group B |
Dividing each row by its total gives the masses and at the times and in group A, and and in group B. Hence minutes and minutes. Neither mean is a possible duration. Weighting the times by the raw row entries of group A would give , which is the conditional mean multiplied by the row total and not the conditional mean itself.
Joint probability from conditional and marginal
Definition For every with and every real ,
and for every when . Adding over gives the law of total probability for PMFs,
where the sum runs over the values with . So is a weighted average of the conditional probabilities with weights . A plain average of the conditional probabilities agrees with it when the weights are equal, and in general it does not.
In plain words Conditioning divides a joint mass by a group total. Multiplying a within-group probability by the probability of the group undoes that step and recovers the joint mass, and adding over the groups recovers the overall probability.
Example Change the parcel model so that and , while the inspection probabilities stay for standard and for express parcels. The joint masses with inspection are and , and those without inspection are and , so the four cells add to . The overall inspection probability is
not the plain average of and . In the original model the two routes were equally likely, which is why the plain average happened to give the right value there. The timing table above was built the same way, since and .
Check yourself
- A joint table has the row for and the row for , with columns for and . Find and , and then the full conditional PMF of given .
Show the answer
The row has total , so . The reversed question uses the column , whose total is , so . The row has total , so given the variable equals with probability and with probability . These two masses add to .
- A joint PMF has the following table, and takes no values other than and .
Find and , and the conditional PMF of given . Can be computed?
Show the answer
The row has total , so given the masses at are , and . Only the value contributes to the mean, so
The row has total , so the conditional masses are , and , and
The column has total and entries and , so given the variable equals with probability . The conditional support is . The value has probability , so there is no row to renormalize. The conditional PMF of given is not defined, and neither is , because the formula would divide by zero.
- In a constructed model, 20 percent of parts come from line 1, coded , and the rest from line 0, coded . A check flags a part, coded , for 90 percent of the parts from line 1 and 10 percent of the parts from line 0. Build the joint table, and find and . A classmate answers for the last probability. What went wrong?
Show the answer
Multiplying each line’s probability by the conditional probabilities gives , , and , which add to . The column gives , and
The value is , the flag rate within line 1, which divides the cell by the row total instead of the column total . Here reversing the condition changes the denominator and with it the answer. A plain average of the two flag rates, , would also be wrong for , because the lines have weights and .