Tutorial 4
Expected Value, Variance and
Moment Generating Function
1
Expected Value
If X is a discrete random variable having a
probability mass function p(x), the expectation or
the expected value of X, is defined by
E[ X ] xp( x)
x: p ( x ) 0
E[X] is a weighted average of the possible
values that X can take on, each value being
weighted by the prob. that X assumes it.
2
Expected Value
If X is a continuous random variable having a
probability density function f(x), then the
expected value of X is defined by
E[ X ] xf ( x)dx
If a and b are constants, then
E[aX b] aE[ X ] b
3
Example 1
Calculate E[X] if X if a Poisson random variable
with parameter .
ie i
E[ X ]
i 0 i!
e i
i 1 (i 1)!
i 1
e
i 1 (i 1)!
k
e
k 0 ( k )!
e e 4
Example 2
Calculate the expectation of a random variable
uniformly distributed over (a, b).
b
x
E[ X ] dx
a
ba
b a 2 2
2(b a )
ab
2
The expected value of a random variable uniformly
distributed over the interval (a, b) is just the
midpoint of the interval. 5
Variance
If X is a random variable with mean ,
then the variance of X is defined by
Var ( X ) E[( X ) ]
2
The variance of X measures the expected
square of the deviation of X from its expected
value.
6
Variance
Var ( X ) E[ X ] ( E[ X ])
2 2
Var ( X ) E[( X ) 2 ]
( x ) 2 p ( x)
x
( x 2 2 x 2 ) p ( x )
x
x 2 p ( x) 2 xp( x) 2 p ( x)
x x x
E[ X 2 ] 2 2 2
E[ X 2 ] 2
7
Variance
If a and b are constants, then
Var (aX b) a Var ( X )
2
The square root of the Var(X) is called
the standard deviation of X.
8
Example 3
Calculate Var(X) when x represents the
outcome when a fair die is rolled.
7
E[ X ]
2
E[ X 2 ]
1 2 1 2 1 2 1 2 1 2 1
1( ) 2 ( ) 3 ( ) 4 ( ) 5 ( ) 6 ( )
6 6 6 6 6 6
91
6
91 7 2 35
Var ( X ) ( )
6 2 12
9
Moment Generating Functions
Moment generating function is define as
follow:
M (t ) E e tX
etx p( x) if X is discrete with mass function p(x)
x
or
e tx f ( x)dx if X is continuous with density f(x)
10
Moment Generating Functions
Then,
d
M' (t) E etX
dt
d tX
E e
dt
E Xe tX
M' (0) E Xe ( 0 ) X E[X]
11
Moment Generating Functions
d
Similarly, M' ' (t) M ' (t )
dt
d
E[ XetX ]
dt
d
E[ ( XetX )]
dt
E X 2 etX
M' ' (0) E X 2 e ( 0 ) X E[X 2 ]
12
Moment Generating Functions
In general, the nth derivative of M(t) is
given by
M (t ) E[ X e ]
n n tX
n 1
Implying that
M (0) E[ X ]
n n
n 1
13
Example 4
Binomial Dist. (n,p)
M (t ) E e tX
n
n k
e p (1 p ) n k
tk
k 0 k
n
n t k
( pe ) (1 p )
nk
k 0 k
( pe 1- p)
t n
n 1
M ' (t ) n( pe 1- p)
t
pe t
14
Example 4 (con’t)
M ' (t ) n( pet 1- p) n 1 pet
M ' ' (t )
n(n 1)( pe t 1- p) n 2 ( pe t ) 2 n( pe t 1- p) n 1 pe t
Mean = M’(0) = np
E[X2] = M’’(0) = n(n-1)p² + np
Variance = E[X2] – (E[X])²
= n(n-1)p² + np –(np)²
= np(1-p) 15