Tutorials › Exam P - Probability › Conditional Means for Discrete Conditioning Variables

Exam P · Conditional Expectation and Decomposition · Tutorial 771 of 915

Conditional Means for Discrete Conditioning Variables

Use the conditional pmf to find \(E[X\mid Y=y]\) and organize the resulting values as a function of discrete \(Y\).

Advanced 12 min read

What You'll Learn

  • Find the marginal probability of a conditioning value by summing its joint-pmf row.
  • Normalize a joint-pmf row to obtain the conditional pmf.
  • Calculate \(E[X\mid Y=y]\) by weighting each possible value of \(X\) by its conditional probability.
  • Express conditional means for all possible values of a discrete \(Y\) as a function.
  • Check that conditional probabilities sum to one and avoid dividing by the wrong probability.

Why Conditional Means Matter

A mean can describe different groups differently. For example, a hypothetical insurer might want the average payment \(X\) among claims from each risk tier \(Y\). A single overall average would not show how the expected payment changes across tiers. The conditional mean \(E[X\mid Y=y]\) answers the group-specific question: among outcomes for which \(Y=y\), what is the average value of \(X\)?

The calculation is an expectation using the conditional distribution of \(X\), not the unconditional distribution. The essential steps are to identify the outcomes compatible with \(Y=y\), find their conditional probabilities, and take a probability-weighted average. Repeating those steps for each possible value of \(Y\) gives the conditional mean function.

Definition: Let \(X\) and \(Y\) be discrete random variables with a specified joint probability mass function. For a value \(y\) such that \(P(Y=y)>0\), the conditional probability mass function of \(X\) given \(Y=y\) is $$ P(X=x\mid Y=y)=\frac{P(X=x,Y=y)}{P(Y=y)}. $$ If the conditional expectation is finite, the conditional mean is $$ E[X\mid Y=y]=\sum_x xP(X=x\mid Y=y) =\frac{\sum_x xP(X=x,Y=y)}{P(Y=y)}. $$ The sums range over the possible values of \(X\) that can occur with \(Y=y\).

From a Joint PMF to a Conditional Mean

The denominator \(P(Y=y)\) is the marginal probability of the conditioning value. For discrete variables, find it by adding the joint probabilities over all possible \(x\):

$$ P(Y=y)=\sum_x P(X=x,Y=y). $$

This sum is the total probability in the row corresponding to \(Y=y\) in a joint-probability table. Dividing each entry in that row by the row total makes the conditional probabilities add to one. Then \(E[X\mid Y=y]\) is the weighted average of the \(X\)-values using those conditional probabilities.

The conditional mean is defined by this formula only for conditioning values with positive probability. If \(P(Y=y)=0\), the displayed ratio has a zero denominator, so it cannot be used to define a conditional mean at that value. In exam calculations, check that the conditioning value has positive probability before dividing.

Why the Formula Holds

The justification follows directly from the definition of conditional probability and the definition of expectation for a discrete variable. Start with the expectation of \(X\) under its conditional distribution. Replace each conditional probability with its joint-probability ratio, and then factor out the common denominator:

$$ \begin{aligned} E[X\mid Y=y] &=\sum_x xP(X=x\mid Y=y)\\ &=\sum_x x\frac{P(X=x,Y=y)}{P(Y=y)}\\ &=\frac{\sum_x xP(X=x,Y=y)}{P(Y=y)}. \end{aligned} $$

The numerator accumulates each possible \(X\)-value weighted by the probability of that value occurring together with the specified \(Y\). The denominator restricts the probability scale to the outcomes with \(Y=y\). Thus, the ratio is an average within that conditioning group, rather than an average across the entire joint distribution.

Worked Examples

Worked Example: Conditional Means From a Joint Table

A hypothetical benefit plan records a payment \(X\), in thousands of dollars, and a discrete service category \(Y\). Its joint pmf is given below. Find \(E[X\mid Y=y]\) for every possible value of \(Y\), and express the result as a function of \(Y\).

\(X=0\)\(X=2\)\(X=6\)\(P(Y=y)\)
\(Y=0\)0.150.150.000.30
\(Y=1\)0.100.200.100.40
\(Y=2\)0.000.100.200.30

The distribution is the stated joint pmf; all entries sum to \(0.15+0.15+0.10+0.20+0.10+0.10+0.20=1.00\). The conditional means use payments in thousands of dollars. No interest rate or mortality assumption is involved.

For \(Y=0\). The row total is \(0.15+0.15+0.00=0.30\). The conditional probabilities for \(X=0,2,6\) are \(0.15/0.30=0.50\), \(0.15/0.30=0.50\), and \(0.00/0.30=0.00\). Therefore,

$$ E[X\mid Y=0]=0(0.50)+2(0.50)+6(0.00)=1. $$

For \(Y=1\). The row total is \(0.10+0.20+0.10=0.40\). The conditional probabilities are \(0.10/0.40=0.25\), \(0.20/0.40=0.50\), and \(0.10/0.40=0.25\). Thus,

$$ E[X\mid Y=1]=0(0.25)+2(0.50)+6(0.25)=0+1+1.5=2.5. $$

For \(Y=2\). The row total is \(0.00+0.10+0.20=0.30\). The conditional probabilities are \(0/0.30=0\), \(0.10/0.30=1/3\), and \(0.20/0.30=2/3\). Hence,

$$ E[X\mid Y=2]=0(0)+2\left(\frac{1}{3}\right)+6\left(\frac{2}{3}\right) =\frac{2}{3}+4=\frac{14}{3}. $$

The result, in thousands of dollars, is \(E[X\mid Y=0]=1\), \(E[X\mid Y=1]=2.5\), and \(E[X\mid Y=2]=14/3\). As a check, each row's conditional probabilities sum to one, and each reported mean lies between the smallest and largest \(X\)-values with positive probability in that row. In dollars, the three means are \(\$1{,}000\), \(\$2{,}500\), and approximately \(\$4{,}666.67\), with the last amount rounded to the nearest cent.

Worked Example: Unequal Row Totals and a Calculation Trap

A hypothetical service desk records \(X\), the number of follow-up calls for an account, and \(Y\), an indicator equal to 0 or 1 for the account's service route. The joint pmf is \(P(X=1,Y=0)=0.18\), \(P(X=3,Y=0)=0.12\), \(P(X=1,Y=1)=0.10\), \(P(X=3,Y=1)=0.25\), and \(P(X=5,Y=1)=0.35\). Find the conditional mean for both route values. The model is the joint pmf just stated; interest and mortality assumptions do not apply.

First check the total probability: \(0.18+0.12+0.10+0.25+0.35=1.00\). For \(Y=0\), the marginal probability is \(P(Y=0)=0.18+0.12=0.30\). The conditional probabilities are \(0.18/0.30=0.60\) for \(X=1\) and \(0.12/0.30=0.40\) for \(X=3\). Then

$$ E[X\mid Y=0]=1(0.60)+3(0.40)=0.60+1.20=1.80. $$

For \(Y=1\), \(P(Y=1)=0.10+0.25+0.35=0.70\). The conditional probabilities for \(X=1,3,5\) are \(0.10/0.70=1/7\), \(0.25/0.70=5/14\), and \(0.35/0.70=1/2\). They sum to \(1/7+5/14+1/2=2/14+5/14+7/14=1\). The conditional mean is

$$ \begin{aligned} E[X\mid Y=1] &=1\left(\frac{1}{7}\right)+3\left(\frac{5}{14}\right)+5\left(\frac{1}{2}\right)\\ &=\frac{2}{14}+\frac{15}{14}+\frac{35}{14} =\frac{52}{14}=\frac{26}{7}\approx3.7143. \end{aligned} $$

The conditional mean function is \(m(0)=1.8\) and \(m(1)=26/7\), where \(m(y)=E[X\mid Y=y]\). The decimal is rounded to four places. A common incorrect calculation for \(Y=1\) is to divide the joint weighted total \(1(0.10)+3(0.25)+5(0.35)=2.60\) by 1, giving \(2.60\). That uses all outcomes as the denominator. The correct denominator is \(P(Y=1)=0.70\), so \(2.60/0.70=26/7\). The conditional mean is also between 1 and 5, the possible \(X\)-values in that row.

Worked Example: Using a Conditional PMF to Build the Mean Function

A hypothetical portfolio has a discrete risk tier \(Y\) with \(P(Y=0)=0.20\), \(P(Y=1)=0.50\), and \(P(Y=2)=0.30\). The payment \(X\), in thousands of dollars, has the following conditional pmfs. Find \(E[X\mid Y=y]\) for each tier and write the conditional mean function. This model specifies the marginal distribution of \(Y\) and the conditional distribution of \(X\) within each tier; no interest or mortality assumptions apply.

Tier \(y\)Conditional distribution of \(X\)
0\(P(X=0\mid Y=0)=0.50,\ P(X=2\mid Y=0)=0.50\)
1\(P(X=0\mid Y=1)=0.20,\ P(X=2\mid Y=1)=0.50,\ P(X=5\mid Y=1)=0.30\)
2\(P(X=2\mid Y=2)=0.25,\ P(X=5\mid Y=2)=0.75\)

Each listed conditional distribution sums to one: \(0.50+0.50=1\), \(0.20+0.50+0.30=1\), and \(0.25+0.75=1\). Since the conditional probabilities are already given, there is no need to divide a joint probability by \(P(Y=y)\) again.

For tier 0,

$$ E[X\mid Y=0]=0(0.50)+2(0.50)=1. $$

For tier 1,

$$ E[X\mid Y=1]=0(0.20)+2(0.50)+5(0.30)=0+1+1.5=2.5. $$

For tier 2,

$$ E[X\mid Y=2]=2(0.25)+5(0.75)=0.50+3.75=4.25. $$

Therefore the function on the possible values of \(Y\) is

$$ m(y)=E[X\mid Y=y]= \begin{cases} 1, & y=0,\\ 2.5, & y=1,\\ 4.25, & y=2. \end{cases} $$

The values are in thousands of dollars. The conditional means increase across these tiers, but this conclusion concerns only the specified model; it does not establish a general relationship between risk tiers and payments.

Writing the Conditional Mean as a Function

When \(Y\) can take several values, report the collection of conditional means with the value of \(Y\) attached to each one. A table or a piecewise definition is usually clearest. In concise notation, define \(m(y)=E[X\mid Y=y]\) for each \(y\) with \(P(Y=y)>0\). Then \(E[X\mid Y]\) is commonly written to indicate that the relevant mean is selected by the realized value of \(Y\): if \(Y=y\), its value is \(m(y)\). This is a way to organize the answers, not a reason to average the conditional means without using the probabilities of their conditioning values.

A useful calculation sequence is:

1
Check the model.
Identify whether the problem gives a joint pmf or conditional pmfs, and list the possible values of \(X\) and \(Y\).
2
Fix one conditioning value.
For a joint pmf, calculate \(P(Y=y)\) by summing the joint probabilities in the corresponding row.
3
Form the conditional distribution.
Divide each joint probability in that row by its row total. If conditional probabilities were already supplied, use them directly.
4
Take the weighted average.
Multiply each \(X\)-value by its conditional probability and add the products.
5
Repeat and check.
Calculate the mean for each positive-probability value of \(Y\); verify each conditional pmf sums to one and each mean is within its conditional support.

Common Exam Traps

  • Using the wrong denominator. For \(E[X\mid Y=y]\), divide by \(P(Y=y)\), not by 1 and not by \(P(X=x)\). The denominator is the probability of the event being conditioned on.
  • Forgetting to normalize a joint-pmf row. Joint probabilities in a row generally sum to \(P(Y=y)\), not to 1. They must be divided by that row total before they serve as conditional probabilities.
  • Dropping a possible value of \(X\). Include every value with positive joint probability at the specified \(y\). A zero-probability entry contributes zero, but a nonzero entry cannot be omitted.
  • Confusing \(E[X\mid Y=y]\) with \(E[X]\). The former averages only among outcomes with \(Y=y\). The latter uses the unconditional distribution of \(X\).
  • Reporting an impossible mean. A conditional mean must lie between the smallest and largest \(X\)-values that have positive conditional probability. A result outside that range usually signals an arithmetic or normalization error.

These checks are especially useful when the rows of a joint table have different totals. A row with a larger total is more probable overall, but its entries still need to be normalized by its own total to calculate a mean within that row.

Key takeaway: For a discrete conditioning value \(y\) with \(P(Y=y)>0\), \(E[X\mid Y=y]\) is the weighted average of \(X\) under the conditional pmf. Obtain that pmf by dividing each joint probability in the \(Y=y\) row by the row total, then repeat across possible values of \(Y\) to write the conditional mean function.

Check Your Understanding

For each problem, identify the relevant conditional distribution before calculating. Unless otherwise stated, probabilities are exact and no interest or mortality assumptions apply.

  1. A joint pmf has \(P(X=1,Y=2)=0.12\), \(P(X=4,Y=2)=0.18\), and \(P(X=7,Y=2)=0.10\). Calculate \(E[X\mid Y=2]\). (Answer: \(3.85\).)
  2. A joint pmf has \(P(X=0,Y=0)=0.16\), \(P(X=3,Y=0)=0.24\), \(P(X=0,Y=1)=0.10\), \(P(X=3,Y=1)=0.20\), and \(P(X=6,Y=1)=0.30\). Find \(E[X\mid Y=0]\) and \(E[X\mid Y=1]\), and give the function on the support of \(Y\). (Answer: \(m(0)=1.8,\ m(1)=4\).)
  3. The marginal probabilities are \(P(Y=0)=0.40\) and \(P(Y=1)=0.60\). Given \(Y=0\), \(X=1\) with probability \(0.40\) and \(X=4\) with probability \(0.60\). Given \(Y=1\), \(X=0,2,5\) with probabilities \(0.25,0.50,0.25\), respectively. Calculate the conditional mean function. (Answer: \(m(0)=2.8,\ m(1)=2.25\).)
  4. A joint pmf has \(P(X=0,Y=0)=0.15\), \(P(X=2,Y=0)=0.25\), \(P(X=0,Y=1)=0.10\), \(P(X=2,Y=1)=0.20\), and \(P(X=5,Y=1)=0.30\). Calculate both conditional means and state the row totals used as denominators. (Answer: \(P(Y=0)=0.40,\ E[X\mid Y=0]=1.25;\ P(Y=1)=0.60,\ E[X\mid Y=1]=3.1667\), with the latter rounded to four decimals.)
  5. For \(Y=2\), \(X\) has conditional support \(0,4,10\). The conditional probability of \(X=4\) is \(0.50\), and \(E[X\mid Y=2]=6\). Determine the conditional probabilities of \(X=0\) and \(X=10\). (Answer: \(P(X=0\mid Y=2)=0.10,\ P(X=10\mid Y=2)=0.40\).)
Clinical Biostats