What Does the Transformation Reveal?
Suppose we observe \(T=g(X)\), rather than \(X\) itself. Knowing \(T\) tells us which values of \(X\) are possible, but it may not distinguish between them. For example, if \(T=|X|\), then observing \(T=2\) tells us that \(X\) is either \(2\) or \(-2\), if both values are possible. The conditional mean of \(X\) given \(T=2\) is therefore an average over those possibilities.
The average is generally weighted: values of \(X\) that are more probable contribute more. The weights come from the distribution of \(X\), not just from counting how many preimages a transformation has. This principle applies to discrete variables, continuous variables, and coarsened categories.
The Discrete Averaging Formula
First suppose \(X\) takes values in a finite or countable set \(\{x_i\}\), with \(P(X=x_i)=p_i\). For an output \(t\) of the transformation, the values compatible with \(T=t\) are exactly those \(x_i\) for which \(g(x_i)=t\). Conditional expectation averages \(h(x_i)\) over that set, using the conditional probabilities of those values.
To verify the formula, fix an output \(t\) with positive probability. The event \(\{T=t\}\) consists of the disjoint events \(\{X=x_i\}\) for which \(g(x_i)=t\), so $$ P(T=t)=\sum_{i:g(x_i)=t}p_i. $$ For each such \(i\), \(P(X=x_i\mid T=t)=p_i/P(T=t)\). Multiplying \(h(x_i)\) by this conditional probability and summing gives the stated ratio. The sums involving \(h\) are well-defined because \(E[|h(X)|]<\infty\). This also shows that the resulting function of \(T\) has the defining conditional-average property on each event \(\{T=t\}\). \(\square\)
Worked Example: Conditioning on Absolute Value in a Discrete Model
Let \(X\) take values \(-2,-1,1,2\) with probabilities \(0.1,0.2,0.3,0.4\), respectively, and let \(T=|X|\). Find \(E[X\mid T]\).
If \(T=1\), the compatible values are \(-1\) and \(1\), and their total probability is \(0.2+0.3=0.5\). Thus $$ E[X\mid T=1] =\frac{(-1)(0.2)+(1)(0.3)}{0.5} =\frac{0.1}{0.5} =0.2. $$
If \(T=2\), the compatible values are \(-2\) and \(2\), again with total probability \(0.1+0.4=0.5\). Therefore $$ E[X\mid T=2] =\frac{(-2)(0.1)+(2)(0.4)}{0.5} =\frac{0.6}{0.5} =1.2. $$
Since \(T\) takes only the values \(1\) and \(2\), the answer can be written as \(E[X\mid T]=0.2\) when \(T=1\), and \(E[X\mid T]=1.2\) when \(T=2\). The positive answers reflect the greater probability assigned to the positive values in each pair.
Worked Example: Conditioning on an Indicator
Let \(X\) take values \(-2,0,1,3\) with probabilities \(0.2,0.1,0.4,0.3\). Define \(T=\mathbf{1}_{\{X>0\}}\), which records whether \(X\) is positive. Find \(E[X\mid T]\).
When \(T=1\), \(X\) is either \(1\) or \(3\), and \(P(T=1)=0.4+0.3=0.7\). Hence $$ E[X\mid T=1] =\frac{1(0.4)+3(0.3)}{0.7} =\frac{1.3}{0.7} =\frac{13}{7}. $$
When \(T=0\), \(X\) is either \(-2\) or \(0\), and \(P(T=0)=0.2+0.1=0.3\). Thus $$ E[X\mid T=0] =\frac{(-2)(0.2)+0(0.1)}{0.3} =\frac{-0.4}{0.3} =-\frac{4}{3}. $$
The indicator retains only the information “positive” or “not positive.” Within each group, the conditional mean is the probability-weighted average of the original values.
Worked Example: Replacing Values by Category Labels
Suppose \(X\) takes values \(0,1,2,3\) with probabilities \(0.1,0.2,0.3,0.4\). Let \(C\) be the category “low” when \(X\leq 1\) and “high” when \(X\geq 2\). Find \(E[X\mid C]\) in each category.
The low category has probability \(0.1+0.2=0.3\). Its conditional mean is $$ E[X\mid C=\text{low}] =\frac{0(0.1)+1(0.2)}{0.3} =\frac{2}{3}. $$ The high category has probability \(0.3+0.4=0.7\), so $$ E[X\mid C=\text{high}] =\frac{2(0.3)+3(0.4)}{0.7} =\frac{1.8}{0.7} =\frac{18}{7}. $$
A category label is simply another transformation: it groups original values into sets. The conditional mean averages within each set using the probabilities of its members.
Continuous Variables: Weighting the Inverse Branches
For a continuous \(X\), individual values usually have probability zero, so the discrete formula cannot be applied by assigning probabilities to points. Instead, density determines the relative weight of each possible preimage. When \(g\) is many-to-one, a given output \(t\) may have several inverse branches \(x_j(t)\). A branch receives weight proportional to the density of \(X\) there and to the change-of-variables factor \(1/|g'(x_j(t))|\).
To justify the formula, apply change of variables separately on each monotone interval. For any bounded measurable function \(a\), $$ E[h(X)a(T)] =\int h(x)a(g(x))f_X(x)\,dx =\int a(t)\sum_{j=1}^k h(x_j(t))w_j(t)\,dt. $$ The same change of variables with \(h(x)=1\) shows that \(T\) has density \(f_T(t)=\sum_{j=1}^k w_j(t)\) almost everywhere. Define \(m(t)\) by the displayed ratio wherever \(f_T(t)>0\), and choose its value arbitrarily where \(f_T(t)=0\). Then $$ E[m(T)a(T)] =\int a(t)m(t)f_T(t)\,dt =\int a(t)\sum_{j=1}^k h(x_j(t))w_j(t)\,dt =E[h(X)a(T)]. $$ These identities hold for all bounded measurable \(a\), and \(E[|h(X)|]<\infty\) ensures the relevant integrals exist. Thus \(m(T)\) has the defining conditional-expectation property given \(T\), which proves the formula. \(\square\)
Worked Example: Conditioning on the Absolute Value of a Continuous Variable
Let \(X\) have density \(f_X(x)=2(x+1)/9\) for \(-1<x<2\), and zero elsewhere. This is a density because $$ \int_{-1}^{2}\frac{2(x+1)}{9}\,dx =\frac{[(x+1)^2]_{-1}^{2}}{9} =\frac{9}{9} =1. $$ Set \(T=|X|\) and find \(E[X\mid T=t]\).
For \(0<t<1\), both inverse branches, \(x=t\) and \(x=-t\), lie in the support. Since the absolute-value transformation has derivative with absolute value \(1\) on each branch, their weights are $$ w_+(t)=f_X(t)=\frac{2(t+1)}{9}, \qquad w_-(t)=f_X(-t)=\frac{2(1-t)}{9}. $$ Therefore $$ E[X\mid T=t] =\frac{t\,w_+(t)+(-t)\,w_-(t)}{w_+(t)+w_-(t)} =t\frac{(t+1)-(1-t)}{(t+1)+(1-t)} =t^2. $$
For \(1<t<2\), the negative branch \(-t\) is outside the support, so only \(x=t\) is possible. Consequently \(E[X\mid T=t]=t\). The cases \(t=1\) and the endpoints do not affect the result, since they have probability zero under the continuous distribution of \(T\). The complete answer, almost everywhere, is \(t^2\) for \(0<t<1\) and \(t\) for \(1<t<2\).
Common Pitfall: Averaging Preimages Without Weights
A tempting shortcut is to average the possible values of \(X\) equally whenever they map to the same \(T\). That is correct only when those possibilities have equal conditional probabilities. In the discrete absolute-value example, the two values mapping to \(T=1\) are \(-1\) and \(1\), but their probabilities are \(0.2\) and \(0.3\). Their unweighted average is \(0\), whereas the correct conditional mean is \(0.2\).
The same issue appears for continuous transformations. The weights depend not only on \(f_X\) at the inverse points but also on the derivative factor \(1/|g'|\). A second mistake is to assume that conditioning on \(|X|\) always gives a mean of zero. That conclusion holds in symmetric settings where the positive and negative possibilities balance; it does not follow from the transformation alone. In the continuous example above, the conditional mean is positive because the density favors positive values.
Check Your Understanding
Work through these questions by identifying the values or inverse branches compatible with each observed transformed value.
- If \(X\) takes values \(0,1,2\) with probabilities \(0.2,0.5,0.3\) and \(T=\mathbf{1}_{\{X=2\}}\), what is \(E[X\mid T=0]\)?
- For a discrete \(X\), why must the conditional mean given \(g(X)=t\) use the probabilities of the values in that preimage?
- If \(X\) has a symmetric distribution about zero, under what conditions would symmetry imply \(E[X\mid |X|]=0\)?
- For a smooth transformation with two inverse branches, what two factors determine each branch’s weight in the continuous formula?
- Why is a conditional mean at a single output value not uniquely determined when that output has probability zero?