Professional Documents
Culture Documents
Population vs sample
Population: the large body of data;
Sample: a subset of the population.
403/420
Measures of location
Used to estimate the central point of the sample, also called
measures of central tendency:
The sample mean is given by:
x=
n
1 X
xk
n
k=1
Measures of spread
The sample variance:
s2 =
n
X
1
1
(xk x)2 =
n1
n1
k=1
!
n
X
1
xk2 n x 2 .
n1
n
X
xk2 +
k=1
n
X
k=1
x2 2
n
X
!
xk x
k=1
k=1
all x
s 2.
405/420
Quantiles
P , th quantile or ( 100)th percentile:
1
1
[number of xk <P ] [number of xk P ]
n
n
approximated by linear interpolation as the ((n 1) + 1)th
observation.
Quartiles: Q1 (25th percentile) and Q3 (75th percentile).
Quantile function: FX1 (u), u [0, 1], where FX (x) = u.
Question: What are the 0.025, 0.16, 0.5, 0.84 and 0.975
quantiles of the N(0,1) distribution?
406/420
x n+1 ,
if n is odd;
(
2 )
M=
12 x n + x n +1 , if n is even.
( )
(
)
2
Numerical example
An insurance company has occurred the 26 claims with the
following amounts:
1 120
990
450
478
1 000
975
1 000
584
760
346
2 430
1 406
348
1 100
1 245
760
1 548
752
850
1 000
with
26
P
xi
= 25 855;
i=1
26
P
i=1
408/420
3 400
335
605
588
1 245
540
Numerical example
409/420
588
605
752
760
760
850
975
990
1 000
1 000
1 000
1 100
1 120
1 245
1 245
1 406
1 548
2 430
3 400
Numerical example
Some statistics:
Mean:
x=
n
1 X
25 855
xi =
= 994.42.
n
26
i=1
Variance:
s2 =
n1
n
X
!
xi2 n x 2
i=1
1
36 904 873 26 (994.42)2
=
25
= 447, 762.6.
Standard deviation:
s=
410/420
Numerical example
411/420
Numerical example
Recall: x(1) = 335
and
x(26) = 3, 400.
Range:
R = 3, 400 335 = 3, 065.
Quartiles:
Q1
= x(250.25+1)
= x(6.25)
= 0.75x(6) + 0.25x(7)
= 585
Q2
= M = x(250.5+1)
= x(13.5)
= x(13) + x(14) /2
= 912.5
Q3
= x(250.75+1)
= x(19.75)
= 0.25x(19) + 0.75x(20)
= 1, 115
Interquartile range:
IQR = Q3 Q1 = 1, 115 585 = 530.
412/420
Numerical example
413/420
x(3) + . . . + x(24)
= 879.27.
22
414/420
Proves for E[Fn (x)] and Var (Fn (x)) are not part of the
course.
E.c.d.f.
1
0.9
Data:
0.8
335
450
584
752
850
1000
1100
1245
2430
0.7
F26(x)
0.6
0.5
0.4
0.3
0.2
0.1
0
0
415/420
500
1000
1500
2000
Claim amount
2500
3000
3500
346
478
588
760
975
1000
1120
1406
3400
348
540
605
760
990
1000
1245
1548
Histogram
14
Data:
12
335
450
584
752
850
1000
1100
1245
2430
Frequency
10
8
6
4
2
0
0
416/420
500
1000
1500
2000
Claim amount
2500
3000
346
478
588
760
975
1000
1120
1406
3400
3500
Quant the number of observations in each bin (0, 500], (500, 1000],
(1000, 1500], (1500, 2000], (2000, 2500], (2500, 3000], (3000, 3500].
Bin sizes chosen such that it provides good summary of the data, i.e., not
too short and not too long.
348
540
605
760
990
1000
1245
1548
Stem-and-leaf display
Data:
Stem-and-leaf:
0
0
1
1
2
2
3
417/420
|
|
|
|
|
|
|
333
5556668889
0000011224
5
4
4
335
450
584
752
850
1000
1100
1245
2430
346
478
588
760
975
1000
1120
1406
3400
348
540
605
760
990
1000
1245
1548
Data:
3000
Claim size
2500
2000
1500
1000
500
335
450
584
752
850
1000
1100
1245
2430
418/420
346
478
588
760
975
1000
1120
1406
3400
348
540
605
760
990
1000
1245
1548
25
26
i0.5
26
x(i)
419/420
i0.5
26
0.019 2
0.057 7
0.942 3
0.980 8
-2.069 9
-1.574 4
1.574 4
2.069 9
335
346
2 430
3 400
Data:
1.5
335
450
584
752
850
1000
1100
1245
2430
1
0.5
0
0.5
1
1.5
2
2.5
0
420/420
500
1000
1500
2000
Claim size
2500
3000
346
478
588
760
975
1000
1120
1406
3400
3500
348
540
605
760
990
1000
1245
1548
Week 3
Week 2
Week 4
Probability: Week 1
Week 6
Review
Estimation: Week 5
Week
7
Week
8
Week 9
Hypothesis testing:
Week
10
Week
11
Week
12
Linear regression:
Week 2 VL
Week 3 VL
Week 4 VL
Video lectures: Week 1 VL
Week 5 VL
This week
Joint probabilities:
- Discrete and continuous random variables;
- Bivariate and multivariate random variables;
Covariance;
Correlation;
Law of iterative expectations;
Conditional variance identity.
502/562
and
x21 , x22 , . . .
respectively, we define:
pX1 ,X2 (x1i , x2j ) = Pr (X1 = x1i , X2 = x2j ) ,
for i, j = 1, 2, . . .
X
i=1 j=1
504/562
j=1
and
pX2 (x2j ) =
i=1
505/562
506/562
no
no
74
no
mild
6
no
severe
2
mild
no
3
mild
mild
2
mild
severe
4
severe
no
1
severe
mild
3
severe
severe
5
severe
= 0.09
= 0.11
1+3+5
100
2+4+5
100
FX ,X (x1 , x2 )
x1 x2 1 2
Note:
Z
FX1 ,X2 (, ) =
FX1 ,X2 (, ) =
507/562
fX1 ,X2
Z Z
or, alternatively:
Z
FX1 (x1 ) =
and FX2 (x2 ) =
508/562
x1
Z
x2 Z
509/562
b. The marginal
x
R x c.d.f. of X Ris:x
FX (x) = fX (z)dz = 0 2zdz = z 2 0 = x 2 , if 0 x 1
and zero if x < 0 and one if x > 1.
R
c. The marginal p.d.f. of Y is: fY (y ) = fX ,Y (x, y )dx =
1
R1
2
0 4 x (1 y )dx = 1/2 4 x (1 y ) 0 = 2(1 y ).
Ry
d. The marginal c.d.f. of Y is: FY (y ) = fY (z)dz =
Ry
2 y
2
0 2(1 z)dz = 2z z 0 = 2y y , if 0 y 1 and zero
if y < 0 and one if y > 1.
510/562
Pr (X = x)
1/2
1/2
and
Y =y
0
1
2
3
Pr (Y = y )
1/8
3/8
3/8
1/8
511/562
0
1/16
1/16
Y =y
1
2
3/16 3/16
3/16 3/16
3
1/16
1/16
0
0
1/8
Y =y
1
2
3/16 3/16
3/16 3/16
3
1/8
0
n!
p n1 p2n2 . . . prnr .
n1 ! n2 ! . . . nr ! 1
Ni1 Ni+1
Nr
n
=
pini (1 pi )nni .
ni
Can do this by summing the marginals.
* Using Binomial expansion (prove not required).
513/562
Z
=c
0
1
1 3 1 2
x + x y
3
2
1
1
1
dy =c y + y 2
3
4
0
1
=c
0
7
.
12
0 7
12
1
=
x 2 + x , for 0 x 1,
7
2
and zero otherwise, and for Y :
Z
Z 1
12 2
fY (y ) =
fX ,Y (x, y )dx =
x + xy dx
0 7
12 1 1
=
+ y , for 0 y 1,
7 3 2
515/562
0,
12
if x < 0 or y < 0;
1 2 2
+
x
y
, if 0 x 1, 0 y 1;
7
4
(x, y ) =
F (x) ,
if y > 1;
X
FY (y ) ,
if x > 1.
1 3
3x y
marginal p.d.f.
1.5
1
0.5
0
0.5
1.5
FX(x)
FX,Y(x,y)
1.5
0.5
0
1
1
0.5
0
0 0.5
y0.5 0.5
x
1.5
0.5
0.5
1.5
0.5
0.5
F (y)
marginal p.d.f.
1.5
0
0.5
0.5
517/562
0.5
1
x
slide 519
1.5
0
0
0.5
y
1.5
0.5
0.5
0.5
x
1.5
0,
if x < 0;
12 1 3
1 2
FX (x) = FX ,Y (x, 1) =
x + 4 x , if 0 x 1;
7 3
1,
if x > 1,
and
FY (y ) = FX ,Y (1, y ) =
0,
12
7
1,
1
3y
1 2
4y
if y < 0;
, if 0 y 1;
if y > 1.
1Z y
12 2
x + xy dxdy
0
0 7
y
Z 1 3
x
x 2y
12
+
dy
=
7
3
2
0
0
Z 1 3
y
12
y3
=
+
dy
7
3
2
0
1
Z 1
12 5 y 4
5
12 5 3
y dy =
= ,
=
7
6
7
6
4
14
0
0
R R
so that Pr (X > Y ) = y fX ,Y (x, y )dxdy = 9/14.
Pr (X < Y ) =
519/562
Means
Consider the bivariate random vector X = [X1 X2 ]> .
The mean of X is the vector whose elements are the means of
X1 and X2 , that is,
E [X1 ]
1
=
.
E[X ] =
E [X2 ]
2
If X1 , X2 , . . . , Xn are jointly distributed random variables with
expectations E [Xi ] for i = 1, . . . , n and Y is a affine function
of the Xi , i.e.,
n
X
Y =a+
bi Xi ,
i=1
i=1
i=1
i=1
Variances, Covariances
Recall: variance of X is a measure for the spread of X .
Covariance is a measure of the spread between X1 and X2 .
The variance of the random vector X is also called the
variance-covariance matrix:
2
Var (X1 )
Cov (X1 , X2 )
1 12
Var (X ) =
=
,
Cov (X1 , X2 )
Var (X2 )
12 22
where the covariance is defined as:
Cov (X1 , X2 ) 12 =E [(X1 1 ) (X2 2 )]
=E [X1 X2 X1 2 1 X2 + 1 2 ]
=E [X1 X2 ] E [X1 ] E [X2 ] .
521/562
0.8
0.6
0.4
Solution:
E [X1 ] = 3+2+4
100 1 +
6+2+3
E [X2 ] = 100 1 +
0.2
0
2 = 0.27.
2 = 0.33.
No
Mild
Severe
Mild
Severe
UI
522/562
1+3+5
100
2+4+5
100
No
DI
Question: Is covariance
positive or negative?
Solution:
E [X1 X2 ] = 0.02 1 1 + 0.04 1 2 +
0.03 2 1 + 0.05 2 2 = 0.36.
Cov (X1 , X2 ) = E [X1 X2 ] E [X1 ]
E [X2 ] = 0.36 0.27 0.33 = 0.2709.
E [X2 ] = y fY (y )dx = 0 y 2
(1 y )dy = [y 2 2/3y 3 ]10 = 1/3.
fX,Y(x,y)
3
2
1
0
1
1
0.5
y
523/562
0.5
0 0
Question: Is covariance
positive or negative?
Solution:
R R
E [X1 X2 ] = fX ,Y (x, y ) x
R1R1
ydxdy = 0 0 4 x 2 (y y 2 )dxdy =
R1
2
0 4/3(y y )dy = 4/6 4/9 = 4/18.
Cov (X1 , X2 ) = E [X1 X2 ] E [X1 ]
E [X2 ] = 4/18 2/3 1/3 = 0.
524/562
Properties of Covariance
If X and Y are jointly distributed random variables with
expectations X and Y the covariance of X and Y is
Cov (X , Y ) =E [(X X ) (Y Y )]
=E [X Y X Y Y X + X Y ]
=E [X Y ] X Y .
If X and Y are independent:
Cov (X , Y ) = E [X Y ] X Y = E [X ] E [Y ] X Y = 0.
* using independence X , Y .
525/562
Properties of Covariance
Let X , Y , Z be random variables, and a, b < we have:
Cov (a + X , Y ) =E [(a + X (a + X )) (Y Y )]
=E [(X X ) (Y Y )]
=Cov (X , Y )
Cov (a X , b Y ) =E [(a X a X ) (b Y b Y )]
=E [a (X X ) b (Y Y )]
=a b E [(X X ) (Y Y )] = a b Cov (X , Y )
Cov (X , Y + Z ) =E [(X X ) (Y + Z Y Z )]
=E [(X X ) ((Y Y ) + (Z Z ))]
=E [(X X ) (Y Y ) + (X X ) (Z Z )]
=Cov (X , Y ) + Cov (X , Z ) .
526/562
Properties of Covariance
Suppose X1 , X2 ,Y1 and Y2 are r.v., and a, b, c, d <, then:
Properties of Covariance
Let Xi , Yi be r.v., a, bi , c, dj < for i = 1, . . . , n and
j = 1, . . . , m.
We can generalize this as follows:
Suppose:
U =a+
n
X
bi Xi
and
i=1
V =c+
m
X
dj Yj .
j=1
Then:
Cov (U, V ) =
n X
m
X
i=1 j=1
528/562
bi dj Cov (Xi , Yj ) .
Properties of Covariance
Note that Cov (X , X ) = Var (X ), so we have the variance of
the sum of r.v. is:
Var (X1 + X2 ) =Cov (X1 + X2 , X1 + X2 )
=Cov (X1 , X1 ) + Cov (X2 , X2 ) + 2Cov (X1 , X2 )
=Var (X1 ) + Var (X2 ) +2Cov (X1 , X2 ).
Also,
Var (aX1 ) = Cov (aX1 , aX1 ) = a2 Cov (X1 , X1 ) = a2 Var (X1 ) ,
using the result that we can take a constants out of a
covariance.
529/562
Example Covariance
Consider the example from slides 506 and 522.
The costs for disability insurance are $1 million if mild and $2
million if severe.
The costs for unemployment insurance are $0.5 million if mild
and $1 million if severe.
The price of the contract is the expected value plus half the
standard deviation.
530/562
Solution (cont.)
Price DI (=1 million X1 ):
p
Var (X1 million)/2
q
=E [X1 ] million + Var (X1 ) million2 /2
p
=0.27million + 0.3771 million2 = 0.5770million.
=0.3310million.
531/562
Solution (cont.)
Price DI and UI combined (=1 million X1 + 0.5 million
X2 ):
Price UI and DI =E [X1 million + X2 0.5 million]
p
+ Var (X1 million + X2 0.5 million)/2
=E [X1 ] million + E [X2 ] 0.5 million
q
+ Var (X1 ) million2 + Var (X2 ) 0.25 million2
+2Cov (X1 , X2 )0.5 million2 /2
=0.27million + 0.165million
q
+ (0.3771 + 0.441/4 + 0.2709) million2 /2
=0.8704million.
532/562
Correlation coefficient
Large covariance: high dependency or large variance?
We define the correlation coefficient between X1 and X2 :
(X1 , X2 ) p
Cov (X1 , X2 )
Var (X1 ) Var (X2 )
provided Cov (X1 , X2 ) exists and the variances Var (X1 ) and
Var (X2 ) are each non-zero.
The value of the correlation coefficient is always between 1
and 1, i.e.
1 (X1 , X2 ) 1.
Note: correlation coefficient is only defined for 2 r.v..
533/562
Prove: Let Y =
X1
1
X2
2 ,
Var (Y ) 0 we have:
X1 X2
0 Var
1
2
X2
X1 X2
X1
+ Var
2Cov
,
=Var
1
2
1 2
1
1
1 1
= 2 Var (X1 ) + 2 Var (X2 ) 2
Cov (X1 , X2 )
1 2
1
2
|
{z
}
|
{z
} |
{z
}
=1
=1
=2 (1 ) .
Consequently, we see that 1 because the variance of a
random variable is non-negative.
Proof continues next slide.
534/562
Similarly by considering Y =
0 Var
X1
1
X1 X2
+
1
2
X2
2 ,
Var (Y ) 0 we have:
= 2 (1 + ) ,
535/562
1
0
1/3
Y =y
0
1
1/3
0
0
1/3
Correlation coefficient
6
5
4
3
quadratic dependence
linear dependence
1
0
1
2
1.5
537/562
0.5
=0
0.5
1
X
=0.9
=0.9
1.5
=0
2.5
Pr (X = xi , Y = yj )
.
Pr (Y = yj )
If Pr (Y = yj ) = 0, then we define Pr (X = xi |Y = yj ) = 0.
Example: Let X POI(3), Y POI(2), and X and Y are
independent.
We have:
Pr(X = 2|Y = 3)=
538/562
fX ,Y (x, y )
fX (x)
fX ,Y (x,0.5)
fY (0.5)
2x
1
= 2x.
Pr (X = k |N = n ) Pr (N = n)
n=0
X
n=k
X
n=k
n
n e
p k (1 p)nk
,
k
n!
n!
n e
p k (1 p)nk
(n k)! k!
n!
since n k.
X
n=k
n!
n e
p k (1 p)nk
(n k)! k!
n!
( p)k X nk (1 p)nk
e
k!
(n k)!
k
j=0
( (1 p))j
j!
( p)
( p)k p
e e (1p) =
e
,
k!
k!
which is the p.m.f. of a Poisson( p) P
random variable.
i
* using exponential function exp(x) =
i=0 x /i!, with
x = (1 p).
542/562
( p)
e
k!
n=k
X
X
Y
2
y Y
+
.
Y
543/562
544/562
Z Z
=
y fY |X (y |x ) dy fX (x) dx.
546/562
{z
}
|
=fY (y )
y fY (y ) dy
=E [Y ]
* using the law of total probability (why can we use it here?).
547/562
"
=E
N
X
#
E [Xi |N]
i=1
=E [N E [Xi |N]]
constant
2
551/562
Exercise
Let X Gamma(, ) and Y |X EXP(1/X ).
a. Question: Find E [Y ].
(Note: E [X ] = /, EXP()=Gamma(1,))
b. Question: Find Var (Y ). (Note: Var (X ) = / 2 )
a. Solution:
E [Y ] =E [E [Y |X ]]
=E [X ] = /.
b. Solution:
Var (Y ) =Var (E [Y |X ]) + E [Var (Y |X )]
=Var (X ) + E X 2
=/ 2 + Var (X ) + (E [X ])2
553/562
=/ 2 + / 2 + (/)2 = 2 + 2 / 2 .
...
FX ,X ,...,Xn (x1 , . . . , xn ) .
x1
xn 1 2
x1
555/562
j6=k
557/562
558/562
Median;
Range;
10% trimmed mean;
Inter quantile range.
559/562
Sorted observations:
1.56 1.88 2.53 3.39
3.62 3.68 5.24 5.25
5.31 5.56 5.66 6.17
Solutions:
a.
b.
c.
d.
E.c.d.f.
1
0.9
0.8
0.7
F (x)
0.6
0.5
0.4
0.3
0.2
0.1
0
0
560/562
10
15
20
25
pX1 (x1i ) =
j=1
Conditional probability:
Pr (X = xi |Y = yj ) =
561/562
Pr (X = xi , Y = yj )
.
Pr (Y = yj )
Cov (X1 , X2 )
Var (X1 ) Var (X2 )