- Learn
- Mathematics
- Statistics
- Probability Theory
- Conditional Expectation
Conditional Expectation
IntermediateLesson 7 of 9 in Probability Theory Course
What you will learn
- Find the mean of a random variable once you know that an event has happened, for discrete and continuous variables, and combine conditional means over a partition to get the overall mean.
- Find the mean of a discrete variable given an eventBuild the conditional distribution of a discrete random variable given an event, compute its mean, and check the result.
- Find the mean of a continuous variable given an eventUse the conditional density on an event to compute conditional means for uniform, exponential and normal variables, and recognize the memoryless property.
- Combine conditional means with the law of total expectationCompute an overall mean as a weighted average of conditional means over a partition, use first-step analysis, and avoid the two-envelope trap.
- Find the mean of a discrete variable given an event
- Treat E(Y | X = x) as a function of x and E(Y | X) as a random variable, compute both from joint distributions, and use known conditional distributions and symmetry to find them quickly.
- Compute E(Y | X = x) from a joint distributionFind conditional distributions from a joint PMF or joint PDF and compute the conditional mean for each value of the conditioning variable.
- Treat E(Y | X) as a random variableTurn the function E(Y | X = x) into the random variable E(Y | X), find its distribution, and extend the idea to several conditioning variables.
- Use known conditional distributions and symmetryRecognize named conditional distributions (Poisson splitting, multinomial, bivariate normal) and symmetry arguments to find conditional means without integration.
- Compute E(Y | X = x) from a joint distribution
- Use linearity, taking out what is known, independence and Adam's law to simplify calculations, reason about the residual Y − E(Y | X), and find means of two-stage experiments and random sums.
- Use the core properties and Adam's lawApply linearity, taking out what is known, the independence property and Adam's law, including its version with extra conditioning, and use the residual's properties.
- Solve two-stage problems and random sums with Adam's lawCondition on the first stage of an experiment to find a mean, and find the mean of a sum with a random number of terms.
- Use the core properties and Adam's law
- Compute conditional variances, split a total variance into within-group and between-group parts with Eve's law, and find the variances of mixtures and random sums.
- Compute conditional varianceDefine Var(Y | X) as a random variable, compute it from conditional distributions, and use its basic properties.
- Decompose variance with Eve's lawState, prove and apply Eve's law, and read its two terms as within-group and between-group variation.
- Find variances of mixtures and random sumsUse Eve's law to find the variance of a random sum, a Poisson-thinned count and a binomial with a random success probability.
- Compute conditional variance
- Explain why E(Y | X) is the best predictor of Y from X in mean squared error, measure how much of the variance X explains, and see conditional expectation as an orthogonal projection.
- Use E(Y | X) as the best predictor of YProve that the conditional mean minimizes mean squared prediction error, compute that minimum, and compare predictors.
- Interpret conditional expectation as a projectionPicture E(Y | X) as the orthogonal projection of Y onto the functions of X, and contrast it with the best linear predictor.
- Use E(Y | X) as the best predictor of Y
Conditional Expectation study guide
1Find a mean after an event
Learning that an event happened changes the outcomes you average over and the probabilities you use. Start by rebuilding a discrete or continuous distribution inside that event. Then combine the means of separate cases to recover an overall mean. The same weighted averaging leads to equations for waiting times, where the next step can finish the process or return it to a state you have already described.
1.1 Averages inside an event
A conditional mean answers a question such as “What is the average roll among the rolls that are even?” The condition selects the outcomes that remain possible. Their probabilities must then add to 1 again.
Restrict, rescale, average
For an event with , the conditional expectation of a discrete variable is
List the possible values inside the event, find their conditional probabilities, and multiply each value by its new probability. Equal weighting works only when the surviving values are equally likely. Given a specified event, the result is a single number.
Roll a fair six-sided die and call its result . For the event , the surviving values are 2, 4, and 6. The event has probability 1/2, so each surviving value has probability . Thus
Given , the surviving values are 4, 5, and 6, and the conditional mean is 5. Both differ from the unconditional mean 3.5 because the information changes the distribution being averaged.
Use an indicator to select the event
The indicator is 1 on the event and 0 elsewhere. Multiplying by it removes contributions outside the event:
For the even-roll event, . This is an average over all six outcomes, including the zeros produced on odd rolls. Dividing by gives 4. Stopping at 2 forgets the rescaling. A useful check is that the answer must lie between the smallest and largest surviving values; when several values have positive probability, the mean cannot equal an extreme unless all the mass is there.
Transform values before averaging
Linearity still holds inside a condition:
For a nonlinear function, apply the function to each outcome first. Conditional LOTUS gives . For the even die roll,
while . Squaring and averaging generally give different results in different orders.
Information that leaves a distribution unchanged
When is independent of the event, . If two fair dice are independent and the first shows 6, the second still has mean 3.5. The sum has conditional mean .
For a geometric waiting time, information about past failures leaves the future waiting distribution unchanged. Let count rolls through the first 6. Its mean is 6 rolls. Given four failures, the expected remaining count is still 6, so . The elapsed rolls belong in the total, even though the future starts afresh.
Key Takeaways
- Conditional probabilities rescale the mass inside an event of positive probability.
- For a discrete variable, .
- The indicator formula is .
- For a nonlinear transformation, transform each value before averaging.
- A geometric waiting time counts both elapsed failures and the fresh expected wait.
1.2 Conditional densities and remaining lifetimes
For a continuous variable, conditioning on an interval keeps the density's shape within that interval and rescales its area to 1. An integral then gives the conditional mean, just as a weighted sum does for a discrete variable.
Normalize the retained density
If has density and has positive probability, then
with density 0 outside the retained set. Therefore
The denominator is a probability, not the width of the interval unless the original density makes those the same. Check that the conditional density integrates to 1 before computing its mean.
For , knowing leaves a uniform variable on . Its density there is and its mean is the midpoint, .
A normal variable restricted to positive values
Let , with density . Since ,
The positive half has probability 1/2. Dividing gives . Symmetry gives the negative conditional mean as about −0.798. Their equally weighted average is 0.
Total life and remaining life
An exponential lifetime has rate and mean . Its memoryless property says that, given survival to time , the remaining lifetime has the original exponential distribution. Hence
For a component with mean life 1,000 hours, survival through 300 hours leaves an expected 1,000 further hours. The expected total is 1,300 hours. Subtracting 300 from the original mean would confuse a fixed scheduled lifetime with a random exponential lifetime.
Memorylessness is a property of the model. If instead hours, survival to 300 hours leaves . The total mean is 1,150 hours, and the remaining mean is 850 hours.
An event involving another variable
The indicator identity works for any event of positive probability, even when the event involves two variables. Let be independent uniform variables on and suppose . The event occupies half the unit square. For each fixed , the allowed values of run from 0 to , so
Dividing by 1/2 gives . This calculation weights each possible by how much of the event lies at that height.
Conditioning on the exact value of a continuous variable needs a different denominator: . Conditional densities given a random variable handle that case.
Key Takeaways
- A conditional density must have total area 1 on the retained set.
- For an interval event, integrate over that interval and divide by its probability.
- Exponential survival leaves the expected remaining life unchanged.
- Expected total lifetime includes the time already elapsed.
1.3 Weighted cases and first-step equations
Sometimes a mean is easier to find one case at a time. The cases must be disjoint and cover all outcomes. Weight each case's conditional mean by the probability of entering that case.
Combine a partition
For a partition with positive case probabilities, the law of total expectation is
A delivery averages 30 minutes on dry days and 45 minutes on rainy days. If 20% of days are rainy, the mean is minutes. The unweighted average, 37.5 minutes, treats the weather cases as equally common. Here the correct mean is closer to the dry-day mean because dry days occur four times as often.
Taking turns each mean into a probability and gives the law of total probability.
Count the first step
In a waiting problem, the first outcome creates a useful partition. Let be the expected number of independent trials through the first success, with success probability . A first success uses one trial. A first failure uses one trial and leaves the original problem:
Expanding gives , so and . The “1” counts the trial just taken. It appears in every branch, including branches that return to the starting state.
Keep enough history to describe the next step
For two consecutive heads from a fair coin, define as the expected further flips with no current head, and as the expected further flips just after one head. From the first state, a head moves to the second state and a tail returns to the first:
From the second state, a head finishes and a tail loses the run:
The first equation gives . Substituting the second equation into this relation gives , so and . A tail after a head returns to state ; retaining the earlier head would describe a different stopping rule.
Average inside a condition
Given another event , the weights must describe the cases within :
summing over intersections with positive probability. Mixing conditional means with unconditional weights generally averages over the wrong population.
Diagnose the two-envelope argument
Suppose one envelope contains a positive amount with finite mean and the other contains . Choose one at random, holding while the other holds . Both have mean by symmetry.
A tempting calculation says that the other amount is twice or half yours with equal chances, then treats your amount as having the same mean in both cases. But when , you hold the smaller amount and . When , you hold the larger amount and its conditional mean is . Correct case weighting gives .
Key Takeaways
- Weight each conditional mean by the probability of its case.
- A partition covers every outcome exactly once.
- First-step equations count the step just taken in every branch.
- Choose states that preserve the history needed for future outcomes.
- Within a condition, use conditional case probabilities.
- In the envelope problem, the held amount has different conditional means in the two cases.
2Find conditional means from joint distributions
Knowing the value of another random variable creates a whole family of conditional distributions. Each fixed value gives a numerical mean; inserting the random variable itself gives a random mean. Work from joint probabilities or densities, then use named distributions and symmetry when they simplify the calculation. Keep track of which information is known, especially when an interval or a total constrains the remaining values.
2.1 Conditional means from a probability table or density
Fix a value of the variable you observe. The possible values of and their probabilities now come from the conditional distribution at that . Compute its mean before allowing to vary.
A discrete joint distribution
For ,
Suppose counts children in a household and indicates car ownership. The joint probabilities are:
| Children | No car, Y = 0 | Car, Y = 1 | Total |
|---|---|---|---|
| 0 | 0.10 | 0.20 | 0.30 |
| 1 | 0.20 | 0.10 | 0.30 |
| 2 | 0.10 | 0.30 | 0.40 |
For an indicator, the conditional mean is the conditional probability of 1. Divide the car entry by its row total. This gives for no children, for one child, and for two children. Using the whole-table car total, 0.6, would ignore which row is known.
A continuous joint distribution
For a joint density and a value with ,
Hold fixed and integrate over . The denominator is the marginal density of the variable being conditioned on. Division by cannot work for a continuous variable because that probability is zero.
Take on . First integrate out :
The numerator of the conditional mean is
Therefore for . As approaches the endpoints from inside the square, the mean approaches and . These are limits; the density's stated support does not include the endpoints. The graph of this conditional mean, called the regression function, is curved.
Let the support determine the limits
If the joint density is 2 on , fixing leaves the interval for . Its marginal is . The conditional density is on that interval, which is uniform. Hence
Integrating from 0 to 1 would include impossible pairs above the triangle. For each fixed , check that the proposed conditional density integrates to 1 over its actual support.
Specify the conditioning variable
A probability-zero set alone need not determine a unique conditional calculation. Different random variables can describe the same zero-probability set while inducing different conditional distributions there, the issue behind the Borel–Kolmogorov paradox. The joint model and the variable in specify the conditioning procedure. A one-to-one change of that variable preserves its information; merely naming the same zero-probability set does not supply a conditional density.
Key Takeaways
- Normalize a discrete row by its marginal probability.
- For continuous conditioning, divide the joint density by .
- Integrate only over the support that remains after fixing the observed value.
- A regression function describes how the conditional mean changes with the observed value.
- Specify the random variable that defines continuous conditioning.
2.2 A conditional mean can itself be random
Before an observation arrives, the mean you will use after seeing it can vary. Conditional expectation given a random variable records this changing prediction as a random variable of its own.
From a function to a random variable
First find . Then define
At a fixed , is a number. Across outcomes, changes with . Conditional expectation exists for an integrable variable, meaning . A constant is also a random variable, so the conditional mean may be constant in special cases.
| Expression | Meaning |
|---|---|
| E(Y given X = x) | A numerical mean at one observed value |
| E(Y given X) | A function of the random observation |
| E(Y) | One mean over the entire distribution |
Break a stick in two stages
Start with a stick of length 1. Choose , keep the left piece of length , and choose a uniform point in that piece. Let be the new left-piece length. Given , is uniform on and has mean . Thus .
Because scaling a uniform variable scales its interval, . This is the distribution of the conditional mean. It is distinct from the distribution of the actual piece length: the mean takes just the midpoint of each possible retained interval.
Read the distribution from the observed variable
Roll a fair die for , then flip fair coins. If counts heads, , so . The conditional mean takes 0.5, 1, 1.5, 2, 2.5, and 3, each with probability 1/6. The number of heads is integer-valued, but its mean need not be.
More generally, transfer the probability of each observed value to its conditional mean. If different observed values produce the same mean, add their probabilities. In the household table, the means inherit probabilities 0.3, 0.3, and 0.4. Their weighted mean is .
Track the information retained
Independent and give . At the other extreme, if , its value is already known and .
A one-to-one transformation retains all the information, so . A transformation that merges values can lose information. If is equally likely to be −1 or 1 and , then . But always, so : observing the square gives no sign information.
Observe several variables
Conditional expectation can be a function of several observations. For three independent fair dice and their sum ,
Keep the observed terms unchanged and average only the unobserved terms. Writing a lowercase in leaves a fixed input where the random variable belongs.
Key Takeaways
- Compute the function at a fixed value, then substitute the random variable.
- The distribution of a conditional mean comes from the conditioning variable.
- A conditional mean can take noninteger values even when the outcome is a count.
- One-to-one transformations preserve the available information.
- Conditioning on several observations produces a function of all of them.
2.3 Recognize a conditional distribution or use symmetry
A conditional mean is often available without evaluating a sum or integral. Identify the conditional distribution and use its mean, or show that symmetry forces several conditional means to be equal.
Allocate a Poisson total
Let and be independent. Given their total , the share assigned to is binomial:
Its conditional mean is . Work emails average 6 per hour and personal emails 2 per hour, independently. Given a total of 12, the expected work count is . Before observing the total, the corresponding random mean is .
Divide a total among symmetric terms
For i.i.d. variables with finite means, let . Their conditional means given are equal by symmetry. Linearity says these means add to , so each is .
Three i.i.d. component lifetimes with a known total of 4,500 hours therefore have conditional means of 1,500 hours each. This uses the observed total, not the original unconditional mean. Independence and identical distribution supply the symmetry here; equal means alone would not justify treating the conditional distributions as interchangeable.
Remove one multinomial category
For , knowing leaves observations in categories 1 and 3. Their probabilities renormalize to and . Thus
when . For 100 survey answers with probabilities 0.5 “yes,” 0.3 “no,” and 0.2 “unsure,” knowing there are 40 “no” answers leaves 60. The expected “yes” count is . Both the number of remaining trials and their category probability change.
Use the bivariate normal mean
For a bivariate normal pair with positive marginal standard deviations,
and the conditional variance is . In a height model, take fathers' mean as 175 cm, sons' mean as 176 cm, both standard deviations as 7 cm, and correlation 0.5. A father of 189 cm is 2 standard deviations above his mean. The conditional son mean is cm, 1 standard deviation above his mean.
This regression toward the mean concerns conditional averages. It does not shrink the marginal population variance of . Conditional variation remains around each mean, here with variance 36.75 and standard deviation about 6.06 cm. The normal conditional mean is linear; conditional means from other joint distributions can be curved.
Key Takeaways
- Independent Poisson counts split a known total according to their rate shares.
- Symmetric i.i.d. terms each have conditional mean equal to the total divided by their number.
- A fixed multinomial category changes both the remaining count and the remaining category probabilities.
- A bivariate normal conditional mean is linear in the observation.
- Regression toward the mean describes conditional averages, not a loss of population variation.
3Simplify means with conditional expectation
Conditional expectation lets you treat observed quantities as fixed while averaging what is still unknown. Its algebra explains how to simplify products, recover an overall mean, and separate a prediction from its residual. In experiments with a random first stage, choose a condition that makes the second stage familiar. Averaging that simpler result often avoids deriving the full distribution of the final outcome.
3.1 Known factors, towers, and residuals
Once you condition on , a function of is known. That simple observation explains which factors can leave a conditional expectation and which must remain inside it. Throughout, expectations used in these operations must exist; the variance and orthogonality statements use finite second moments.
Apply linearity and take out known factors
For constants ,
More generally, , and . Thus . Pulling out would require knowing it from the condition; observing alone does not generally reveal .
Independence gives , but a constant conditional mean is weaker than independence. Let be equally likely to be 1 or 2, let an independent sign be equally likely to be −1 or 1, and set . The sign averages to zero for either value of , so . Yet , which is dependence.
With finite second moments, independence implies a constant conditional mean, which implies zero covariance. Neither implication reverses. For uniform on and , covariance is zero by symmetry, but varies with .
Average away the condition
Adam's law, also called the law of total expectation or tower property, states
For discrete variables, write and expand:
The probability product is the joint probability. Summing over leaves the marginal probability of each , giving . Conditional averaging groups the contributions without changing their total.
A tower with extra conditioning keeps the smaller information set:
The inner mean uses both observations. The outer mean averages over the part still unknown when only is kept. This rule relies on nested information; arbitrary removal or rearrangement of conditions is not a tower identity.
Find a product moment by conditioning
In the two-stage stick model, and . Then . For the product,
Since , the covariance is . Taking out the known factor is done inside the conditional mean; Adam's law then performs the final averaging.
The residual has no conditional mean left
Define . Linearity and the known-function rule give , so . For every square-integrable ,
Thus the residual is uncorrelated with every such function of . It may still depend on through its spread: the independent-sign example has zero conditional mean while its size is exactly .
Key Takeaways
- Only quantities known from the condition can be taken outside the conditional average.
- Adam's law gives .
- Nested conditional averaging leaves the smaller information set.
- Independence is stronger than a constant conditional mean; zero covariance is weaker.
- Conditioning can simplify product moments before the final average.
- A conditional-mean residual is orthogonal to square-integrable functions of the observation.
3.2 Average the easy second-stage mean
A complicated outcome can become familiar after its first stage is fixed. Choose the first-stage variable, calculate the conditional mean of the second stage, and average that function over the first-stage distribution.
Count heads after a random number of flips
Roll a fair die for , then flip fair coins and count heads with . At , the count is binomial with mean . Before the roll, is random. Adam's law gives
No marginal probability for each possible head count is needed. Answering would stop at the conditional mean; the question about the overall mean still needs the outer average.
Keep a random fraction of a Poisson count
Suppose a bird lays eggs and each hatches independently with probability . Given , the hatch count is . Therefore and . For and , the mean is 3. The Poisson model supplies the expected number of opportunities; the binomial model supplies the mean response per opportunity.
A sum with a random number of terms
Let , with when . The terms are i.i.d. with finite mean , and the nonnegative integer count is independent of the sequence. With a fixed count , linearity gives the mean of terms as . Hence
for finite . The terms do not need a particular named distribution. Independence from the count ensures that learning how many terms there are does not change each term's mean.
A server receives a Poisson count of requests with mean 20 per minute. Each processing time has mean 15 ms, independently of the count and the other times. The expected total processing time for those requests is ms. This total adds processing times; it is not a claim about elapsed time when jobs run in parallel.
Check what knowing the count reveals
If the count depends on the term values, learning can reveal information about those values. For example, stopping at the first long request tells you that earlier requests were short. In that model, can fail because the conditional term means are changed. The independent-count result applies to a count selected without inspecting the sequence.
Replacing the sum by also changes the model. Under independence from , this product has the same mean , but it repeats a single random value. A true random sum adds separate values. Their variance calculations therefore need different treatment.
First-step equations follow the same strategy: condition on the next outcome, describe the expected future from its resulting state, then average those conditional means.
Key Takeaways
- Choose a first-stage variable that makes the second-stage mean easy.
- For an independent count and i.i.d. terms, .
- The unconditional random-sum mean is .
- Learning a value-dependent count can change the term distributions.
4Separate within-group and between-group variance
A conditional mean tracks the center of each group, while conditional variance tracks the spread around that center. Both can change with the observation. Eve’s law combines the average spread within groups with the spread of their means to recover total variance. This decomposition is especially useful when a random count or a random success probability creates a mixture of simpler distributions.
4.1 Spread around a conditional mean
After observing , use the variance of the conditional distribution at that value. Its center is the conditional mean. Before the observation, both that center and its associated variance can be random.
Define conditional variance
For finite second moments,
Expanding the square and taking known factors outside gives the useful computational form
At a fixed observed value , this becomes a number. Substituting into the variance function gives the random variable . It is nonnegative because it averages squared deviations.
The square belongs outside the conditional mean in the second term. Subtracting instead would center at the overall mean, which need not be the center of the conditional group.
Read variance from the conditional distribution
If is Bernoulli with success probability , its variance is . In the household example, car-ownership probabilities give conditional variances . The first two means differ, yet their variances agree because the probabilities are complements.
For the stick model, . Its interval width is , so . For a binomial number of heads from fair flips, . In each case, the named conditional distribution supplies the variance directly.
Scale only the uncertainty left inside the group
Given , functions and are fixed. Therefore
The shift moves the group center but leaves the spread unchanged; the multiplier scales deviations and is squared in the variance. In particular, because nothing about that function remains uncertain.
If and are independent, their conditional and unconditional variances agree. A variance can also be constant while the conditional mean changes. For a bivariate normal pair,
In the height model with cm and , this is for every observed height, with conditional standard deviation about 6.06 cm.
A particular condition can increase spread
Let be equally likely to be 1 or 2, let be an independent fair sign, and set . The conditional mean is always 0 and the conditional variance is . The overall variance is , yet . Observing a high-spread group increases the variance for that observation. The average conditional variance cannot exceed total variance; this is an average statement, not a bound for every possible observation.
Key Takeaways
- Conditional variance measures spread around the conditional mean.
- Compute it as .
- A known shift leaves conditional variance unchanged; a known multiplier is squared.
- A function of the conditioning variable has conditional variance zero.
- Conditional variance may exceed unconditional variance at a particular observed value.
4.2 Eve’s law adds two sources of variation
Groups can have variation within them and different centers from one another. Total variance accounts for both. Assume so that all the variance terms are finite.
Name the two pieces
Eve's law, the law of total variance, states
The first term is the average within-group variance, using the distribution of as weights. The second is the variance of the conditional means. Read their order as E–V plus V–E. Variances add here; standard deviations do not.
Derive the identity
Write and . The conditional second-moment formula gives . Averaging with Adam's law yields
Also . Subtracting the squared overall mean gives
whose last two terms are .
Combine two sections
Suppose 60% of students are in section A, with mean score 70 and standard deviation 10. The other 40% are in B, with mean 80 and standard deviation 5. First find the overall mean:
The within term uses the group variances:
The between term uses the squared distances of group means from 74:
Total variance is 94, so the overall standard deviation is points. Averaging just the two variances would miss the variation caused by different section means.
Average over a continuous first stage
For and , the conditional variance is and the conditional mean is . Therefore
Their sum is . As a separate check, gives ; subtracting gives the same result.
The household indicator offers another check: its overall success probability is 0.6, so its variance is 0.24. Its average conditional variance is and its conditional-mean variance is ; these also add to 0.24.
Read the equality cases
Both pieces are nonnegative. The between term equals total variance exactly when the within term is zero, meaning is determined by with probability 1. The within term equals total variance exactly when the conditional mean is constant. Independence ensures a constant mean, but dependence can remain through changing conditional spread.
Key Takeaways
- Total variance is average conditional variance plus variance of the conditional mean.
- The within term averages group variances with group probabilities.
- The between term measures squared differences of group means from the overall mean.
- The identity follows by averaging conditional second moments.
- Zero within variance means the outcome is determined by the observation.
- Zero between variance means the conditional mean is constant.
4.3 Random counts and random probabilities
Mixtures have two sources of uncertainty: the outcome within a chosen model and the random choice of model. Conditioning makes these sources separate enough to calculate with Eve's law.
Variance of a random sum
Let , taking the empty sum as zero. Assume the terms are i.i.d. with mean and variance , and the count is independent of the sequence, with finite second moment. Given ,
Eve's law gives
The first term is uncertainty in individual values at a given count. The second is uncertainty in the count, with each extra term changing the conditional mean by .
For Poisson requests with mean 20 per minute, and independent processing times with mean 15 ms and standard deviation 5 ms,
The standard deviation is about 70.7 ms. For a Poisson count of mean , the formula is also , since .
The product repeats one time value. Here and , so its variance is . Sharing the same term value creates more variation than adding independent times.
Thin a Poisson count
If and , then
The mean also equals ; indeed the thinned count is Poisson. For a fair die count followed by fair coin flips, the same decomposition instead gives .
Draw one success probability for the whole batch
Let and . The same random probability is used for all trials in the batch. Since , , and ,
For , the mean is 5 and variance 10; the marginal count is uniform on 0 through 10. A model has the same mean but variance only 2.5.
For any random probability with mean , rearranging Eve's law gives
The excess above the averaged-parameter binomial is , here 7.5. This excess differs from the between term because mixing also changes the within term.
Key Takeaways
- Independent random sums have both a term-variance contribution and a count-variance contribution.
- For a Poisson count, .
- Repeating one random value is a different model from adding independent values.
- Poisson thinning gives a count with mean and variance equal to the thinned rate.
- A shared random success probability can greatly increase batch-count variance.
5Predict with conditional means and projections
A prediction is a function of the information you observe. Under squared error, the conditional mean gives the smallest average loss, and Eve’s law tells you how much error remains. The projection interpretation explains the same result geometrically: the residual has zero inner product with every available predictor. Restricting predictions to straight lines uses a smaller space and can leave predictable nonlinear behavior behind.
5.1 The predictor with the smallest squared error
Suppose you observe and predict by a function . A prediction rule should be judged across repeated outcomes. Under squared error, its mean squared error, or MSE, is . Assume and use square-integrable predictors.
Start with no observation
For a constant prediction , expand around the overall mean:
The second term is nonnegative and vanishes at . The best constant is therefore the overall mean, with error . Observing lets the prediction adapt to the particular group.
Split the error into two pieces
Set . For any candidate ,
The first piece is the conditional-mean residual. The second is a function of , so their product has expectation zero. Squaring and averaging gives
The first term is the error of using the conditional mean. The second is an extra nonnegative error from choosing a different prediction. It is zero exactly when the two predictors agree with probability 1. Thus minimizes MSE, and the minimum is .
Measure how much the observation explains
For positive , Eve's law yields the explained fraction
In the stick model, predicting with gives MSE , while the best constant gives . The explained fraction is , about 43%. The remaining variation comes from the second break after the first length is known.
For the bivariate normal height model, the constant predictor has error and the conditional mean has error . The explained fraction is 25%, equal to . This equality is a feature of the linear conditional mean in that model; general conditional means can explain nonlinear patterns too.
Compare information sets
An extra observation expands the available prediction rules: you can always ignore it. Consequently,
For a sum of three independent fair dice, knowing one die gives predictor and error . Knowing two gives and error . Only one independent die remains uncertain in the second case. The improvement concerns the average optimal error; individual conditional variances can still increase for some observations.
Match the predictor to the loss
The conditional mean is optimal for squared error. For absolute error , a conditional median is optimal. In a skewed conditional distribution, the median and mean can differ, so the chosen loss is part of what “best prediction” means.
Key Takeaways
- The best constant under squared error is the overall mean.
- The conditional mean minimizes MSE among functions of the observation.
- Every competing predictor adds a nonnegative squared-distance term to the minimum error.
- The minimum MSE equals the average conditional variance.
- The explained fraction is the between variance divided by total variance when total variance is positive.
- More observed information cannot increase the minimum average squared error.
5.2 Conditional expectation as an orthogonal projection
Random variables with finite second moments can be compared like vectors. Instead of coordinates and ordinary dot products, use products averaged over the probability model. Variables that agree with probability 1 represent the same vector.
Define distance and orthogonality
The inner product is , and the distance is . Two variables are orthogonal when their inner product is zero. Square-integrable functions form the space of predictions available from .
The conditional mean is the orthogonal projection of onto this space. It belongs to the space, and the residual obeys
for every square-integrable . This condition characterizes the projection. If another function has the same property, subtract their conditions and use . The result is , so the two functions agree with probability 1.
Pythagoras gives total variance
The residual is orthogonal to the projection itself. Hence
Subtract . The squared length of the centered outcome becomes the variance of its conditional mean plus the mean squared residual: Eve's law.
Projecting a function already in the space leaves it unchanged, explaining . Projecting onto constants gives . Projecting first onto functions of and then onto constants gives the same overall mean, which is Adam's law. Keeping after conditioning on is projection from a larger prediction space to a contained one.
Restrict the space to straight lines
The best linear predictor allows only functions . For it is
This smaller space cannot beat the unrestricted conditional mean. The errors agree exactly when the conditional mean is an affine function of with probability 1, including the bivariate normal case. Here “linear predictor” includes its constant intercept.
Zero slope can hide perfect prediction
Let be uniform on and . Then , so covariance is zero. Since , the best linear predictor is the constant . Its MSE is
The unrestricted predictor is and has error zero. The observation determines the outcome perfectly, but the relationship is curved and a straight line misses it.
Orthogonality is weaker than independence. In the independent-sign example with , the residual equals because its conditional mean is zero. It is orthogonal to every function of , yet its magnitude reveals . Projection removes predictable conditional means; it need not remove dependence in the conditional spread.
Key Takeaways
- Use expected products as inner products for square-integrable random variables.
- The conditional mean is the projection onto all square-integrable functions of the observation.
- Orthogonality to that space characterizes the conditional-mean residual.
- Pythagoras for the projection yields the total-variance identity.
- A best linear predictor can miss nonlinear predictive information.
Conditional Expectation examples
1Average within an event, then across cases
14 steps
- 1IntroductionWhat information changes
An average uses both possible values and their probabilities. Knowing an event happened can change both; the result is a conditional mean. You will first rebuild the distribution inside an event, then combine separate cases with their probabilities, which works when the cases form a partition. Finally, a waiting-time problem will use those case averages to describe what happens after the next trial.
- 2ExplanationMake the retained probabilities add to one
For an event with positive probability, use . The denominator rescales the surviving mass. The conditional mean is . Given the event, this result is a number: it averages across the outcomes still possible inside that event.
- 3ExampleCondition a fair die on an even result
Roll a fair six-sided die and call the result . Knowing it is even leaves 2, 4, and 6. Their original probabilities add to 1/2, so each conditional probability is . The mean is . The original mean, 3.5, averages a different set of outcomes.
- 4TipCheck an indicator calculation
The indicator sets the outcome to zero outside A. For the even-roll event, . This numerator still averages across all six rolls, including three zeros. Divide by the event probability 1/2 to get 4. An indicator selects contributions; division turns them into an average within the selected event.
- 5ChallengeAverage the transformed values
For the fair die given an even result, what is ? Does squaring the conditional mean give it?
---reveal---
The conditional squared values are 4, 16, and 36, equally likely, so their mean is . Squaring the conditional mean gives 16. A nonlinear function must be applied to the individual values before they are averaged.
- 6ExplanationKeep a continuous interval
For with density , restricting to gives conditional density inside B and zero elsewhere. Thus . For a uniform distribution restricted to a subinterval, the density remains flat there, so the conditional mean is that subinterval’s midpoint.
- 7ExampleSeparate elapsed time from the future
An exponential component lifetime has mean 1,000 hours. Given survival through 300 hours, memorylessness leaves the remaining lifetime with the original distribution. The expected remaining life is still 1,000 hours. The expected total is therefore hours. Subtracting elapsed time from the original mean would treat the random lifetime as a fixed schedule.
- 8ChallengeChange the lifetime model
Instead let a lifetime be uniform from 0 to 2,000 hours. After survival to 300 hours, what are its expected total and remaining lifetimes?
---reveal---
The conditional lifetime is uniform on (300,2000), with mean 1,150 hours. Subtracting 300 elapsed hours gives 850 hours remaining. The interval restriction changes the remaining-life distribution; the exponential memoryless calculation does not apply to this model.
- 9ConnectionPut case means back together
Disjoint, exhaustive events form a partition. The overall mean is . A delivery averaging 30 minutes in dry weather and 45 in rain has mean minutes when rain occurs 20% of the time. An ordinary average of the two means would give rain too much weight.
- 10ExplanationLet the first step define the cases
To wait for two heads in a row from a fair coin, track whether you already have one head. Let a be the expected further flips with no current head and b the mean just after one head. A tail resets the run. A head moves from a to b, or from b to completion. Each branch uses one new flip before the next state is reached.
- 11ExampleWrite and solve the state equations
From no current head, . From one head, . The first equation gives ; substituting the second gives . Thus a is 6 and b is 4. The initial expected wait is six flips, including the two heads that finish the run.
- 12ChallengeCount the flip that finishes
A learner writes for the expected further flips just after one head. What is missing?
---reveal---
The next flip must be counted in both branches, so the equation is . Even when a head finishes the run, that finishing flip still occurs. The zero describes additional flips after completion, not the next flip itself.
- 13ChallengeCombine conditioning and case weights
Within a selected event B, two disjoint cases A₁ and A₂ exhaust B. Their conditional means are 4 and 10, and their probabilities within B are 0.75 and 0.25. What is ?
---reveal---
Use the probabilities within B: . The means describe the intersections with B, so unconditional case probabilities would refer to the wrong population.
- 14RecapUse the condition to choose the average
For an event, rebuild the probability distribution inside it and average there. For a continuous interval, normalize the retained density. To recover a mean across cases, attach each case mean to its probability. In a waiting process, each branch counts the next step and then the expected future from the state it reaches. These are all versions of averaging with the correct conditional weights.
2Turn observed values into a random conditional mean
15 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionA family of predictions
- 2ExplanationRead the support before integrating
- 3ExampleNormalize one vertical slice
- 4ExampleFind the mean along the slice
- 5ChallengeSpot the wrong integration limit
- 6Key InsightReplace the fixed input by its random variable
- 7ExampleFind the distribution of the mean
- 8ChallengeAsk what the observation retains
- 9ExplanationRecognize a Poisson allocation
- 10Key InsightUse equal conditional means to divide a total
- 11ExampleRemove a multinomial category
- 12ExamplePredict on a bivariate normal scale
- 13ChallengeKeep population spread separate
- 14ChallengeCombine a conditional formula with a random total
- 15RecapChoose the shortest justified route
3Condition first, then average
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMake the inner average easy
- 2ExplanationPull out only a known function
- 3ConnectionAverage the conditional means
- 4ExampleFind a product moment in two stages
- 5Key InsightA constant conditional mean can hide dependence
- 6ChallengeCheck the residual’s conditional mean
- 7ExplanationFix a random count
- 8ExampleFinish the outer average
- 9ChallengeThin a first-stage count
- 10TipCheck what knowing the count reveals
- 11ChallengeUse a residual in a product
- 12RecapKeep the two averages distinct
4Build total variance from two pieces
17 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionWhere variation comes from
- 2ExplanationUse the conditional center
- 3ExampleRead spread from a conditional uniform distribution
- 4ChallengeA known shift adds no conditional spread
- 5ExplanationRead Eve’s law in order
- 6ExampleFind the overall center first
- 7ExampleCalculate within and between
- 8Key InsightDerive the decomposition
- 9ChallengeWhat if the group means agree?
- 10ExplanationLet the count define the groups
- 11ExampleCompute a compound Poisson variance
- 12TipA repeated value is a different sum
- 13ChallengeCombine thinning variance terms
- 14ExplanationShare one random probability across a batch
- 15Key InsightThe between term differs from excess variance
- 16ChallengeConnect mixture variance to prediction
- 17RecapName each source before averaging
5Find the best prediction and see its geometry
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionWhat makes a predictor best?
- 2ExplanationCompare a rule with the conditional mean
- 3Key InsightThe extra error is nonnegative
- 4ExampleCompare an observed length with one constant
- 5ChallengeRead a fraction of explained variance
- 6ConnectionMore information expands the available rules
- 7ExplanationUse expected products as dot products
- 8Key InsightProject onto the available information
- 9ConnectionPythagoras recovers Eve’s law
- 10ExampleA smaller prediction space uses only lines
- 11ExampleA curved relationship with zero covariance
- 12ChallengeOrthogonality does not remove all dependence
- 13ChallengeCharge a predictor for its offset
- 14RecapMatch the space and the loss
Conditional Expectation practice questions
Set 1: Event means and conditional distributions10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Conditional information and two-stage means10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Conditional spread and total variance10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Residuals, optimal prediction, and lines10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 5: Transfer across mixtures, information, and prediction10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Adam’s law
B
Best linear predictor
Between-group variance term
Bivariate normal conditional mean
C
Compound Poisson sum
Conditional density given an event
Conditional distribution
Conditional expectation given an event
Conditional LOTUS
Conditional median
Conditional PDF
Conditional PMF
Conditional second moment
Conditional standard deviation
Conditional support
Conditional symmetry
Conditional variance
Conditional-mean random variable
E
Empty sum
Eve’s law
Explained variance fraction
F
First-step analysis
I
Independent count
Indicator variable
Information-preserving transformation
Inner product
Integrability
J
Joint PMF
K
Known conditional shift
L
Law of total expectation over events
M
Mean independence
Mean squared error
Memoryless property
Minimum MSE
Mixture distribution
Multinomial conditional distribution
Multiple conditioning variables
O
Orthogonal projection
Orthogonality
Overdispersion
P
Partition
Poisson allocation
Poisson thinning
R
Random sum
Regression function
Regression toward the mean
Remaining lifetime
Residual
S
Shared random probability
Square-integrable random variable
State in a waiting process
T
Taking out what is known
Tower property with extra conditioning
Truncated distribution
Two-stage experiment
V
Variance decomposition
W
Within-group variance term
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.