













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Expected Value
The expected value of a random variable indicates its weighted average.
Ex. How many heads would you expect if you flipped a coin twice?
X = number of heads = {0,1,2}
p(0)=1/4, p(1)=1/2, p(2)=1/
Weighted average = 01/4 + 11/2 + 2*1/4 = 1
Draw PDF
Definition: Let X be a random variable assuming the values x 1
, x
2
, x
3
, ... with
corresponding probabilities p(x 1
), p(x
2
), p(x
3
),..... The mean or expected value of X is
defined by E(X) = sum x k
p(x
k
Interpretations:
(i) The expected value measures the center of the probability distribution - center of mass.
(ii) Long term frequency (law of large numbers… we’ll get to this soon)
Expectations can be used to describe the potential gains and losses from games.
Ex. Roll a die. If the side that comes up is odd, you win the $ equivalent of that side. If it
is even, you lose $4.
Let X = your earnings
Ex. Lottery – You pick 3 different numbers between 1 and 12. If you pick all the numbers
correctly you win $100. What are your expected earnings if it costs $1 to play?
Let X = your earnings
Variance
We often seek to summarize the essential properties of a random variable in as simple
terms as possible.
The mean is one such property.
Let X = 0 with probability 1
Let Y = - 2 with prob. 1/
1 with prob. 1/
2 with prob. 1/
Both X and Y have the same expected value, but are quite different in other respects. One
such respect is in their spread. We would like a measure of spread.
Definition: If X is a random variable with mean E(X), then the variance of X, denoted by
Var(X), is defined by Var(X) = E((X-E(X))
2
A small variance indicates a small spread.
Var(X) = E(X
2
2
Var(X) = E((X-E(X))
2
= sum (x- E(X))
2
p(x)
= sum (x
2
2
) p(x)
= sum x
2
p(x) - 2 E(X) sum xp(x) + E(X)
2
sum p(x)
2
2
2
2
2
Ex. Roll a fair die. Let X = number of dots on the side that comes up.
Var(X) = E(X
2
2
2
Var(X) = 91/6 – (7/2)^2 = 91/6 – 49/4 = (182-147)/12 = 35/
If a and b are constants then Var(aX+b) = a
2
Var(X)
E(aX+b) = a E(X) + b
Var(aX+b) = E[(aX+b – (a E(X)+b))
2
]= E(a
2
2
) = a
2
2
)= a
2
Var(X)
The square root of Var(X) is called the standard deviation of X.
SD(X) = sqrt(Var(X)): measures scale of X.
Means, modes, and medians
Best estimate under squared loss: mean
i.e., the number m that minimizes E[(X-m)^2] is m=E(X). Proof: expand and
differentiate with respect to m.
Best estimate under absolute loss: median.
i.e., m=median minimizes E[|X-m|]. Proof in book. Note that median is nonunique in
general.
Best estimate under 1-1(X=x) loss: mode. Ie, choosing mode maximizes probability of
being exactly right. Proof easy for discrete r.v.’s; a limiting argument is required for
continuous r.v.’s, since P(X=x)=0 for any x.
Ex. Binomial random variable with parameters n and p.
Calculate M ( t )
X
X
( t ) = E ( e
tX
) = e
tk
n
k
p
k
( 1 ( p )
n ( k
k = 0
n
n
k
pe
t
k
( 1 ( p )
n ( k
k = 0
n
= pe
t
n
t
n
t
X
M t npe p pe
1
!
t
n
t t
n
t
X
M t nn pe p pe npe p pe
1
2
2
!!
n
X
!
0
1
0
nn p np
E X M t nn pe p pe npe p pe
n n
X
!!
2
0
1
0 2 0
2
2 0
2 2 2 2
Var X = E X! E X = nn! p + np! np = np! p
Later we’ll see an even easier way to calculate these moments, by using the fact that a
binomial X is the sum of N i.i.d. simpler (Bernoulli) r.v.’s.
Fact: Suppose that for two random variables X and Y, moment generating functions exist
and are given by M ( t )
X
and M ( t )
Y
, respectively. If M ( t )
X
= M ( t )
Y
for all values of t, then
X and Y have the same probability distribution.
If the moment generating function of X exists and is finite in some region about t=0, then
the distribution is uniquely determined.
Expectation of sums of random variables
Ex. Let X and Y be continuous random variables with joint pdf f XY
(x,y). Assume that
E(X) and E(Y) are finite. Calculate E(X+Y).
xf xdx yf ydy E X E Y
E X Y x y f x ydxdy xf x ydxdy yf x y dxdy
X Y
XY XY XY
"
"
"
"
"
"
"
"
Same result holds in discrete case.
Proposition: In general if E(X i
) are finite for all i=1,….n, then
1 n 1 n
Proof: Use the example above and prove by induction.
Let X 1
n
be independent and identically distributed random variables having
distribution function F X
and expected value μ. Such a sequence of random variables is
said to constitute a sample from the distribution F X
. The quantity
, defined by
=
n
i
i
n
1
is called the sample mean.
Calculate E( X ).
We know that ( )=μ
i
= = = =μ
= = =
n
i
i
n
i
i
n
i
i
n
n n
1 1 1
When the mean of a distribution is unknown, the sample mean is often used in statistics to
estimate it. (Unbiased estimate)
Ex. Let X be a binomial random variable with parameters n and p. X represents the
number of successes in n trials. We can write X as follows:
n
1 2
where
0 iftrialiisafailure
1 iftrialiisa success
i
The X i
’s are Bernoulli random variables with parameter p.
E X p p p
i
E X E X E X E X np
n
1 2
Ex. A group of N people throw their hats into the center of a room. The hats are mixed,
and each person randomly selects one. Find the expected number of people that select
their own hat.
Let X = the number of people who select their own hat.
Number the people from 1 to N. Let
0 otherwise
1 ifthepersonichoseshisown hat
i
then
N
1 2
Each person is equally likely to select any of the N hats, so
i
i
Hence, 1
1 2
N
Proposition: If X and Y are independent, then for any functions h and g,
E ( g ( X ) h ( Y ))= E ( g ( X )) E ( h ( Y )).
Proof:
g x f xdx h y f ydy E g X Eh Y
E g X hY g xh y f x ydxdy g xh y f x f y dxdy
X Y
XY X Y
"
"
"
"
"
"
In fact, this is an equivalent way to characterize independence: if
E ( g ( X ) h ( Y ))= E ( g ( X )) E ( h ( Y )) for any functions g(X) and h(Y) (but not any function
f(X,Y)), then X and Y are independent. To see this, just use indicator functions.
Fact: The moment generating function of the sum of independent random variables
equals the product of the individual moment generating functions.
Proof: ( ) ( ) ( ) ( ) ( ) () ()
( )
M t Ee Ee e Ee Ee M tM t
X Y
tXY tX tY tX tY
X Y
Covariance and correlation
Previously, we have discussed the absence or presence of a relationship between two
random variables, i.e. independence or dependence. But if there is in fact a relationship,
the relationship may be either weak or strong.
Ex. (a) Let X = weight of a sample of water
Y = volume of the same sample of water
There is an extremely strong relationship between X and Y.
(b) Let X = a persons weight
Y = same persons weight
There is a relationship between X and Y, but not as strong as in (a).
We would like a measure that can quantify this difference in the strength of a relationship
between two random variables.
Definition: The covariance between X and Y, denoted by Cov(X,Y), is defined by
Similarly as with the variance, we can rewrite this equation,
Cov X Y E X E X Y EY E XY E X Y XEY E X E Y
Note that if X and Y are independent,
Cov ( X , Y )= E ( XY )! E ( X ) E ( Y )= E ( X ) E ( Y )! E ( X ) E ( Y )= 0.
The converse is however NOT true.
Counter-Example: Define X and Y so that,
and
1 if 0
0 if 0
X and Y are clearly dependent.
XY=0 so we have that E(XY)=E(X)=0, so Cov ( X , Y )= E ( XY )! E ( X ) E ( Y )= 0.
Ex. Let X 1
n
be independent and identically distributed random variables having
expected value μ and variance σ
2
. Let
=
n
i
i
n
1
be the sample mean. The random
variable
=
n
i
i
n
1
2
2
is called the sample variance.
Calculate (a) Var( X ) and (b) E(S
2
(a) We know that
2
i
Var X.
n
Var X
n
Var X
n n
Var X Var
n
i
i
n
i
i
n
i
i
2
1
2
1
2
1
= = =
(b) Rewrite the sum portion of the sample variance:
2
1
2
2
1
2
1
2
1
2
1 1
2
1
2
1
2 2
1
2
1
2
1
2
μ μ
μ μ μ μ μ μ μ μ
μ μ μ μ μ μ μ μ
μ μ μ μ
=
= = =
= = = =
= = =
X n X
X nX X X X n X X n X
n
i
i
n
i
i
n
i
i
n
i
i
n
i
i
n
i
n
i
i
n
i
i i
n
i
i
n
i
i
n
i
i
2 2 2 2
1
2 2
( 1 )
1
1
( )
1
1
[( ) ] (( ) )
1
1
( ) μ μ! "! =!
"
" =
"
=
$
%
&
'
(
" " "
"
=
=
n
n
n nVar X
n
E X nE X
n
E S
n
i
i
(The sample variance is an unbiased estimate of the variance)
Ex. A group of N people throw their hats into the center of a room. The hats are mixed,
and each person randomly selects one.
Let X = the number of people who select their own hat.
Number the people from 1 to N. Let
0 otherwise
1 ifthepersonichoseshisown hat
i
then
n
1 2
We showed last time that E(X)=1.
Calculate Var(X).
Var ( X ) = Var ( X
i
i = 1
n
) = Var ( X
i
i = 1
n
i
j
i < j
Recall that since each person is equally likely to select any of the N hats
i
Hence,
i
and
i
2
2
2
2
2
2
Var X E X E X
i i i
i j i j i j
Cov X X = E X X! E X E X
0 otherwise
1 ifbothpersonsiandjchosestheirown hat
i j
i j i j j
Definition: The correlation between X and Y, denoted by ρ(X,Y), is defined, as long as
Var(X) and Var(Y) are positive, by
Var X VarY
Cov X Y
It can be shown that
" 1 # $( X , Y ) # 1 , with equality only if Y=aX+b (assuming E(X^2)
and E(Y^2) are both finite). This is called the “Cauchy-Schwarz” inequality.
Proof: It suffices to prove (E(XY))^2<=E(X^2)E(Y^2). The basic idea is to look at the
expectations E[(aX+bY)^2] and E[(aX-bY)^2]. We use the usual rules for adding and
subtracting variance:
0<= E[(aX+bY)^2] = a^2E(X^2)+b^2E(Y^2)+2abE(XY)
0<= E[(aX-bY)^2] = a^2E(X^2)+b^2E(Y^2)-2abE(XY)
Now let a^2=E(Y^2) and b^2=E(X^2). Then the above two inequalities read
0<=2a^2b^2+2abE(XY)
0<=2a^2b^2-2abE(XY);
dividing by 2ab gives
E(XY)>=-sqrt[E(X^2) E(Y^2)]
E(XY)<=sqrt[E(X^2) E(Y^2)],
and this is equivalent to the inequality
" 1 # $( X , Y ) # 1. For equality to hold, either
E[(aX+bY)^2]=0 or E[(aX-bY)^2]=0, i.e., X and Y are linearly related with a negative or
positive slope, respectively.
The correlation coefficient is therefore a measure of the degree of linearity between X
and Y. If ρ(X,Y)=0 then this indicates no linearity, and X and Y are said to be
uncorrelated.
Conditional Expectation
Recall that if X and Y are discrete random variables, the conditional mass function of X,
given Y=y, is defined for all y such that P(Y=y)>0, by
|
p y
p x y
p x y P X x Y y
Y
XY
X Y
Definition: If X and Y are discrete random variables, the conditional expectation of X,
given Y=y, is defined for all y such that P(Y=y)>0, by
x
X Y
x
E ( X | Y y ) xP ( X x | Y y ) xp ( x | y )
|
Similarly, if X and Y are continuous random variables, the conditional pdf of X given
Y=y, is defined for all y such that f ( y )> 0
Y
, by
|
f y
f x y
f x y
Y
XY
X Y
Definition: If X and Y are continuous random variables, the conditional expectation of X,
given Y=y, is defined for all y such that f ( y )> 0
Y
, by
"
"
E X Y = y = xPX = x Y = y = xf x y dx
X Y
|
Conditional expectations are themselves random variables. The conditional expectation
of X given Y=y, is just the expected value on a reduced sample space consisting only of
outcomes where Y=y.
E(X|Y=y) is a function of y.
It is important to note that conditional expectations satisfy all the properties of regular
expectations:
x
X Y
E g ( X )| Y y g ( x ) p ( x | y )
|
if X and Y discrete.
"
E g X Y = y = g x f x ydx
X Y
|
if X and Y continuous.