Expectation for two variables
Theory
Theory 1
Expectation for a function on two variables
Discrete case:
Continuous case:
These formulas are not trivial to prove, and we omit the proofs. (Recall the technical nature of the proof we gave for in the discrete case.)
Expectation sum rule
Suppose and are any two random variables on the same probability model.
Then:
We already know that expectation is linear in a single variable: .
Therefore this two-variable formula implies:
Expectation product rule: independence
Suppose that and are independent.
Then we have:
Extra - Proof: Expectation sum rule, continuous case
Suppose and give marginal PDFs for and , and gives their joint PDF.
Then:
Observe that this calculation relies on the formula for , specifically with .
Link to originalExtra - Proof: Expectation product rule
Illustration
from joint PMF chart
Expectation of X squared plus Y from joint PMF chart
Suppose the joint PMF of and is given by this chart:
0.2 0.2 0.35 0.1 0.05 0.1 Define . Find the expectation .
Solution
First compute the values of for each pair in the chart:
0 3 1 4 2 5 Now take the sum, weighted by probabilities:
Link to original
Exercise - Understanding expectation for two variables
Understanding expectation for two variables
Suppose you know only that and .
Which of the following can you calculate?
Link to original
two ways, and , from joint density
Expectation of Y two ways and Expectation of XY from joint density
Suppose and are random variables with the following joint density:
(a) Compute using two methods.
(b) Compute .
Solution
(a)
(1) Method One: via marginal PDF :
Then expectation:
(2) Method Two: directly, via two-variable formula:
(b) Directly, via two-variable formula:
Link to original
Covariance and correlation
Theory
Theory 1
Write and .
Observe that the random variables and are “centered at zero,” meaning that .
Covariance
Suppose and are any two random variables on a probability model. The covariance of and measures the typical synchronous deviation of and from their respective means.
Then the defining formula for covariance of and is:
There is also a shorter formula:
To derive the shorter formula, first expand the product and then apply linearity.
Notice that covariance is always symmetric:
The self covariance equals the variance:
The sign of reveals the correlation type between and :
Correlation Sign Positively correlated Negatively correlated Uncorrelated Correlation coefficient
Suppose and are any two random variables on a probability model.
Their correlation coefficient is a rescaled version of covariance that measures the synchronicity of deviations:
The rescaling ensures:
Covariance depends on the separate variances of and as well as their relationship.
Correlation coefficient, because we have divided out , depends only on their relationship.
Link to original
Illustration
Covariance from PMF chart
Covariance from PMF chart
Suppose the joint PMF of and is given by this chart:
0.2 0.2 0.35 0.1 0.05 0.1 Find .
Solution
We need and and .
Therefore:
Link to original
Theory
Theory 2
Covariance bilinearity
Given any three random variables , , and , we have:
Covariance and correlation: shift and scale
Covariance scales with each input, and ignores shifts:
Whereas shift or scale in correlation only affects the sign:
Extra - Proof of covariance bilinearity
Extra - Proof of covariance shift and scale rule
Independence implies zero covariance
Suppose that and are any two random variables on a probability model.
If and are independent, then:
Proof:
We know both of these:
But , so those terms cancel and .
Sum rule for variance
Suppose that and are any two random variables on a probability space.
Then:
When and are independent:
Extra - Proof: Sum rule for variance
Link to originalExtra - Proof that
(1) Create standardizations:
Now and satisfy:
Observe that for any . Variance can’t be negative.
(2) Apply the variance sum rule.
Apply to and :
Simplify:
Notice effect of standardization:
Therefore .
(3) Modify and reapply variance sum rule.
Change to :
Simplify:
Illustration
Variance of sum of indicators
Variance of sum of indicators
An urn contains 3 red balls and 2 yellow balls.
Suppose 2 balls are drawn without replacement, and counts the number of red balls drawn.
Find .
Solution
Let indicate (one or zero) whether the first ball is red, and indicate whether the second ball is red, so .
Then indicates whether both drawn balls are red; so it is Bernoulli with success probability . Therefore .
We also have .
The variance sum rule gives:
Link to original
Exercise - Covariance rules
Covariance rules
Simplify:
Link to original
Exercise - Independent variables are uncorrelated
Dependent but uncorrelated variables
Let be given with possible values and PMF given (uniformly) by for all three possible . Let .
Show that and are dependent but uncorrelated.
Hint: To speed the calculation, notice that .
Link to original
Review: True/False
TRUE or FALSE:
(a) Suppose . It is possible that .
(b) Suppose . It is possible that and have a strong linear relationship.
(c) Suppose . It is possible that and are not independent.
(d) Suppose X and Y are not independent. It is possible that is equal to 0.
(e) Suppose X and Y are independent. must be equal to 0.
Review: Conditional probability
Review
Recall some items related to conditional probability.
Conditioning definition:
Multiplication rule:
Division into Cases / Total Probability:
Link to original
Conditional distribution
Theory
Theory 1
Conditional distribution - fixed event
Suppose is a random variable, and suppose . The distribution of conditioned on describes the probabilities of values of given knowledge that .
Discrete case:
Continuous case:
There is also a conditional CDF, of which this conditional PDF is the derivative:
The Law of Total Probability has versions for distributions:
Conditional distribution - variable event
Suppose and are any two random variables. The distribution of conditioned on describes the probabilities of values of in terms of , given knowledge that .
Discrete case:
Continuous case:
Remember: is the probability that “ and .”
Sometimes it is useful to have the formulas rewritten like this:
Link to originalExtra - Deriving
The density ought to be such that gives the probability of , given knowledge that . Calculate this probability:
Illustration
Example - Conditional PMF, variable event, via joint density
Conditional PMF, variable event, via joint density
Suppose and have joint PMF given by:
Find and .
Solution
Marginal PMFs:
Assuming or , for each we have:
Assuming , , or , for each we have:
Link to original
Conditional expectation
Theory
Theory 1
Expectation conditioned by a fixed event
Suppose is a random variable and . The expectation of conditioned on describes the typical value of given the hypothesis that is known.
Discrete case:
Continuous case:
Conditional variance:
Division into Cases / Total Probability applied to expectation:
Linearity of conditional expectation:
Extra - Proof: Division of Expectation into Cases
We prove the discrete case only.
- Expectation formula:
- Division into Cases for the PMF:
- Substitute in the formula for :
Link to originalExpectation conditioned by a variable event
Suppose and are any two random variables. The expectation of conditioned on describes the typical of value of in terms of , given the hypothesis that is known.
Discrete case:
Continuous case:
Illustration
Example - Conditional PMF, fixed event, expectation
Conditional PMF, fixed event, expectation
Suppose measures the lengths of some items and has the following PMF:
Let , an event.
(a) Find the conditional PMF of given that is known.
(b) Find the conditional expected value and variance of given .
Solution
(a)
Conditional PMF formula with plugged in:
Compute by adding cases:
Divide nonzero PMF entries by :
(b)
Find :
Find :
Find using “short form” with conditioning:
Link to original
Illustration
Example - Conditional expectations from joint density
Conditional expectations from joint density
Suppose and are random variables with joint density given by:
Find .
Solution
(1) Derive the marginal density :
(2) Use to compute :
(3) Use to calculate expectation conditioned on the variable event:
Link to original
Theory - extra (non-examinable)
Theory 2
Expectation conditioned by a random variable
Suppose and are any two random variables. The expectation of conditioned on is a random variable giving the typical value of on the assumption that has value determined by an outcome of the experiment.
In other words, start by defining a function :
Now is defined as the composite random variable .
Considered as a random variable, takes an outcome , computes , sets , then returns the expectation of conditioned on .
Notice that is not evaluated at , only is.
Because the value of depends only on , and not on any additional information about , it is common to represent a conditional expectation using only the function .
Iterated Expectation
Link to originalProof of Iterated Expectation, discrete case
Illustration
Example - Conditional Expectation Variable
Sum of random number of RVs
Let denote the number of customers that enter a store on a given day.
Let denote the amount spent by the customer.
Assume that and $8 for each .
What is the expected total spend of all customers in a day?
Solution
A formula for the total spend is .
By Iterated Expectation, we know .
Now compute as a function of :
Therefore and and .
Then by Iterated Expectation, $400.
Link to original
