Tutorials › Statistical Theory I - Probability and Distribution Theory › Common Errors in Conditional Averaging

Conditional Expectation · Tutorial 345 of 994

Common Errors in Conditional Averaging

Learn when conditional means are defined, how to average them correctly, and how support and weighting errors distort calculations.

Intermediate 10 min read

What You'll Learn

  • Distinguish conditioning on a positive-probability event from conditioning on a random variable.
  • Explain why a conditional mean at a zero-probability point is not uniquely determined.
  • Average discrete conditional means using the probabilities of their conditioning groups.
  • Apply the conditional-density formula only where the marginal density is positive.
  • Check conditional support before calculating an integral or sum.

Why Conditional Averages Are Easy to Misread

A conditional mean describes an average under specified information; it is not automatically the overall mean, nor is every expression that looks like “the mean given \(X=x\)” defined in the same way. Errors often arise when a calculation quietly changes the conditioning event, assigns equal weight to groups of different sizes, or includes values outside the conditional support.

The key safeguard is to identify both what is being conditioned on and which values can occur under that condition. For discrete variables, conditioning on a point with positive probability is an ordinary event calculation. For a continuously distributed variable, a single point has probability zero, so its conditional mean needs a more careful interpretation.

Definition: If \(A\) is an event with \(P(A)>0\) and \(E[|Y|]<\infty\), the conditional mean given \(A\) is $$ E[Y\mid A]=\frac{E[Y\mathbf{1}_A]}{P(A)}. $$ For a random variable \(X\), \(E[Y\mid X]\) denotes a conditional expectation given the information in \(X\); it is a random variable that is a function of \(X\), up to equality with probability one. In a discrete setting, \(E[Y\mid X=x]\) is given by the event formula when \(P(X=x)>0\). For a continuous \(X\), the notation at a particular point \(x\) typically refers to a value chosen from a version of a conditional-mean function; at a point with probability zero, that value need not be uniquely determined.

Conditional Means Are Not Overall Means

The overall mean combines conditional means according to how often their conditioning cases occur. In a finite partition, that means using the probabilities of the partition events as weights—not giving every group equal influence unless the probabilities really are equal.

Theorem: Let \(A_1,\ldots,A_k\) be disjoint events whose union is the whole sample space, with \(P(A_i)>0\) for each \(i\). If \(E[|Y|]<\infty\), then $$ E[Y]=\sum_{i=1}^{k}P(A_i)E[Y\mid A_i]. $$

Proof. By the definition of conditional mean, \(P(A_i)E[Y\mid A_i]=E[Y\mathbf{1}_{A_i}]\). Since the events partition the sample space, \(\sum_{i=1}^{k}\mathbf{1}_{A_i}=1\). Therefore

$$ \sum_{i=1}^{k}P(A_i)E[Y\mid A_i] =\sum_{i=1}^{k}E[Y\mathbf{1}_{A_i}] =E\left[Y\sum_{i=1}^{k}\mathbf{1}_{A_i}\right] =E[Y]. $$

The sums are finite, and \(E[|Y|]<\infty\) ensures the expectations exist. Thus the conditional means recover the overall mean only when combined with their event probabilities as weights. \(\square\)

Worked Example: Unequal Groups Need Unequal Weights

Suppose group \(A\) occurs with probability \(0.2\), and \(Y=10\) in that group. Group \(B\) occurs with probability \(0.8\), and \(Y=2\) in that group. Find the overall mean and compare it with the unweighted average of the two conditional means.

Here \(E[Y\mid A]=10\) and \(E[Y\mid B]=2\). The correctly weighted mean is

$$ E[Y]=0.2(10)+0.8(2)=2+1.6=3.6. $$

Giving the two groups equal weight instead produces \((10+2)/2=6\), which is not the overall mean. That calculation describes a different weighting scheme: it first selects a group with equal probability, then uses that group’s mean. In the stated population, an observation is four times as likely to come from \(B\) as from \(A\), so \(B\)'s conditional mean must receive four times the weight.

Zero-Probability Points and Conditional Means

When \(X\) is continuous, \(P(X=x)=0\) for an individual point \(x\). The event formula \(E[Y\mathbf{1}_{\{X=x\}}]/P(X=x)\) then has a zero denominator and does not define \(E[Y\mid X=x]\). One instead represents \(E[Y\mid X]\) by a function \(m(X)\). If \(m\) is a valid version, changing its value at a point \(x\) with \(P(X=x)=0\) does not change \(m(X)\) except on a probability-zero event. Thus the conditional mean as a random variable is well-defined up to almost-sure equality, while its value at that particular point may not be determined.

Under additional structure, a conditional distribution can provide a useful pointwise formula on the part of the range where it is defined. For example, when a joint density exists, the conditional-density formula gives such a function wherever the marginal density is positive. The formula does not justify dividing by a marginal density of zero, and pointwise values still require attention to the version being used.

Worked Example: A Conditional Mean at a Null Point

Let \(X\sim\operatorname{Uniform}(0,1)\) and let \(Y=X\). A natural version of the conditional mean is \(m(x)=x\), so it gives \(m(1/2)=1/2\). But \(P(X=1/2)=0\). Define another function \(\widetilde m\) by \(\widetilde m(x)=x\) for \(x\ne 1/2\) and \(\widetilde m(1/2)=99\).

The random variables \(m(X)\) and \(\widetilde m(X)\) differ only on the event \(\{X=1/2\}\), which has probability zero. They are therefore equal almost surely, and they represent the same conditional expectation \(E[Y\mid X]\). The value \(99\) is not a new estimate of the mean at an observable event; it illustrates why the value assigned at a null point is not identified by the conditional-expectation definition alone.

A common mistake is to apply the positive-probability event formula at \(X=1/2\). Its numerator and denominator are both zero, so that ratio is undefined. The valid conclusion here is that \(E[Y\mid X]=X\) almost surely; the familiar value \(1/2\) comes from choosing the natural version \(m(x)=x\), not from conditioning on a positive-probability event.

Support Restrictions and Conditional Densities

For continuous variables, the conditional density must be calculated on the support allowed by the conditioning value. If \((X,Y)\) has joint density \(f_{X,Y}\) and marginal density \(f_X(x)=\int f_{X,Y}(x,y)\,dy\), then, where \(f_X(x)>0\), the conditional density in \(y\) is \(f_{X,Y}(x,y)/f_X(x)\). Values outside the joint support contribute zero. The resulting conditional mean is an integral over that support, not over an assumed universal range.

Theorem: Suppose \((X,Y)\) has a joint density \(f_{X,Y}\), \(E[|Y|]<\infty\), and \(f_X(x)=\int f_{X,Y}(x,y)\,dy\). For every \(x\) with \(f_X(x)>0\), define $$ m(x)=\frac{\int y f_{X,Y}(x,y)\,dy}{f_X(x)} $$ whenever the numerator is finite. Then \(m(X)\) is a version of \(E[Y\mid X]\), with the formula holding for \(P_X\)-almost every \(x\) where the conditional mean is finite.

Proof. For any Borel set \(C\) of possible \(X\)-values, the conditional-expectation characterization requires \(E[Y\mathbf{1}_{\{X\in C\}}]=E[m(X)\mathbf{1}_{\{X\in C\}}]\). By the joint-density formula and Fubini’s theorem (applicable because \(E[|Y|]<\infty\)),

$$ E[Y\mathbf{1}_{\{X\in C\}}] =\int_C\int y f_{X,Y}(x,y)\,dy\,dx. $$

For \(x\) with \(f_X(x)>0\), the definition of \(m(x)\) gives \(\int y f_{X,Y}(x,y)\,dy=m(x)f_X(x)\). Hence

$$ E[Y\mathbf{1}_{\{X\in C\}}] =\int_C m(x)f_X(x)\,dx =E[m(X)\mathbf{1}_{\{X\in C\}}]. $$

This holds for every Borel set \(C\), and \(m(X)\) is measurable as a function of \(X\). It therefore satisfies the defining conditional-expectation characterization. Values where \(f_X(x)=0\) do not affect the equality, since those \(x\)-values have zero probability under the distribution of \(X\). \(\square\)

Worked Example: Respecting the Conditional Support

Let \(X\) be uniform on \((0,1)\). Given \(X=x\), let \(Y\) be uniform on \((0,x)\). For \(0<x<1\), the joint density is \(f_{X,Y}(x,y)=1/x\) when \(0<y<x\), and zero otherwise: the conditional density of \(Y\) is \(1/x\) on an interval of length \(x\), so it integrates to one. The marginal density of \(X\) is one on \((0,1)\).

For \(0<x<1\), the allowed \(y\)-values run only from \(0\) to \(x\). Thus the conditional mean 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}. $$

For example, when \(x=0.6\), the conditional support is \((0,0.6)\), and the mean is \(0.3\). Integrating \(y/x\) from \(0\) to \(1\) would both include impossible values \(y>x\) and fail to integrate the conditional density to one. The support is part of the calculation, not an optional detail.

Averaging a Conditional Mean Over a Range

Another frequent error is to average a conditional-mean function over the wrong distribution. If \(m(X)=E[Y\mid X]\), then averaging \(m(X)\) over the population means using the distribution of \(X\). Restricting attention to a range changes that distribution: values of \(X\) inside the range must be weighted according to their conditional probabilities there.

Worked Example: Averaging After Truncating the Conditioning Variable

Use the preceding model, where \(X\sim\operatorname{Uniform}(0,1)\) and \(E[Y\mid X=x]=x/2\). Find \(E[Y\mid 1/2<X<1]\). On this event, \(X\) is uniform over \((1/2,1)\), and the conditional mean function is \(x/2\). Therefore

$$ E[Y\mid 1/2<X<1] =\frac{\int_{1/2}^{1}(x/2)\,dx}{P(1/2<X<1)} =\frac{\left[x^2/4\right]_{1/2}^{1}}{1/2} =\frac{1/4-1/16}{1/2} =\frac{3}{8}. $$

Equivalently, \(E[X\mid 1/2<X<1]=3/4\), so the average of \(X/2\) on this range is \(3/8\). Using the unconditional average \(E[X/2]=1/4\) would ignore the restriction and answer a different question. Likewise, evaluating the function at an arbitrary representative point is not a substitute for averaging over the conditional distribution of \(X\).

Common Mistakes and a Practical Check

  • Dividing by zero. The event definition requires \(P(A)>0\). At a continuous point \(x\), do not use the event formula with \(A=\{X=x\}\); use a conditional distribution or a version of \(E[Y\mid X]\), and note when pointwise values are not identified.
  • Replacing a conditional mean with the overall mean. \(E[Y\mid X]\) varies with the information in \(X\). It is not generally equal to the constant \(E[Y]\), though its average over the distribution of \(X\) recovers \(E[Y]\) when the relevant integrability conditions hold.
  • Using equal weights for unequal groups. A population mean weights group means by group probabilities. An unweighted average answers a different question unless all group probabilities are equal.
  • Ignoring support. In a conditional-density calculation, identify the possible values of the variable being integrated over for each fixed conditioning value. Integrating beyond those limits can add impossible outcomes or produce a density that does not normalize.
  • Mixing up two averaging distributions. When conditioning on a range of \(X\), average the conditional-mean function using the distribution of \(X\) within that range, not its unconditional distribution.

Before accepting a conditional average, check four items: the conditioning event or variable, whether the conditioning event has positive probability, the support under the condition, and the probabilities used as weights. Those checks catch most errors before they propagate into later calculations.

Check Your Understanding

For each question, identify the conditioning information and justify the weighting or support used.

  1. Two groups have probabilities \(0.3\) and \(0.7\), with conditional means \(8\) and \(3\). What is the overall mean, and what incorrect result would equal weighting give?
  2. If \(X\) is continuously distributed, why does the event formula for \(E[Y\mid X=x]\) fail at a single fixed \(x\)?
  3. In the model \(X\sim\operatorname{Uniform}(0,1)\) with \(Y\mid X=x\sim\operatorname{Uniform}(0,x)\), what is \(E[Y\mid X=0.4]\), and which support limits are used?
  4. Why can changing a version of a conditional-mean function at one point of a continuous \(X\) leave \(E[Y\mid X]\) unchanged almost surely?
  5. When averaging \(E[Y\mid X]\) over an event \(a<X<b\), which distribution supplies the averaging weights?