Tutorials › Statistical Theory I - Probability and Distribution Theory › Conditional Moments from Conditional Laws

Conditional Expectation · Tutorial 337 of 994

Conditional Moments from Conditional Laws

Use a conditional law to calculate moments at a specified conditioning value, and distinguish raw moments from moments centered at the conditional mean.

Intermediate 10 min read

What You'll Learn

  • Define conditional raw and central moments from a conditional probability law.
  • Calculate conditional moments from a discrete conditional mass function.
  • Derive conditional moments by integrating a conditional density.
  • Relate second central moments to second raw moments and conditional means.
  • Recognize how conditional moments can vary with the conditioning value.

Why Conditional Moments Depend on the Conditioning Value

A conditional law describes how a random variable behaves after another variable is known. Its moments summarize that behavior: the conditional mean gives its center, while higher moments describe further features of the conditional distribution. These summaries are generally functions of the value being conditioned on, not single constants.

For example, a measurement may tend to be larger for subjects in one group than another, or the spread of a measurement may change with age. To express such patterns precisely, calculate moments from the conditional mass function or density at each relevant conditioning value.

Definitions from a Conditional Law

Let \(X\) and \(Y\) be random variables. For a discrete \(Y\), condition on a value \(y\) with \(P(Y=y)>0\). The conditional mass function of \(X\) is \(p_{X\mid Y}(x\mid y)=P(X=x\mid Y=y)\). For a pair with a joint density, the conditional density is \(f_{X\mid Y}(x\mid y)=f_{X,Y}(x,y)/f_Y(y)\) when \(f_Y(y)>0\). In the density setting this formula gives a conditional law for almost every \(y\) with respect to the distribution of \(Y\); values at which \(f_Y(y)=0\) do not determine a unique conditional law.

Definition: For a positive integer \(r\), the \(r\)th conditional raw moment of \(X\) given \(Y=y\) is $$ m'_r(y)=E[X^r\mid Y=y], $$ provided \(E[|X|^r\mid Y=y]<\infty\). The conditional mean is \(m'_1(y)\). When this mean is finite, the \(r\)th conditional central moment is $$ \mu_r(y)=E[(X-m'_1(y))^r\mid Y=y], $$ provided the absolute moment needed for this expectation is finite. The zeroth raw moment is \(m'_0(y)=1\).

For a discrete conditional law, the moments are sums:

$$ m'_r(y)=\sum_x x^r p_{X\mid Y}(x\mid y), \qquad \mu_r(y)=\sum_x (x-m'_1(y))^r p_{X\mid Y}(x\mid y). $$

For a conditional density, the corresponding formulas are integrals:

$$ m'_r(y)=\int_{-\infty}^{\infty}x^r f_{X\mid Y}(x\mid y)\,dx, \qquad \mu_r(y)=\int_{-\infty}^{\infty}(x-m'_1(y))^r f_{X\mid Y}(x\mid y)\,dx. $$

These formulas require the relevant absolute moments to be finite. For a density, the integrals describe the chosen conditional-density version at values where that version is defined; probabilistic statements about them are understood to hold for almost every conditioning value.

Worked Example: Conditional Moments from a Discrete Law

Suppose \(P(Y=0)=P(Y=1)=1/2\). Given \(Y=0\), \(X\) is 0 with probability \(3/4\) and 2 with probability \(1/4\). Given \(Y=1\), \(X\) is 1 with probability \(1/4\) and 3 with probability \(3/4\). Find the conditional mean, second raw moment, and second central moment for both values of \(Y\).

For \(Y=0\), the conditional mean is

$$ m'_1(0)=0\left(\frac34\right)+2\left(\frac14\right)=\frac12. $$

The second raw moment is

$$ m'_2(0)=0^2\left(\frac34\right)+2^2\left(\frac14\right)=1. $$

Centering at the conditional mean \(1/2\), the second central moment is

$$ \mu_2(0)=\left(0-\frac12\right)^2\frac34+ \left(2-\frac12\right)^2\frac14 =\frac{3}{16}+\frac{9}{16}=\frac34. $$

For \(Y=1\), the conditional mean and second raw moment are

$$ m'_1(1)=1\left(\frac14\right)+3\left(\frac34\right)=\frac52, \qquad m'_2(1)=1^2\left(\frac14\right)+3^2\left(\frac34\right)=7. $$

Thus the second central moment is

$$ \mu_2(1)=\left(1-\frac52\right)^2\frac14+ \left(3-\frac52\right)^2\frac34 =\frac{9}{16}+\frac{3}{16}=\frac34. $$

The conditional mean changes from \(1/2\) to \(5/2\), while the second central moment is \(3/4\) in both groups. The conditional mean and the conditional spread need not vary together.

Calculating Moments by Integration

With a conditional density, each moment is an integral under that density, with the conditioning value held fixed. It is important to use the conditional density rather than the joint density alone: the conditional density must integrate to one for each relevant conditioning value.

Worked Example: A Uniform Conditional Distribution

Let \(Y\) have an exponential distribution with rate 1, and let \(U\) be uniform on \((0,1)\) and independent of \(Y\). Define \(X=YU\). For \(y>0\), the conditional distribution of \(X\) given \(Y=y\) is uniform on \((0,y)\), with density \(f_{X\mid Y}(x\mid y)=1/y\) for \(0<x<y\). Calculate its conditional mean, second raw moment, and second central moment.

The conditional density integrates to one:

$$ \int_0^y \frac{1}{y}\,dx=1. $$

Integrating \(x\) and \(x^2\) against this density gives

$$ m'_1(y)=\int_0^y x\frac{1}{y}\,dx =\frac{1}{y}\left[\frac{x^2}{2}\right]_0^y =\frac{y}{2}, $$
$$ m'_2(y)=\int_0^y x^2\frac{1}{y}\,dx =\frac{1}{y}\left[\frac{x^3}{3}\right]_0^y =\frac{y^2}{3}. $$

Now center at \(m'_1(y)=y/2\):

$$ \begin{aligned} \mu_2(y) &=\int_0^y \left(x-\frac{y}{2}\right)^2\frac{1}{y}\,dx\\ &=\frac{1}{y}\int_0^y \left(x^2-yx+\frac{y^2}{4}\right)\,dx\\ &=\frac{1}{y}\left(\frac{y^3}{3}-\frac{y^3}{2}+\frac{y^3}{4}\right) =\frac{y^2}{12}. \end{aligned} $$

Both the conditional mean and the second central moment depend on \(y\). In particular, as the interval \((0,y)\) grows, the conditional mean grows in proportion to \(y\), and the second central moment grows in proportion to \(y^2\).

Raw and Central Moments

Raw moments are calculated around zero. Central moments are calculated around the conditional mean, so they describe deviations from the center of the conditional distribution. The two types are related by algebra.

Theorem: Suppose the conditional raw moments through order \(r\) exist absolutely at \(Y=y\), and write \(m'_1(y)=E[X\mid Y=y]\). For an integer \(r\geq 1\), $$ \mu_r(y)=\sum_{k=0}^{r}\binom{r}{k}(-m'_1(y))^{r-k}m'_k(y). $$ In particular, $$ \mu_2(y)=m'_2(y)-\bigl(m'_1(y)\bigr)^2. $$

Proof. Fix a conditioning value \(y\) at which the stated moments are finite. The binomial theorem gives

$$ (X-m'_1(y))^r =\sum_{k=0}^{r}\binom{r}{k}X^k(-m'_1(y))^{r-k}. $$

This is a finite sum, so conditional expectation can be applied term by term. The constant \(m'_1(y)\) is fixed once \(y\) is fixed, and \(E[X^k\mid Y=y]=m'_k(y)\). Therefore

$$ E[(X-m'_1(y))^r\mid Y=y] =\sum_{k=0}^{r}\binom{r}{k}(-m'_1(y))^{r-k}m'_k(y), $$

which proves the general formula. For \(r=2\), use \(m'_0(y)=1\) and \(m'_1(y)=E[X\mid Y=y]\):

$$ \mu_2(y)=m'_2(y)-2m'_1(y)m'_1(y)+(m'_1(y))^2 =m'_2(y)-(m'_1(y))^2. $$

\(\square\)

Worked Example: Conditional Moments in a Normal Model

Let \(Y\) be any real-valued random variable, let \(Z\sim N(0,1)\) be independent of \(Y\), and set \(X=2Y+3Z\). Given \(Y=y\), calculate the conditional mean and second raw and central moments of \(X\).

Since \(Z\) is independent of \(Y\), its conditional distribution given \(Y=y\) is still \(N(0,1)\). Thus \(X\mid Y=y\sim N(2y,9)\). Equivalently, \(X=2y+3Z\) under this conditional law. The standard normal has \(E[Z]=0\) and \(E[Z^2]=1\), so

$$ m'_1(y)=E[2y+3Z\mid Y=y]=2y+3(0)=2y. $$

Expanding the square gives the second raw moment:

$$ \begin{aligned} m'_2(y) &=E[(2y+3Z)^2\mid Y=y]\\ &=4y^2+12yE[Z\mid Y=y]+9E[Z^2\mid Y=y]\\ &=4y^2+0+9=4y^2+9. \end{aligned} $$

Centering at the conditional mean removes the \(2y\) term:

$$ \mu_2(y)=E[(X-2y)^2\mid Y=y] =E[(3Z)^2\mid Y=y]=9E[Z^2\mid Y=y]=9. $$

For example, at \(y=0\) the conditional mean is 0 and the second raw moment is 9; at \(y=1\) they are 2 and 13. The second central moment remains 9 at either value.

Common Mistake: Confusing Raw and Central Second Moments

A frequent error is to call \(E[X^2\mid Y=y]\) the conditional second central moment. It is the second raw moment: it measures squared values relative to zero. The second central moment measures squared deviations from the conditional mean and requires a correction:

$$ E[(X-E[X\mid Y=y])^2\mid Y=y] =E[X^2\mid Y=y]-(E[X\mid Y=y])^2. $$

For the normal example at \(y=1\), using the raw second moment \(13\) as the central moment would be wrong. The conditional mean is 2, so the central moment is \(13-2^2=9\). Always calculate the conditional mean first when a central moment is requested.

Key takeaway: A conditional law at \(Y=y\) supplies the weights for calculating moments of \(X\). Use sums for a conditional mass function and integrals for a conditional density. Raw moments are centered at zero; central moments are centered at the conditional mean, and their values can change with \(y\).

Check Your Understanding

For each question, distinguish carefully between the conditioning value and the variable whose moment is being calculated.

  1. If \(P(X=0\mid Y=y)=1/2\) and \(P(X=2\mid Y=y)=1/2\), calculate the conditional mean and second raw moment at this \(y\).
  2. For the conditional law in question 1, calculate the second central moment and verify it using the relation between raw and central moments.
  3. If \(f_{X\mid Y}(x\mid y)=2x/y^2\) for \(0<x<y\), where \(y>0\), write the integral for the conditional mean. What is the value of this conditional mean?
  4. In the model \(X=2Y+3Z\) with independent standard normal \(Z\), which conditional moment changes with \(y\): the second raw moment, the second central moment, or both?
  5. Explain why a conditional density formula based on \(f_{X,Y}(x,y)/f_Y(y)\) cannot be used at a value where \(f_Y(y)=0\).