Tutorials › VEE Mathematical Statistics › Discrete Conditional Probability and Expectation Workshop

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

Discrete Conditional Probability and Expectation Workshop

Learn to move reliably between a discrete joint distribution, conditional calculations, and unconditional expectations.

Intermediate 9 min read

What You'll Learn

  • Read marginal probabilities from a discrete joint probability table.
  • Construct and check a conditional probability mass function.
  • Calculate conditional probabilities and expectations from a table.
  • Use indicator variables to simplify event probabilities and expected payouts.
  • Apply iterated expectation in a discrete mixture model.
  • Check calculations by comparing conditional and direct methods.

From a Joint Model to a Conditional Answer

Many discrete probability problems provide information about two variables together, then ask a question about one variable once the value of the other is known. The reliable approach is to start with the joint probability mass function (pmf), find the relevant marginal probability, and normalize the appropriate row or column. Once the conditional pmf is correct, conditional probabilities and expectations follow by summation.

This workshop combines that process with two useful tools: indicator variables for event calculations and iterated expectation for moving from conditional means to an overall mean. These methods are aligned with the SOA VEE Mathematical Statistics syllabus.

Definition: For discrete random variables \(X\) and \(Y\), the joint pmf is \(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)=p_{X,Y}(x,y)/p_Y(y)\).

The conditional probabilities over all possible values of \(X\) must add to one. A conditional expectation is the mean computed using this conditional pmf: \(E[X\mid Y=y]=\sum_x x\,p_{X\mid Y}(x\mid y)\), when the sum exists. More generally, for a function \(g\), \(E[g(X)\mid Y=y]=\sum_x g(x)p_{X\mid Y}(x\mid y)\). Conditioning on an event of probability zero is not defined by this elementary ratio formula.

Worked Example: Reading a Joint Table

Worked Example: A Conditional Claim Count

A hypothetical service desk records \(X\), the number of urgent requests in an hour, and \(Y\), an indicator that the hour was during a system alert (\(Y=1\)) or not (\(Y=0\)). The joint probabilities are shown below. Find the pmf of \(X\) given \(Y=1\), the probability that \(X\geq 1\) given an alert, and \(E[X\mid Y=1]\). Then check the unconditional mean using iterated expectation.

\(X\)\(Y=0\)\(Y=1\)Marginal \(P(X=x)\)
00.200.100.30
10.150.250.40
20.100.200.30
Marginal \(P(Y=y)\)0.450.551.00

Step 1: Check the joint table and find the conditioning probability. The six joint probabilities sum to \(0.20+0.10+0.15+0.25+0.10+0.20=1.00\). The alert-column total is \(P(Y=1)=0.10+0.25+0.20=0.55\), which is positive.

Step 2: Normalize the alert column. For \(X=0,1,2\), divide each entry in that column by \(0.55\):

$$ p_{X\mid Y}(0\mid 1)=\frac{0.10}{0.55}=\frac{2}{11},\qquad p_{X\mid Y}(1\mid 1)=\frac{0.25}{0.55}=\frac{5}{11},\qquad p_{X\mid Y}(2\mid 1)=\frac{0.20}{0.55}=\frac{4}{11}. $$

The conditional probabilities sum to \(2/11+5/11+4/11=1\), as required.

Step 3: Calculate the requested conditional probability. The event \(X\geq1\) includes \(X=1\) and \(X=2\), so \(P(X\geq1\mid Y=1)=5/11+4/11=9/11\), approximately \(0.8182\).

Step 4: Calculate the conditional expectation. \(E[X\mid Y=1]=0(2/11)+1(5/11)+2(4/11)=13/11\), approximately \(1.1818\) requests.

Step 5: Check by iterated expectation. The non-alert conditional mean is \(E[X\mid Y=0]=0(0.20/0.45)+1(0.15/0.45)+2(0.10/0.45)=0.35/0.45=7/9\). The unconditional mean from the table is \(E[X]=1(0.40)+2(0.30)=1\). Using the conditional means gives \(0.45(7/9)+0.55(13/11)=0.35+0.65=1\), matching the direct calculation.

Method and trap avoided. The method is to obtain the marginal probability of the conditioning value, then divide each joint probability in that slice by the marginal. A common wrong calculation reports \(P(X\geq1,Y=1)=0.25+0.20=0.45\) as the conditional probability. That is a joint probability, not a conditional one; the correction is \(0.45/P(Y=1)=0.45/0.55=9/11\).

Indicators Make Event Calculations Manageable

An indicator variable records whether an event occurs. For an event \(A\), define \(I_A=1\) when \(A\) occurs and \(I_A=0\) otherwise. Its expectation is the event probability, because the value 1 contributes exactly when the event occurs:

$$ E[I_A]=1P(A)+0P(A^c)=P(A). $$

Indicators can also represent a sum of payments or counts. If a hypothetical reward is \(W=aI_A+bI_B+cI_{A\cap B}\), linearity gives \(E[W]=aP(A)+bP(B)+cP(A\cap B)\). Independence is not needed for this identity. If a conditional independence assumption is available, it can be used to calculate \(P(A\cap B\mid M)\), but it should not be silently assumed.

Worked Example: Expected Reward With Conditional Indicators

A hypothetical monitoring system operates in mode \(M=N\) (normal) with probability \(0.70\), and mode \(M=S\) (stress) with probability \(0.30\). Two alarms have indicators \(I_A\) and \(I_B\). Given the mode, the alarms are independent. Their probabilities are \(P(A\mid N)=0.10\), \(P(B\mid N)=0.20\), \(P(A\mid S)=0.40\), and \(P(B\mid S)=0.50\). The system awards \(W=50I_A+80I_B+30I_{A\cap B}\) points. Find the probability that at least one alarm occurs and the expected points.

Step 1: Find the conditional probability of at least one alarm. In normal mode, conditional independence gives \(P(A^c\cap B^c\mid N)=0.90(0.80)=0.72\). Therefore \(P(A\cup B\mid N)=1-0.72=0.28\). In stress mode, \(P(A^c\cap B^c\mid S)=0.60(0.50)=0.30\), so \(P(A\cup B\mid S)=1-0.30=0.70\).

Step 2: Average over the modes. The two modes form a partition, so \(P(A\cup B)=0.70(0.28)+0.30(0.70)=0.196+0.210=0.406\).

Step 3: Find the expected points in each mode. Given normal mode, \(P(A\cap B\mid N)=0.10(0.20)=0.02\). Thus \(E[W\mid N]=50(0.10)+80(0.20)+30(0.02)=5+16+0.6=21.6\). Given stress mode, \(P(A\cap B\mid S)=0.40(0.50)=0.20\), so \(E[W\mid S]=50(0.40)+80(0.50)+30(0.20)=20+40+6=66\).

Step 4: Average the conditional expectations. \(E[W]=0.70(21.6)+0.30(66)=15.12+19.8=34.92\) points.

Check and trap avoided. The conditional probabilities of at least one alarm lie between zero and one, and the overall probability \(0.406\) lies between the mode-specific values \(0.28\) and \(0.70\). One might incorrectly multiply the unconditional alarm probabilities to obtain \(P(A\cap B)\). The alarms were specified as independent only conditional on mode, so the correct unconditional joint probability is \(0.70(0.02)+0.30(0.20)=0.074\), not \(P(A)P(B)\). The indicator expectation calculation uses this joint probability, or equivalently averages the conditional calculations as above.

Why Iterated Expectation Works

For a discrete variable \(Y\), the law of iterated expectation says that an overall expectation can be calculated by first finding the conditional expectation at each possible value of \(Y\), then averaging those conditional expectations using the marginal pmf of \(Y\). For integrable \(X\), its discrete form is

Theorem: If \(X\) is integrable and \(Y\) is discrete, then \(E[X]=\sum_y E[X\mid Y=y]P(Y=y)\), where values with \(P(Y=y)=0\) contribute nothing. The same result holds with \(X\) replaced by any integrable function \(g(X,Y)\).

For finite supports, the formula follows directly by expanding each conditional expectation. Since \(p_{X,Y}(x,y)=p_{X\mid Y}(x\mid y)p_Y(y)\) whenever \(p_Y(y)>0\), we have

$$ \begin{aligned} \sum_y E[X\mid Y=y]P(Y=y) &=\sum_y\left(\sum_x x\,p_{X\mid Y}(x\mid y)\right)p_Y(y)\\ &=\sum_y\sum_x x\,p_{X,Y}(x,y)\\ &=E[X]. \end{aligned} $$

The second line simply replaces the product of a conditional probability and its marginal probability by the corresponding joint probability. The last line sums \(x\) over every pair \((x,y)\), which is precisely the expectation under the joint pmf. For countably infinite supports, the same interchange of sums is valid under the stated integrability condition; for a nonnegative random variable it is also valid with expectations possibly infinite.

Worked Example: A Mixture Distribution and a Nonlinear Reward

A hypothetical inspection process has batch type \(Q=A\) with probability \(0.40\) and \(Q=B\) with probability \(0.60\). The number \(X\) of flagged items has the following conditional pmfs: given \(A\), probabilities for \(X=0,1,2\) are \(0.20,0.50,0.30\); given \(B\), they are \(0.50,0.30,0.20\). Find the unconditional pmf of \(X\), \(E[X]\), and \(E[X^2]\). Check the last two results using conditional expectations.

Step 1: Combine the conditional pmfs to obtain the unconditional pmf. For each value \(x\), multiply each conditional probability by the probability of its batch type, then add:

$$ \begin{aligned} P(X=0)&=0.40(0.20)+0.60(0.50)=0.08+0.30=0.38,\\ P(X=1)&=0.40(0.50)+0.60(0.30)=0.20+0.18=0.38,\\ P(X=2)&=0.40(0.30)+0.60(0.20)=0.12+0.12=0.24. \end{aligned} $$

The probabilities sum to \(0.38+0.38+0.24=1\).

Step 2: Calculate the unconditional moments directly. \(E[X]=0(0.38)+1(0.38)+2(0.24)=0+0.38+0.48=0.86\). Also, \(E[X^2]=0^2(0.38)+1^2(0.38)+2^2(0.24)=0+0.38+0.96=1.34\).

Step 3: Check \(E[X]\) using the conditional means. \(E[X\mid A]=0(0.20)+1(0.50)+2(0.30)=0.50+0.60=1.10\). \(E[X\mid B]=0(0.50)+1(0.30)+2(0.20)=0.30+0.40=0.70\). Therefore \(E[X]=0.40(1.10)+0.60(0.70)=0.44+0.42=0.86\), as before.

Step 4: Check \(E[X^2]\) by applying iterated expectation to \(X^2\). \(E[X^2\mid A]=0^2(0.20)+1^2(0.50)+2^2(0.30)=0.50+1.20=1.70\). \(E[X^2\mid B]=0^2(0.50)+1^2(0.30)+2^2(0.20)=0.30+0.80=1.10\). Thus \(E[X^2]=0.40(1.70)+0.60(1.10)=0.68+0.66=1.34\), agreeing with the direct calculation.

Method and trap avoided. The mixture calculation weights each conditional probability or conditional expectation by the probability of its batch type. A common error is to average the two conditional means equally, giving \((1.10+0.70)/2=0.90\). That is incorrect because the types are not equally likely; the correct weights are \(0.40\) and \(0.60\). The direct pmf and iterated calculations agree, providing an independent arithmetic check.

A Reliable Workflow and Common Traps

In an exam-style discrete problem, separate the probability model from the requested calculation. A conditional table entry is not yet a conditional probability: it must be divided by the probability of the conditioning value. A conditional expectation is not an ordinary expectation under the marginal pmf unless the conditioning information has no effect on that distribution. For a mixture, weight each conditional result by the correct marginal probability.

1
Identify the conditioning event.
Write the event or value being conditioned on, and confirm it has positive probability.
2
Find its marginal probability.
Sum the relevant entries of the joint pmf or table slice.
3
Normalize or average.
Divide joint probabilities by the conditioning probability for a conditional pmf; weight conditional expectations by marginal probabilities for an overall expectation.
4
Check the result.
Conditional probabilities must sum to one, and an iterated expectation should match a direct expectation when both are readily available.

For indicator calculations, distinguish the event probability from its indicator expectation, even though they are numerically equal. Also distinguish conditional independence from unconditional independence: conditional probabilities may multiply within a given group, but the resulting unconditional joint probability must still be averaged across groups.

Key takeaway: A discrete conditional calculation has two essential parts: select the correct joint probabilities and normalize by the probability of the conditioning information. Indicators simplify event expectations, while iterated expectation recombines conditional results using the marginal probabilities of the conditioning variable.

Check Your Understanding

Work each problem from its stated model, checking normalization and conditioning weights where relevant.

  1. A joint pmf has \(P(X=0,Y=0)=0.30\), \(P(X=0,Y=1)=0.10\), \(P(X=1,Y=0)=0.20\), and \(P(X=1,Y=1)=0.40\). Find \(P(X=1\mid Y=0)\) and \(E[X\mid Y=0]\). (Answer: \(0.4000\) for both.)
  2. A hypothetical device has mode \(M=1\) with probability \(0.25\), and \(M=0\) with probability \(0.75\). The probability of a fault is \(0.40\) in mode 1 and \(0.08\) in mode 0. Find the overall fault probability by using an indicator and conditioning on mode. (Answer: \(0.1600\).)
  3. A discrete variable \(X\) has conditional pmf \(P(X=0,1,2\mid C)=(0.10,0.60,0.30)\). Find \(E[X\mid C]\) and \(E[X^2\mid C]\). (Answer: \(1.2000\) and \(1.8000\), respectively.)
  4. A mixture has \(P(G=A)=0.30\), \(P(G=B)=0.70\), \(E[X\mid A]=2\), and \(E[X\mid B]=5\). Find \(E[X]\). (Answer: \(4.1000\).)
  5. A joint pmf has \(P(X=0,Y=0)=0.20\), \(P(X=1,Y=0)=0.30\), \(P(X=0,Y=1)=0.10\), and \(P(X=1,Y=1)=0.40\). Find \(E[X\mid Y=1]\), then verify \(E[X]\) using iterated expectation. (Answer: \(E[X\mid Y=1]=0.8000\), and \(E[X]=0.7000\).)
Clinical Biostats