Tutorials › VEE Mathematical Statistics › Conditional Probability Mass Functions From Joint Tables

VEE Mathematical Statistics · Conditional Distributions and Expectations · Tutorial 285 of 880

Conditional Probability Mass Functions From Joint Tables

Use the joint table’s marginal to normalize the relevant row or column and obtain conditional probabilities.

Intermediate 12 min read

What You'll Learn

  • Derive a conditional pmf from the definition of conditional probability.
  • Find the conditioning variable’s marginal by summing the correct row or column.
  • Convert joint counts into conditional probabilities without confusing the denominator.
  • Calculate conditional probabilities for events containing several values.
  • Check that a conditional pmf is defined and sums to one.

Why Condition on a Particular Value?

A joint probability table describes two discrete random variables together. It can answer questions such as, “What is the probability of this pair of outcomes?” A conditional probability mass function (pmf) answers a narrower question: once one variable’s value is known, how are the possible values of the other variable distributed? This is useful whenever a classification, observation, or outcome is already known and the remaining uncertainty must be described.

The central calculation is a division: take the joint probability for a pair of values and divide it by the marginal probability of the value being conditioned on. The main practical challenge is choosing that denominator correctly. In a table, it is the total probability in the row or column corresponding to the stated condition.

Definition: Let \(X\) and \(Y\) be discrete random variables with joint pmf \(p_{X,Y}(x,y)=P(X=x,Y=y)\). The marginal pmf of \(Y\) is \(p_Y(y)=\sum_x p_{X,Y}(x,y)\). If \(p_Y(y)>0\), the conditional pmf of \(X\) given \(Y=y\) is
$$ p_{X\mid Y}(x\mid y)=P(X=x\mid Y=y) =\frac{p_{X,Y}(x,y)}{p_Y(y)}. $$
If \(p_Y(y)=0\), this conditional pmf is not defined by the usual conditional-probability ratio.

For a finite table, the marginal is found by adding the joint probabilities across all possible values of \(X\) while holding \(Y=y\) fixed. If \(Y\) is displayed in the columns, add down the column for \(y\). If \(Y\) is displayed in the rows, add across the row for \(y\). The layout does not change the rule: the denominator must be the probability of the condition.

Why the Division Produces a Conditional PMF

For any event \(B\) with \(P(B)>0\), conditional probability is defined by \(P(A\mid B)=P(A\cap B)/P(B)\). Apply this definition with \(A=\{X=x\}\) and \(B=\{Y=y\}\). Their intersection is the event that both equalities hold, so its probability is the joint pmf value \(p_{X,Y}(x,y)\). The probability of \(B\) is the marginal \(p_Y(y)\). This gives the conditional-pmf formula.

The same reasoning also explains why the resulting values form a pmf. For fixed \(y\) with positive marginal probability, sum the formula over all possible \(x\):

$$ \sum_x p_{X\mid Y}(x\mid y) =\sum_x\frac{p_{X,Y}(x,y)}{p_Y(y)} =\frac{\sum_x p_{X,Y}(x,y)}{p_Y(y)} =\frac{p_Y(y)}{p_Y(y)} =1. $$

Thus, conditioning selects the joint probabilities associated with the given value and rescales them to total one. Values of \(x\) that cannot occur with the condition have joint probability zero and therefore conditional probability zero.

Reading Conditional Probabilities from Tables

A table may contain probabilities or counts. When it contains probabilities, use the relevant joint probability in the numerator and the marginal probability in the denominator. When it contains counts from a common finite sample, the conditional probability is the relevant count divided by the total count among observations satisfying the condition. The common sample-size factor cancels: if a cell has count \(n_{xy}\) and the conditioning column has total \(n_y\), then \((n_{xy}/n)/(n_y/n)=n_{xy}/n_y\).

Before calculating, state which variable is being conditioned on and identify its value. That determines the denominator. Then calculate each conditional pmf entry, and finally add entries if the question asks for a set of values rather than a single value.

Worked Example: Conditional Group Probabilities from File Counts

A hypothetical review classifies 80 claim files by processing group \(X\in\{A,B,C\}\) and whether an alert was recorded, \(Y\in\{0,1\}\). The counts are shown below. Find the conditional pmf of \(X\) given an alert, the probability that the group is A or C given an alert, and the conditional pmf of \(X\) given no alert.

Group \(X\)No alert \(Y=0\)Alert \(Y=1\)Row total
A12820
B181230
C102030
Column total404080

Method. Condition on the alert status, so use the alert-column total, 40, as the denominator. The three alert counts are 8, 12, and 20. They sum to 40, so they exhaust the alert files.

$$ P(X=A\mid Y=1)=\frac{8}{40}=0.2000,\qquad P(X=B\mid Y=1)=\frac{12}{40}=0.3000,\qquad P(X=C\mid Y=1)=\frac{20}{40}=0.5000. $$

Therefore, the conditional pmf assigns probabilities \(0.2000, 0.3000, 0.5000\) to A, B, and C, respectively. The event “A or C” contains two mutually exclusive group values, so add their conditional probabilities:

$$ P(X=A\text{ or }X=C\mid Y=1) =\frac{8+20}{40} =\frac{28}{40} =0.7000. $$

For no alert, the conditioning column total is also 40. Thus,

$$ P(X=A\mid Y=0)=\frac{12}{40}=0.3000,\quad P(X=B\mid Y=0)=\frac{18}{40}=0.4500,\quad P(X=C\mid Y=0)=\frac{10}{40}=0.2500. $$

Check. The alert probabilities sum to \(0.2000+0.3000+0.5000=1.0000\), and the no-alert probabilities sum to \(0.3000+0.4500+0.2500=1.0000\). The error to avoid is dividing each count by the full 80 files: that would give joint probabilities, not probabilities conditional on alert or no alert.

Conditional PMFs from Joint Probabilities

With a probability table, first check that the table entries are joint probabilities and identify the marginal of the conditioning variable. Then divide each joint entry in the selected row or column by that marginal. The entries outside the selected row or column do not enter the conditional pmf.

Worked Example: Conditioning on a Column of a Joint PMF

For discrete variables \(X\) and \(Y\), suppose the joint pmf is given by the following table. Find the pmf of \(X\) given \(Y=2\), and calculate \(P(X\geq 1\mid Y=2)\).

\(X\)\(Y=1\)\(Y=2\)
00.100.05
10.150.20
20.250.25

Method. The marginal probability of \(Y=2\) is the sum of its column:

$$ P(Y=2)=0.05+0.20+0.25=0.50. $$

Because this marginal is positive, the conditional pmf is defined. Divide each entry in the \(Y=2\) column by \(0.50\):

$$ P(X=0\mid Y=2)=\frac{0.05}{0.50}=0.10,\quad P(X=1\mid Y=2)=\frac{0.20}{0.50}=0.40,\quad P(X=2\mid Y=2)=\frac{0.25}{0.50}=0.50. $$

The event \(X\geq1\) includes \(X=1\) and \(X=2\), so its conditional probability is

$$ P(X\geq1\mid Y=2)=0.40+0.50=0.90. $$

Check. The conditional probabilities sum to \(0.10+0.40+0.50=1.00\). The whole joint table also sums to \(0.10+0.05+0.15+0.20+0.25+0.25=1.00\). A common mistake is to use the row total for \(X=1\) as the denominator when computing \(P(X=1\mid Y=2)\). The condition is \(Y=2\), so the correct denominator is the \(Y=2\) marginal, \(0.50\), not the \(X=1\) marginal.

Changing Which Variable Is Conditioned On

A joint table supports conditional pmfs in either direction, but the calculation changes when the conditioning variable changes. To find \(X\) given \(Y=y\), use the \(Y=y\) marginal. To find \(Y\) given \(X=x\), use the \(X=x\) marginal. These are generally different distributions; the two variables must not be interchanged just because they appear in the same joint table.

Worked Example: Conditioning in Both Directions from Counts

A hypothetical portfolio review records a risk tier \(X\in\{\text{low},\text{medium},\text{high}\}\) and the number of review flags \(Y\in\{0,1,2\}\) for 48 files. Find the pmf of risk tier given exactly one flag, the probability of a non-low tier under that condition, and the pmf of the number of flags given a high tier.

Risk tier \(X\)\(Y=0\)\(Y=1\)\(Y=2\)Row total
Low84214
Medium57416
High36918
Column total16171548

Method for the first condition. Given \(Y=1\), the relevant column contains \(4,7,6\), and its total is \(4+7+6=17\). Hence,

$$ P(X=\text{low}\mid Y=1)=\frac{4}{17},\quad P(X=\text{medium}\mid Y=1)=\frac{7}{17},\quad P(X=\text{high}\mid Y=1)=\frac{6}{17}. $$

The probability of a non-low tier is the sum for medium and high:

$$ P(X\ne\text{low}\mid Y=1) =\frac{7}{17}+\frac{6}{17} =\frac{13}{17} \approx 0.7647. $$

Method for the reverse condition. Given a high tier, use the high row total, 18. The counts for zero, one, and two flags are 3, 6, and 9, respectively:

$$ P(Y=0\mid X=\text{high})=\frac{3}{18}=\frac{1}{6},\quad P(Y=1\mid X=\text{high})=\frac{6}{18}=\frac{1}{3},\quad P(Y=2\mid X=\text{high})=\frac{9}{18}=\frac{1}{2}. $$

Check. The first conditional probabilities sum to \((4+7+6)/17=1\); the second sum to \((3+6+9)/18=1\). The error to avoid is keeping the denominator 17 when reversing the condition. For \(Y\) given \(X=\text{high}\), the condition selects a row, so the denominator is 18.

A Reliable Table Procedure and Common Traps

The conditional-pmf calculation is short, but errors often come from reading the condition too quickly. Use the following sequence whenever a table is given:

1
Name the condition.
Write the variable and its specified value, such as \(Y=1\). This identifies which marginal is needed.
2
Find the marginal.
Sum the joint probabilities or counts over all possible values of the other variable while keeping the condition fixed.
3
Normalize each relevant entry.
Divide each joint probability or count in the selected row or column by the conditioning marginal or count total.
4
Answer the event question.
If the event includes multiple values, add the corresponding conditional pmf entries.
5
Check the result.
Verify that the conditional pmf entries sum to one and that the conditioning marginal is positive.

A typical wrong calculation makes the numerator and denominator refer to different conditions. For example, in the 48-file table above, dividing the high-tier, one-flag count 6 by the high-tier row total 18 gives \(P(Y=1\mid X=\text{high})=6/18\). It does not give \(P(X=\text{high}\mid Y=1)\). For the latter, the condition is one flag, so the denominator is the one-flag total 17, and the answer is \(6/17\). Both ratios are valid conditional probabilities, but they answer different questions.

Another important limitation is a zero marginal. If a table assigns probability zero to \(Y=y\), then the ratio for conditioning on \(Y=y\) has a zero denominator. The usual discrete conditional pmf is not specified by this formula at that value. Do not divide by zero or silently choose a denominator from a different row or column.

Key takeaway: In \(P(X=x\mid Y=y)\), the denominator is always \(P(Y=y)\). In a joint table, select the row or column for the condition, total it, and divide the relevant joint entries by that total. Then check that the conditional probabilities sum to one.

Check Your Understanding

For each problem, identify the conditioning marginal before calculating. Answers are given at the end of each question.

  1. A hypothetical review table has counts \((X=A,Y=0)=6\), \((X=A,Y=1)=4\), \((X=B,Y=0)=3\), and \((X=B,Y=1)=7\). Find the conditional pmf of \(X\) given \(Y=1\), and find \(P(X=A\mid Y=1)\). (Answer: \(P(X=A\mid Y=1)=4/11=0.3636\), \(P(X=B\mid Y=1)=7/11=0.6364\); requested probability \(0.3636\).)
  2. A joint pmf has \(P(X=0,Y=b)=0.08\), \(P(X=1,Y=b)=0.12\), and \(P(X=2,Y=b)=0.20\), with \(P(Y=b)=0.40\). Find the conditional pmf of \(X\) given \(Y=b\), and \(P(X\geq1\mid Y=b)\). (Answer: conditional probabilities \(0.2000, 0.3000, 0.5000\); \(P(X\geq1\mid Y=b)=0.8000\).)
  3. Among a hypothetical set of files, counts by tier and outcome are: low tier \((Y=0,Y=1)=(14,6)\), medium tier \((9,11)\), and high tier \((7,13)\). Find the pmf of tier given \(Y=0\), and the probability of medium or high tier given \(Y=0\). (Answer: \(14/30=0.4667,\ 9/30=0.3000,\ 7/30=0.2333\); medium or high \(=16/30=0.5333\).)
  4. A joint probability table assigns \(P(X=0,Y=0)=0.20\), \(P(X=1,Y=0)=0.30\), and zero probability to every pair with \(Y=2\). Is \(P(X=1\mid Y=2)\) defined by the usual conditional-pmf formula? (Answer: No; \(P(Y=2)=0\), so the formula has a zero denominator.)
  5. A hypothetical count table has rows \(X=A,B,C\) and columns \(Y=0,1,2\): row A is \((3,5,2)\), row B is \((4,2,4)\), and row C is \((5,3,2)\). Find the conditional pmf of \(X\) given \(Y=2\), and \(P(X=A\text{ or }X=C\mid Y=2)\). (Answer: the \(Y=2\) total is 8; conditional probabilities for A, B, C are \(2/8,4/8,2/8\); requested probability \(4/8=0.5000\).)
Clinical Biostats