Tutorial 6
Mode and Median of Random
Variable, Gamma Distribution
1
Mode of random variable
Discrete R.V.:
If T = k is the mode, then,
P(T k ) P(T i) for i
Continuous R.V.:
If a is the mode, then
f(a) f(b) for b
Position of the maximum in p.d.f / p.m.f
2
Median of random variable
Discrete R.V.:
If T = i is the median, then,
i i 1
P (T k ) 1
k 1
2
and P (T k ) 1
k 1
2
for i 1
P (T i ) 1 for i 1
2
Continuous R.V.:
a 1
If a is the median, then F (a) f ( x)dx
2
3
Example - Binomial R.V
X is a random variable with parameter (n,p),
find the median and mode of X?
Median: a minimum k such that
k
1
P( X r ) 2
r 1
k
1
nCr (1 p) nr
p
r
r 1 2
4
Example - Binomial R.V
Mode: a maximum k such that
P{ X k}
1
P{ X k 1}
Ck (1 p ) n k p k
n
n k 1 k 1
1
nCk 1(1 p ) p
(n k 1) p
1
k (1 p )
k (n 1) p
5
Example – Exponential R.V
X is a random variable with p.d.f,
e x if 0 x
f ( x)
0 otherwise
where is a positive constant.
Find its mode and median.
Find its generating function, and thereby its
skewness and kurtosis.
6
Example – Exponential R.V
Mode:
As f(x) is strictly decreasing function, its
maximum occurs at x=0.
0 is the mode.
a 1
Median:
0 f ( x)dx 2
a 1 ln 2
0 e dx 2 a
x
7
Example – Exponential R.V
Moment Generating Function:
M (t ) E[e ] e e
tX tx x
dx
0 t
E[( X ) 3 ]
Skewness
3
E[( X ) 4 ]
Kurtosis
4
By finding E[X], E[X²], E[X³],…from M(t),
skewness and kurtosis can be found.
8
Gamma Distribution
A random variable is said to have a gamma
distribution with parameters (t, ), if its density
function is given by
e x (x)t 1
x0
f ( x) (t )
0 x0
Where (t ) is the gamma function,
define by e y y t 1dy
0 9
Gamma Distribution
Since (t ) y t 1e y dy,
0
then (t ) e y y t 1
e y (t 1) y t 2 dy
0 0
(t 1) e y y t 2 dy
0
(t 1)(t 1)
(n) (n 1)! for positive n
10
Gamma Distribution
The cumulative density function,
F ( x) P{ X x}
t 1
x j
1 e x
j 0 j!
if x 0
11
Mean of Gamma Distribution
ConsiderX as a gamma random variable
with parameter t and .
1
(t ) 0
E[ X ] xe x (x) t 1 dx
1
(t ) 0
e x (x) t dx
1
(t ) 0
x x (x) t d (x)
12
Mean of Gamma Distribution
1
(t ) 0
E[ X ] e y y t dy
(t 1)
(t )
t!
(t 1)!
t
Mean of Gamma(t , ) = t/
13
Variance of Gamma Distribution
First calculate E[X2]:
1 2 x
(t ) 0
E[ X ]
2
x e (x) t 1 dx
1
(t ) 0
2 e x (x)t 1dx
1
(t ) 0
2 e x (x) t 1d (x)
1
(t ) 0
2 e y t t 1d ( y )
14
Variance of Gamma Distribution
(t 2)
E[ X ] 2
2
(t )
t (t 1)
2
Var( X ) E[ X 2 ] ( E[ X ])2
t (t 1) t
( )2
2
t
2
Variance of Gamma(t , ) = t/ ² 15
Mode of Gamma Distribution
Since
e x (x) t 1
f ( x) if x 0
(t )
x t 1 x
f ' ( x) [ (t 1)( x) t 2
e (x) e ]
(t )
x 0 )x ( ' f
)1 t(
Mode of Gamma(t, ) = (t-1)/
16
HW3 Q10 Hints.
Given the mean and mode.
i) First find the value of t and ’s.
ii) Once you find the t, , you can plot the
income distributions.
P{ X x} 1 G ( x; , n)
n 1
(x) k
1 e x for 0 x
k 0 k!
income distribution : Gamma(n, )
17
Income Distribution
x
e ( x ) t 1
f ( x) if x 0
(t )
>> x=[0:60000];
>> t=4;
>> m=1/3000;
>> y=m*exp(-1*m*x).*(m*x).^(t-1)/gamma(t);
>> plot(y)
18
Income Distribution
19
Gini Index
1
G G ( x)[1 G ( x)]dx
0
20