Tutorials › VEE Mathematical Statistics › Conditional Probabilities Through Indicator Expectations

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

Conditional Probabilities Through Indicator Expectations

Use indicator variables to express and calculate conditional probabilities for events involving one or more random variables.

Intermediate 10 min read

What You'll Learn

  • Express a conditional event probability as the conditional expectation of its indicator.
  • Interpret conditioning on a random variable as a random quantity determined by that variable.
  • Calculate event probabilities from discrete conditional laws and joint probability tables.
  • Use a conditional density when one exists, and a conditional distribution measure in the general case.
  • Recognize why conditioning on a continuously distributed variable can produce a point-mass conditional law.
  • Check whether an event restriction has been applied before calculating a conditional probability.

Why Indicators Turn Events into Conditional Expectations

A conditional probability asks how likely an event is after specified information is available. When that information is a random variable, the answer generally depends on its observed value: it is itself a random variable. An indicator provides a direct way to express this conditional probability as a conditional expectation, making the connection between event calculations and expectation methods precise.

This connection is useful whether the variables have discrete distributions, continuous distributions, or a conditional law that has no density. The method is the same in each case: represent the event by an indicator, then take its conditional expectation using the appropriate conditional distribution.

Definition: For an event \(A\), its indicator is the random variable \(\mathbf{1}_A\), equal to 1 when \(A\) occurs and 0 otherwise. Given a random variable \(Y\), the conditional probability of \(A\) given \(Y\) is the conditional expectation \(\displaystyle P(A\mid Y)=E[\mathbf{1}_A\mid Y]\). This is a random variable determined by \(Y\), defined up to events of probability zero.

The notation \(P(A\mid Y)\) means conditioning on the information supplied by \(Y\), not conditioning on a single event. Once \(Y=y\) is observed, a version of this random variable can be evaluated at \(y\), giving the conditional probability \(P(A\mid Y=y)\). Conditional distributions and these conditional probabilities are interpreted almost surely under the law of \(Y\); values at exceptional \(y\)'s of probability zero need not be uniquely determined.

Why the Indicator Identity Holds

Conditional expectation is characterized by how it averages over every event that can be described using the conditioning information. For \(Z=E[\mathbf{1}_A\mid Y]\), the defining property is that, for every measurable set \(C\),

$$ E[\mathbf{1}_{\{Y\in C\}}Z] = E[\mathbf{1}_{\{Y\in C\}}\mathbf{1}_A] = P(A\cap\{Y\in C\}). $$

Thus \(Z\) gives the conditional chance of \(A\) in each part of the information represented by \(Y\). It is between 0 and 1 almost surely, since \(\mathbf{1}_A\) is between 0 and 1. This characterizing property also explains why conditional probabilities are defined only up to changes on sets of \(Y\)-values having probability zero.

For a more explicit calculation, let \(K_y\) denote a conditional distribution of \(X\) given \(Y=y\). In the usual real-valued setting, such a conditional distribution can be represented by a probability measure \(K_y\), interpreted for almost every \(y\) under the distribution of \(Y\). If \(A\) is an event involving \(X\) and \(Y\), then

$$ P(A\mid Y=y) = \int \mathbf{1}_A(x,y)\,K_y(dx). $$

This is an integral with respect to a probability measure, not necessarily with respect to a density. If the conditional distribution has a density \(f_{X\mid Y}(x\mid y)\), the integral can be written as an integral against that density. For a discrete conditional law it becomes a sum. For a singular conditional law, such as a point mass, the measure formula still applies even though no density with respect to length exists.

Calculating from a Discrete Joint Law

Worked Example: A Conditional Event from a Joint Probability Table

A hypothetical monitoring system records a nonnegative alert count \(X\) and an indicator \(Y\) for whether a secondary review occurred. The joint probabilities are:

\(X=0\)\(X=1\)\(X=2\)Total
\(Y=0\)0.100.200.100.40
\(Y=1\)0.050.150.400.60

Find \(P(A\mid Y)\) for \(A=\{X=2\text{ or }(X=1\text{ and }Y=0)\}\). The table specifies the full joint model; interest and mortality assumptions do not apply.

Method. Since \(A\) is an event involving both variables, identify the entries in \(A\) separately for each value of \(Y\), then divide by the corresponding marginal probability of \(Y\).

When \(Y=0\), the event occurs for \(X=1\) or \(X=2\). The joint probability is \(0.20+0.10=0.30\), and \(P(Y=0)=0.40\). Therefore

$$ P(A\mid Y=0)=\frac{0.30}{0.40}=0.75. $$

When \(Y=1\), the condition \(X=1\) and \(Y=0\) cannot hold, so only \(X=2\) qualifies. Thus

$$ P(A\mid Y=1)=\frac{0.40}{0.60}=\frac{2}{3}=0.6667 $$

to four decimal places. Hence \(E[\mathbf{1}_A\mid Y]\) equals 0.75 when \(Y=0\) and \(2/3\) when \(Y=1\). As a check, the joint probability of \(A\) is \(0.30+0.40=0.70\); the two conditional values weighted by their \(Y\)-row probabilities give \(0.75(0.40)+(2/3)(0.60)=0.30+0.40=0.70\). The common mistake is to include the \(X=1\) entry in the \(Y=1\) row; that entry does not satisfy the event as defined.

Using a Conditional Density When One Exists

If \(X\) given \(Y=y\) has a density, conditional event probabilities can be calculated by integrating that density over the values of \(X\) that make the event true. The event may also restrict the possible values of \(Y\), in which case that restriction remains part of the conditional probability.

Worked Example: A Two-Variable Event on a Triangular Support

Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)=2\) for \(0<x<y<1\), and zero elsewhere. This is a normalized density because the triangular support has area \(1/2\). Find \(P(A\mid Y=y)\) for \(A=\{X>Y/2,\ Y<3/4\}\), and then find \(P(A)\). There are no interest or mortality assumptions; the distribution is specified by the joint density above.

Method. First calculate the marginal density of \(Y\):

$$ f_Y(y)=\int_0^y 2\,dx=2y,\qquad 0<y<1. $$

The conditional density is therefore

$$ f_{X\mid Y}(x\mid y)=\frac{f_{X,Y}(x,y)}{f_Y(y)} =\frac{2}{2y}=\frac{1}{y},\qquad 0<x<y, $$

for \(0<y<1\). Given such a \(y\), \(X\) is uniform over an interval of length \(y\). If \(y<3/4\), the event also requires \(y/2<X<y\), an interval of length \(y-y/2=y/2\). Its conditional probability is \((y/2)/y=1/2\). If \(y\geq 3/4\), the event's restriction on \(Y\) fails. Thus

$$ P(A\mid Y=y)= \begin{cases} \frac{1}{2},&0<y<\frac{3}{4},\\ 0,&\frac{3}{4}\leq y<1. \end{cases} $$

For example, at \(y=0.60\) the conditional probability is \(1/2\), while at \(y=0.80\) it is 0. To obtain the unconditional probability, integrate the joint density directly over the event:

$$ \begin{aligned} P(A) &=\int_0^{3/4}\int_{y/2}^{y}2\,dx\,dy\\ &=\int_0^{3/4}2\left(y-\frac{y}{2}\right)dy\\ &=\int_0^{3/4}y\,dy =\left.\frac{y^2}{2}\right|_0^{3/4} =\frac{9}{32}=0.28125. \end{aligned} $$

The result is checked by integrating the conditional probability against \(f_Y\): \(\int_0^{3/4}(1/2)(2y)\,dy=9/32\), the same value. A common error is to report \(1/2\) as \(P(A)\), using the conditional chance \(P(X>Y/2\mid Y=y)\) but ignoring the additional restriction \(Y<3/4\). The event's full condition must be applied.

Conditional Laws Need Not Have Densities

A continuous marginal distribution for \(Y\) does not guarantee that the conditional distribution of \(X\) given \(Y=y\) has a density. For example, if \(X=Y\), knowing \(Y\) determines \(X\) exactly. The conditional distribution of \(X\) is then concentrated at one point. The conditional-measure formula handles this case directly.

Worked Example: A Singular Conditional Law

Let \(Y\sim\operatorname{Uniform}(0,4)\) and define \(X=Y\) with probability 1. For \(A=\{X+Y>5,\ X<3\}\), find \(P(A\mid Y=y)\) and \(P(A\mid B)\), where \(B=\{2\leq Y\leq3\}\). Interest and mortality assumptions do not apply; the model is a uniform random variable on \((0,4)\) with \(X\) equal to \(Y\).

Method. Given \(Y=y\), the conditional law of \(X\) is the point mass at \(y\), denoted \(\delta_y\). The conditional event probability is the indicator of whether \((x,y)=(y,y)\) satisfies \(A\):

$$ P(A\mid Y=y) =\int \mathbf{1}_{\{x+y>5,\ x<3\}}\,\delta_y(dx) =\mathbf{1}_{\{2y>5,\ y<3\}}. $$

Thus the conditional probability is 1 for \(2.5<y<3\) and 0 otherwise, apart from any irrelevant choices at exceptional values. This point-mass law has no ordinary density for \(X\) given \(Y=y\), but the conditional probability is still well-defined.

On \(B\), the variable \(Y\) is uniform over an interval of length \(3-2=1\). The event \(A\) occurs within this interval precisely when \(2.5<Y<3\), a subinterval of length \(0.5\). Therefore

$$ P(A\mid B)=\frac{P(A\cap B)}{P(B)} =\frac{0.5/4}{1/4} =\frac{1}{2}=0.5000. $$

As a check, the conditional event occupies half of the interval defining \(B\). The common mistake is to search for a conditional density and use a continuous-density integral in \(x\); here the conditional distribution is a point mass, so integrating against \(\delta_y\) is the appropriate calculation.

Common Mistakes and a Reliable Procedure

Indicator notation is compact, but it does not remove the need to interpret the event and the conditioning information carefully. In particular, \(P(A\mid Y)\) is a function of \(Y\), whereas \(P(A\mid B)\), for an event \(B\) with positive probability, is a single number. In the latter case, \(P(A\mid B)=P(A\cap B)/P(B)\).

1
Define the event precisely.
Write the event using inequalities or values of the random variables, including every restriction in its definition.
2
Turn the event into an indicator.
Use \(\mathbf{1}_A\), which equals 1 exactly on the event and 0 elsewhere.
3
Identify the conditional law.
Use a conditional probability table or mass function for discrete variables, a conditional density when one exists, or the conditional distribution measure in general.
4
Calculate and check.
Sum or integrate the indicator under that conditional law, verify the answer lies between 0 and 1, and check that all event restrictions were included.
  • Dropping part of the event: An event such as \(\{X>Y/2,\ Y<3/4\}\) includes both conditions, not only the inequality involving \(X\).
  • Using the wrong denominator: For a discrete conditional probability, divide by the probability of the conditioning value, not by the total probability of the event's qualifying entries.
  • Assuming a density exists: Conditional distributions may be discrete or singular, even if the variable being conditioned on is continuous.
  • Treating a conditional probability as constant: \(P(A\mid Y)\) can change with \(Y\); evaluate it at the given value or describe it as a function of \(Y\).
Key takeaway: For any event \(A\), \(P(A\mid Y)=E[\mathbf{1}_A\mid Y]\) almost surely. Evaluate this conditional expectation using the full conditional distribution—whether represented by a sum, a density integral, or a more general probability measure.

Check Your Understanding

For each problem, identify the event restrictions before calculating. Answers are given for checking.

  1. A joint table has \(P(X=0,Y=0)=0.18\), \(P(X=1,Y=0)=0.22\), \(P(X=0,Y=1)=0.12\), and \(P(X=1,Y=1)=0.48\). Find \(P(X=1\mid Y)\). (Answer: 0.5500 when \(Y=0\); 0.8000 when \(Y=1\).)
  2. Let \(Y\) be uniform on \((0,2)\), and suppose \(X\mid Y=y\) is uniform on \((0,y)\). Find \(P(X>Y/2\mid Y=y)\) for \(0<y<2\). (Answer: \(1/2\).)
  3. For the model in question 2, find \(P(X>Y/2,\ Y<1)\). (Answer: \(1/4\).)
  4. Let \(Y\sim\operatorname{Uniform}(0,5)\) and \(X=Y\). For \(A=\{X+Y>6,\ X<4\}\), state \(P(A\mid Y=y)\). (Answer: 1 for \(3<y<4\), and 0 otherwise, up to endpoint choices.)
  5. In the model of question 4, let \(B=\{2\leq Y\leq4\}\). Find \(P(A\mid B)\). (Answer: \(1/2\).)
Clinical Biostats