Tutorials › VEE Mathematical Statistics › Conditional Expectations for Discrete Variables

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

Conditional Expectations for Discrete Variables

Build a conditional probability mass function for the information given, then use its probabilities as weights to calculate the corresponding mean.

Intermediate 9 min read

What You'll Learn

  • Define a conditional mean from a conditional probability mass function.
  • Calculate conditional means given a discrete variable value or an event.
  • Normalize joint probabilities before using them as weights.
  • Derive the conditional mean in a parameterized finite-support model.
  • Identify errors caused by using joint probabilities without conditioning.

Why Conditional Means Matter

A mean describes a distribution, but the relevant distribution can change when information is available. For example, a hypothetical insurer might want the average number of claims among policyholders whose recorded vehicle type is a particular category. The unconditional average across all policyholders does not answer that question: the claim count must be weighted using its distribution within the selected group.

For a discrete variable, the calculation is a weighted sum over the possible values. The essential first step is to identify the correct conditional probability mass function (pmf). If conditioning is on an event, the joint probabilities for outcomes in that event must be divided by the probability of the event. If conditioning is on a value of another discrete variable, use the joint probabilities at that value and divide by its marginal probability.

Definition: Let \(X\) be a discrete random variable and let \(A\) be an event with \(P(A)>0\). The conditional pmf of \(X\) given \(A\) is \(P(X=x\mid A)\). If the weighted sum exists, the conditional expectation is
$$ E[X\mid A]=\sum_x xP(X=x\mid A). $$
If \(Y\) is discrete and \(P(Y=y)>0\), define \(E[X\mid Y=y]\) by the same weighted-sum formula, using the conditional pmf \(P(X=x\mid Y=y)\). For a finite support, the sum always exists; for a countable support, it must converge absolutely.

The condition \(P(A)>0\), or \(P(Y=y)>0\), matters: conditional probabilities given a zero-probability event or value are not defined by the elementary ratio formula used here. In this tutorial, all conditioning events and values have positive probability. The conditional mean is measured in the same units as \(X\), and it need not be one of the values that \(X\) can take.

From Joint Probabilities to a Conditional Mean

Suppose \(X\) and \(Y\) have a discrete joint distribution. To find the mean of \(X\) given \(Y=y\), first sum the joint probabilities across all possible \(x\)-values at that \(y\). That sum is \(P(Y=y)\). Divide each joint probability in that column by this marginal probability to obtain the conditional pmf, then calculate its weighted sum.

1
Find the conditioning probability.
For conditioning on \(Y=y\), calculate \(P(Y=y)=\sum_x P(X=x,Y=y)\). For an event \(A\), calculate \(P(A)\).
2
Normalize the relevant masses.
Divide each relevant joint probability by the conditioning probability to obtain conditional probabilities that sum to one.
3
Take the weighted sum.
Multiply each possible value of \(X\) by its conditional probability and add the products.

Worked Example: Conditioning on a Value in a Joint Table

A hypothetical service program records \(X\), the number of repair visits made by a randomly selected device during a month, and \(Y\), its assigned service tier. The joint probabilities are shown below. Find \(E[X\mid Y=\text{Standard}]\).

Number of visits, \(X\)BasicStandardPriority
00.140.060.10
10.160.180.10
20.100.060.10

Method: normalize the Standard column, then take its weighted sum. First check the joint law: the row totals are \(0.30\), \(0.44\), and \(0.26\), so the table total is \(0.30+0.44+0.26=1.00\). The probability of the conditioning value is the Standard-column total:

$$ P(Y=\text{Standard})=0.06+0.18+0.06=0.30. $$

Thus the conditional probabilities for \(X=0,1,2\), respectively, are

$$ P(X=0\mid Y=\text{Standard})=\frac{0.06}{0.30}=0.20,\qquad P(X=1\mid Y=\text{Standard})=\frac{0.18}{0.30}=0.60,\qquad P(X=2\mid Y=\text{Standard})=\frac{0.06}{0.30}=0.20. $$

They sum to \(0.20+0.60+0.20=1.00\), as required. Therefore,

$$ E[X\mid Y=\text{Standard}] =0(0.20)+1(0.60)+2(0.20) =0+0.60+0.40 =1.00. $$

The answer is 1.00 repair visits. A common mistake is to multiply the values of \(X\) by the Standard-column joint probabilities and stop at \(0.60\). That is not a conditional mean: those joint probabilities have total \(0.30\), not one. Dividing the weighted joint total \(0.18+2(0.06)=0.30\) by \(0.30\) gives the correct result, \(1.00\).

Conditioning on an Event

The condition need not specify a single value of \(Y\). It may select several values, such as \(Y\) belonging to a stated set. In that case, include every joint outcome satisfying the event, add the probabilities over those outcomes to get the event probability, and normalize the resulting masses. Do not include outcomes outside the event.

Worked Example: Conditioning on a Set of Categories

In a hypothetical quality study, \(X\) is the number of defects found on a component, and \(Y\) is its inspection route. The joint probabilities are:

\(X\)Route ARoute BRoute C
00.120.080.10
10.100.200.10
20.050.100.15

Find \(E[X\mid Y\in\{\text{Route A},\text{Route B}\}]\). The table sums to one: its row totals are \(0.30\), \(0.40\), and \(0.30\). Let \(A\) denote the event that the route is A or B. The selected joint masses for \(X=0,1,2\) are

$$ P(X=0,A)=0.12+0.08=0.20,\quad P(X=1,A)=0.10+0.20=0.30,\quad P(X=2,A)=0.05+0.10=0.15. $$

The probability of the conditioning event is \(P(A)=0.20+0.30+0.15=0.65\). Hence the conditional pmf is

$$ P(X=0\mid A)=\frac{0.20}{0.65}=\frac{4}{13},\quad P(X=1\mid A)=\frac{0.30}{0.65}=\frac{6}{13},\quad P(X=2\mid A)=\frac{0.15}{0.65}=\frac{3}{13}. $$

The probabilities sum to \((4+6+3)/13=1\). The conditional mean is

$$ E[X\mid A] =0\left(\frac{4}{13}\right)+1\left(\frac{6}{13}\right)+2\left(\frac{3}{13}\right) =\frac{12}{13} \approx 0.9231. $$

The answer is approximately 0.9231 defects, with the probability rounded to four decimal places. The method avoids a frequent event-conditioning error: Route C must be excluded both from the masses and from the conditioning probability.

Why the Normalization Formula Works

The conditional mean can also be expressed directly in terms of joint probabilities. This form is useful as a check on a table calculation, but it does not remove the need to identify the correct conditioning event.

Derivation: For an event \(A\) with \(P(A)>0\), the definition of conditional probability gives \(P(X=x\mid A)=P(X=x,A)/P(A)\). Substitute this into the weighted-sum definition and factor out the constant denominator:
$$ E[X\mid A] =\sum_x x\frac{P(X=x,A)}{P(A)} =\frac{\sum_x xP(X=x,A)}{P(A)}. $$
The numerator is the sum of each possible value of \(X\), weighted by its joint probability with the event. Dividing by \(P(A)\) rescales those joint masses to a distribution whose total is one. For a condition \(Y=y\), take \(A=\{Y=y\}\).

This identity applies when the conditioning probability is positive and the relevant sum exists. For finite-support variables, the only operational requirement is a positive denominator. It also explains why a weighted sum using unnormalized joint probabilities is generally not the conditional expectation: it is missing the division by the probability of the condition.

Parameterized Conditional Distributions

Sometimes a conditional pmf is specified by a parameter rather than by a numerical table. The same procedure applies: use the conditional probabilities as weights. It is important to distinguish a conditional model from a marginal model; a formula for \(P(X=x\mid Y=y)\) already describes the distribution after the condition has been imposed.

Worked Example: A Parameterized Conditional PMF

In a hypothetical discrete model, conditional on \(Y=y\), the variable \(X\) has support \(\{0,1,2\}\) and probabilities proportional to \(1,\theta,\theta^2\), where \(\theta>0\). Find the conditional mean as a function of \(\theta\), and then evaluate it at \(\theta=2\).

Method: normalize the weights and calculate their weighted sum. The sum of the three unnormalized weights is \(1+\theta+\theta^2\), which is positive for \(\theta>0\). Therefore,

$$ P(X=0\mid Y=y)=\frac{1}{1+\theta+\theta^2},\quad P(X=1\mid Y=y)=\frac{\theta}{1+\theta+\theta^2},\quad P(X=2\mid Y=y)=\frac{\theta^2}{1+\theta+\theta^2}. $$

These probabilities sum to \((1+\theta+\theta^2)/(1+\theta+\theta^2)=1\). Their weighted sum is

$$ E[X\mid Y=y] =0\frac{1}{1+\theta+\theta^2} +1\frac{\theta}{1+\theta+\theta^2} +2\frac{\theta^2}{1+\theta+\theta^2} =\frac{\theta+2\theta^2}{1+\theta+\theta^2}. $$

At \(\theta=2\), the three conditional probabilities are \(1/7\), \(2/7\), and \(4/7\). Thus

$$ E[X\mid Y=y]=0\left(\frac17\right)+1\left(\frac27\right)+2\left(\frac47\right) =\frac{2+8}{7}=\frac{10}{7}\approx 1.4286. $$

The result is approximately 1.4286, rounded to four decimal places. A common mistake is to treat the proportional weights \(1,2,4\) as probabilities and calculate \(0(1)+1(2)+2(4)=10\). They are weights, not probabilities: they must first be divided by their total, \(7\).

Exam Checks and Interpretation

In a finite table, the most reliable check is to verify the conditional probabilities sum to one before calculating the mean. Also check that the answer is within the range of the possible values of \(X\) under the condition. If \(X\) can only be 0, 1, or 2 in the selected group, its conditional mean cannot be below 0 or above 2.

A conditional mean answers a question about the selected conditional distribution, not necessarily about the whole population. It may differ from the unconditional mean because the condition changes the weights assigned to the possible values of \(X\). For example, a service tier with relatively high probabilities for larger claim counts can have a higher conditional mean than the overall claim-count mean.

  • Check the condition. For an event involving multiple categories, include all and only the outcomes in that event.
  • Check the denominator. The conditioning probability must be positive and must be the total probability of the selected outcomes.
  • Check normalization. The conditional probabilities must add to one.
  • Check the weighted sum. Each value of \(X\) is multiplied by its conditional probability, not its joint probability.

These steps are aligned with the SOA VEE Mathematical Statistics syllabus: identify the conditional law, normalize it correctly, and calculate the mean with the conditional probabilities as weights.

Check Your Understanding

For each problem, form or use the conditional pmf before calculating the mean. Answers are included so that the result can be checked.

  1. A discrete variable \(X\), conditional on event \(A\), takes values \(0,2,5\) with probabilities \(0.25,0.50,0.25\), respectively. Find \(E[X\mid A]\). (Answer: \(2.25\))
  2. A joint model has \(X\in\{1,3\}\) and categories \(D,E,F\). The joint probabilities for \(X=1\) are \(0.15,0.10,0.15\), and for \(X=3\) are \(0.25,0.20,0.15\), in the order \(D,E,F\). Find \(E[X\mid Y\in\{D,E\}]\). (Answer: \(16/7\), approximately \(2.2857\))
  3. Conditional on \(Y=\text{High}\), \(X\in\{0,1,2\}\) has probabilities \(0.20,0.50,0.30\). Calculate \(E[X\mid Y=\text{High}]\). (Answer: \(1.10\))
  4. Conditional on \(Y=y\), \(X\in\{0,1,2\}\) has probabilities proportional to \(1,\theta,\theta^2\), where \(\theta>0\). Find the conditional mean formula and evaluate it at \(\theta=1/2\). (Answer: \((\theta+2\theta^2)/(1+\theta+\theta^2)\); at \(\theta=1/2\), \(4/7\))
  5. A joint distribution has \(X\in\{0,1,4\}\). Given event \(B\), the unnormalized joint masses for those three values are \(0.10,0.30,0.10\), respectively. Calculate \(P(B)\) from these masses and find \(E[X\mid B]\). (Answer: \(P(B)=0.50\) and \(E[X\mid B]=1.40\))
Clinical Biostats