Tutorials › VEE Mathematical Statistics › Conditional Expectations for Continuous Variables

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

Conditional Expectations for Continuous Variables

Use a joint density to identify the conditional density, then integrate over its correct support to calculate a conditional mean.

Intermediate 10 min read

What You'll Learn

  • Find a marginal density by integrating a joint density over the other variable’s support.
  • Form a conditional density by dividing the joint density by the conditioning variable’s marginal density.
  • Identify how the conditional support changes when the conditioning value changes.
  • Calculate conditional means with integrals for bounded and unbounded conditional supports.
  • Check conditional densities for normalization and avoid forgetting the marginal-density divisor.

Why Conditional Means Need a Conditional Density

A joint density describes two continuous random variables together, but it does not by itself give the mean of one variable after the other has been observed. To answer a question such as “What is the expected value of \(Y\) when \(X=x\)?”, first determine the distribution of \(Y\) at that fixed value of \(X\). The resulting conditional density supplies both the correct weights and the correct range of integration.

This calculation matters whenever the variables are dependent or their possible values are linked by the support. For example, if a joint density is positive only when \(0<y<x\), observing \(X=x\) restricts \(Y\) to the interval from \(0\) to \(x\). Integrating over a different range, or using the joint density without adjusting it, will not produce a conditional mean.

Definition: Let \(X\) and \(Y\) have joint density \(f_{X,Y}(x,y)\), and let \(f_X(x)\) be the marginal density of \(X\). For a value \(x\) such that \(f_X(x)>0\), the conditional density of \(Y\) given \(X=x\) is $$ f_{Y\mid X}(y\mid x)=\frac{f_{X,Y}(x,y)}{f_X(x)}. $$ If the conditional absolute first moment is finite, the conditional mean is $$ E[Y\mid X=x]=\int_{\text{conditional support}} y f_{Y\mid X}(y\mid x)\,dy. $$

The conditional support is the set of \(y\)-values for which the joint density can be positive when \(X=x\) is fixed. It may depend on \(x\), and it may be bounded or unbounded. The formula for the conditional density applies only where \(f_X(x)>0\). At values with \(f_X(x)=0\), the density ratio is undefined; values assigned to a conditional distribution there do not affect probabilities under the distribution of \(X\).

From a Joint Density to a Conditional Mean

The calculation has three main parts: find the marginal density, form the conditional density on the appropriate support, and integrate \(y\) against that density. The marginal is obtained by integrating the joint density over all possible values of the other variable. In particular, if the joint support at a fixed \(x\) allows \(y\) to range from \(a(x)\) to \(b(x)\), then

$$ f_X(x)=\int_{a(x)}^{b(x)} f_{X,Y}(x,y)\,dy. $$

The limits must describe the joint support at that value of \(x\). Once \(f_X(x)\) is known and positive, dividing by it normalizes the joint density along the slice where \(X=x\).

1
Find the marginal density.
Integrate the joint density over the full permitted range of the variable being conditioned on.
2
Form the conditional density.
Divide the joint density by the marginal density of the variable whose value is fixed.
3
Integrate to obtain the mean.
Multiply the conditional density by \(y\) and integrate over the conditional support, checking that the integral is finite.

Why the Density Ratio Works

The marginal density is the total joint density along a slice at \(X=x\). Dividing the joint density on that slice by its total makes the conditional density integrate to one:

$$ \int f_{Y\mid X}(y\mid x)\,dy = \frac{\int f_{X,Y}(x,y)\,dy}{f_X(x)} = \frac{f_X(x)}{f_X(x)} =1, \qquad f_X(x)>0. $$

This is also consistent with conditioning on a narrow interval around \(x\). The joint probability of \(Y\) lying in a set and \(X\) lying in that interval is divided by the probability that \(X\) lies in the interval. As the interval narrows, the ratio of the corresponding densities gives \(f_{X,Y}(x,y)/f_X(x)\), under the usual regularity conditions for densities. The conditional mean then follows from the definition of the mean of a continuous random variable, applied to this conditional density.

Worked Examples

Worked Example: A Uniform Density on a Triangular Support

Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)=2\) when \(0<y<x<1\), and zero elsewhere. Find \(E[Y\mid X=0.6]\). The joint support is a bounded triangle, and the conditional range of \(Y\) changes with \(x\).

Method: marginalize, normalize, then integrate. At a fixed \(x\) between 0 and 1, the support for \(y\) is \(0<y<x\). Therefore

$$ f_X(x)=\int_0^x 2\,dy=2x,\qquad 0<x<1. $$

The joint density is normalized because

$$ \int_0^1 f_X(x)\,dx=\int_0^1 2x\,dx=[x^2]_0^1=1. $$

For \(0<x<1\), the conditional density is

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

It integrates to one on its conditional support:

$$ \int_0^x \frac{1}{x}\,dy=\frac{x}{x}=1. $$

Thus the conditional mean at a general \(x\) is

$$ E[Y\mid X=x] =\int_0^x y\frac{1}{x}\,dy =\frac{1}{x}\left[\frac{y^2}{2}\right]_0^x =\frac{x}{2}. $$

At \(x=0.6\), \(E[Y\mid X=0.6]=0.6/2=0.3\). As a check, the conditional density is uniform from \(0\) to \(0.6\), whose midpoint is \(0.3\). A common mistake is to stop at the unnormalized integral \(\int_0^{0.6}2y\,dy=0.36\), which uses the joint density but is not a conditional mean. Dividing by \(f_X(0.6)=1.2\) gives \(0.36/1.2=0.3\), as does using the conditional density directly.

Worked Example: A Nonuniform Conditional Density

Suppose the joint density is \(f_{X,Y}(x,y)=6y\) for \(0<y<x<1\), and zero elsewhere. Find the conditional density of \(Y\) given \(X=x\), then calculate \(E[Y\mid X=0.75]\).

Method: integrate the joint density over the changing slice. For \(0<x<1\),

$$ f_X(x)=\int_0^x 6y\,dy =6\left[\frac{y^2}{2}\right]_0^x =3x^2. $$

The stated joint density is normalized, since

$$ \int_0^1 3x^2\,dx=[x^3]_0^1=1. $$

For \(0<y<x<1\), divide by the marginal density:

$$ f_{Y\mid X}(y\mid x)=\frac{6y}{3x^2}=\frac{2y}{x^2}. $$

This conditional density is nonnegative and integrates to one:

$$ \int_0^x \frac{2y}{x^2}\,dy =\frac{2}{x^2}\left[\frac{y^2}{2}\right]_0^x =1. $$

Now calculate the conditional mean:

$$ E[Y\mid X=x] =\int_0^x y\frac{2y}{x^2}\,dy =\frac{2}{x^2}\int_0^x y^2\,dy =\frac{2}{x^2}\left[\frac{y^3}{3}\right]_0^x =\frac{2x}{3}. $$

At \(x=0.75\), this is \(2(0.75)/3=1.5/3=0.5\). The result lies within the conditional support \(0<Y<0.75\), as required. The common mistake is to treat the conditional distribution as uniform merely because the support is an interval. Here the density is proportional to \(y\), so larger values receive more weight; the correct mean is \(0.5\), not the interval midpoint \(0.375\).

Worked Example: An Unbounded Conditional Support

Let \(X\) have density \(e^{-x}\) for \(x>0\). Given \(X=x\), suppose \(Y\) has an exponential density with rate \(x+1\), so that the joint density is

$$ f_{X,Y}(x,y)=e^{-x}(x+1)e^{-(x+1)y},\qquad x>0,\ y>0. $$

Find \(E[Y\mid X=1]\). The conditional support \(y>0\) is unbounded.

Method: use the marginal to isolate the conditional density. Integrating over \(y>0\) gives

$$ f_X(x)=\int_0^\infty e^{-x}(x+1)e^{-(x+1)y}\,dy =e^{-x}(x+1)\frac{1}{x+1} =e^{-x},\qquad x>0. $$

The marginal integrates to \(\int_0^\infty e^{-x}\,dx=1\). Dividing the joint density by \(f_X(x)\) yields

$$ f_{Y\mid X}(y\mid x)=(x+1)e^{-(x+1)y},\qquad y>0. $$

Put \(\lambda=x+1>0\). Integration by parts gives

$$ \int_0^\infty y\lambda e^{-\lambda y}\,dy =\left[-ye^{-\lambda y}\right]_0^\infty +\int_0^\infty e^{-\lambda y}\,dy =0+\frac{1}{\lambda}. $$

The boundary term is zero because \(ye^{-\lambda y}\) tends to zero as \(y\) tends to infinity and is zero at \(y=0\). Therefore \(E[Y\mid X=x]=1/(x+1)\), and at \(x=1\) the answer is \(1/2=0.5\). The conditional density integrates to one, and the computed mean is finite. A common error is to integrate only over a bounded interval despite the support being all \(y>0\); the correct integral uses the limits \(0\) and \(\infty\).

Checks and Common Traps

A conditional mean calculation is most reliable when the support and normalization are checked explicitly. In particular, the denominator in the conditional density is the marginal density of the variable being fixed—not a probability for an unrelated event. The integration limits come from the joint support after fixing that variable, and can vary with its value.

  • Using the wrong slice. To find \(E[Y\mid X=x]\), integrate the joint density over \(y\) to obtain \(f_X(x)\), and integrate the conditional mean over the permitted \(y\)-values.
  • Forgetting the normalizing divisor. The integral \(\int y f_{X,Y}(x,y)\,dy\) is not generally the conditional mean. Divide by \(f_X(x)\), or use the conditional density that already includes this division.
  • Assuming the conditional support is fixed. In a triangular region such as \(0<y<x<1\), the upper limit for \(y\) is \(x\), not always 1.
  • Ignoring existence. A conditional mean requires \(\int |y| f_{Y\mid X}(y\mid x)\,dy<\infty\). For an unbounded support, this must not be assumed without checking.
Key takeaway: For a continuous pair, first derive the conditional density by dividing the joint density by the appropriate marginal density. Then integrate \(y\) over the conditional support. Verify that the conditional density integrates to one and that the mean integral is finite.

Check Your Understanding

For each problem, find the requested conditional density or mean by identifying the marginal and the conditional support before integrating.

  1. The joint density is \(1/2\) on \(0<y<x<2\) and zero elsewhere. Find \(f_{Y\mid X}(y\mid x)\) and \(E[Y\mid X=1.4]\). (Answer: \(f_{Y\mid X}(y\mid x)=1/x\) for \(0<y<x\); \(E[Y\mid X=1.4]=0.7\).)
  2. The joint density is \(2\) on \(0<x<y<1\) and zero elsewhere. Find \(f_{X\mid Y}(x\mid y)\) and \(E[X\mid Y=0.6]\). (Answer: \(f_{X\mid Y}(x\mid y)=1/y\) for \(0<x<y\); \(E[X\mid Y=0.6]=0.3\).)
  3. The joint density is \(e^{-x}/(2x)\) on \(x>0,\ 0<y<2x\), and zero elsewhere. Find \(f_X(x)\), \(f_{Y\mid X}(y\mid x)\), and \(E[Y\mid X=1.2]\). (Answer: \(f_X(x)=e^{-x}\) for \(x>0\); \(f_{Y\mid X}(y\mid x)=1/(2x)\) for \(0<y<2x\); \(E[Y\mid X=1.2]=1.2\).)
  4. The joint density is \(e^{-x}(x+3)e^{-(x+3)y}\) for \(x>0,\ y>0\), and zero elsewhere. Find \(f_{Y\mid X}(y\mid x)\) and \(E[Y\mid X=1]\). (Answer: \(f_{Y\mid X}(y\mid x)=(x+3)e^{-(x+3)y}\) for \(y>0\); \(E[Y\mid X=1]=1/4\).)
  5. The joint density is \((x+1)e^{-(x+1)y}\) for \(0<x<1,\ y>0\), and zero elsewhere. Find \(f_X(x)\), \(f_{Y\mid X}(y\mid x)\), and \(E[Y\mid X=0.5]\). (Answer: \(f_X(x)=1\) for \(0<x<1\); \(f_{Y\mid X}(y\mid x)=(x+1)e^{-(x+1)y}\) for \(y>0\); \(E[Y\mid X=0.5]=2/3\).)
Clinical Biostats