Professional Documents
Culture Documents
Module IIIc - Annotated
Module IIIc - Annotated
Module IIIc - Annotated
Jiheng Zhang
III C :
J OINT D ISTRIBUTION AND C OVARIANCE
Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Joint Distribution
Sometimes, we need to deal with random variables having more than 1 dimension.
(X, Y)
The joint cumulative distribution function is
F(x, y) = P{X x, Y y}
The cdf of X:
^
FX (x) = P{X x}
marginal
= P{X x, Y < 1}
= F(x, 1)
The cdf of Y:
FY (y) = F(1, y)
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Note that
p(xi , yi ) = P{X = xi , Y = yj }
E-
I
[Y.CI Fj:)
=
Fjn Fj ,
=
¢
{X = xi } = {X = xi , Y = yj } U Fj =
S
' IF j I IF i
X
pX (xi ) = P{X = xi } = P{X = xi , Y = yj }
j
X
= p(xi , yj )
j
X
pY (yj ) = P{Y = yj } = p(xi , yj )
i
The pmf of X (or Y) are also call marginal pmf
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Example: Suppose that☐ 3 batteries are randomly chosen from a group of 3 new, 4
used but still working, and 5 defective batteries.
Joint PMF
98 – Discrete Random Variables Chapter 4: Random Variables and Expectation
0 10 40 30 4 84
220 220 220 220 220
1 30 60 18 0 108
220 220 220 220
2 15 12 0 0 27
220 220 220
3 1 0 0 0 1
220 220
Column
Sums =
P{Y = j } 56 112 48 4
220 220 220 220
When both X and Y are continuous, define the joint probability density function to
be a function f (x, y) such that
0
Z x Z y
P{X x, Y y} = f (x, y)dxdy
1 1
.
Fixed
÷t:¥F
"
fix / =
3×2 fix)=6✗
Upon differentiation, we have
.
@2 FIX,y ) =3
xy -155
☐
f (a, b) = F(a, b)
←f
@a@b
@
@a F(a, b) denotes the partial differentiation :#2+07=3 .si
¥¥f*H=Éx -110yd ?
Consider (a, a + da] ⇥ (b, b + db],
Z b+db Z a+da
P{a < X a + da, b < Y b + db} = f (x, y)dxdy
b a
⇡ f (a, b)dadb
I☒☐☐
Z Z 1
= f (x, y)dydx
A 1
R1
Let fX (x) =
-
☐
f (x, y)dy, then
1
Z
P{X 2 A} = fX (x)dx
A
So
R1
fX (x) = f (x, y)dy is the probability density function of X
R 11
fY (y) = 1 f (x, y)dx is the probability density function of Y
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Example
Example: The joint density function of X and Y is given by
(
2e x e 2y 0 < x < 1, 0 < y < 1
f (x, y) =
0 otherwise
Compute: (a) P{X < a}; (b) P{X > 1, Y < 1}; (c) P{X < Y}.
Example
Example: The joint density function of X and Y is given by
(
2e x e 2y 0 < x < 1, 0 < y < 1
f (x, y) =
0 otherwise
Compute: (a) P{X < a}; (b) P{X > 1, Y < 1}; (c) P{X < Y}.
Z aZ 1 ← f¥✗)
P{X < a} = 2y x
2e e dydx
②
15=1
0 0
Z a Z 1 "
= e x
2e 2y dydx
D- e-
-
0 0
Z a
= .
= e x dx
☐ 0
a
=1 e
Example
Z 1Z 1
P{X> 1, Y< 1} = 2e x e 2y dxdy
0 1
Z 1 Z 1
= 2e 2y e x dxdy
0 1
Z 1
1
= 2e 2y [ e x 1 ]dy ☐
0
Z 1
1
=e 2e 2y dy
0
1 2
=e (1 e )
Example D il
as
" e- " e-
Ya < Y ZZ
a.
" 2e x e 2y
^
-
'
.
P{X < Y} =
.
-
i
☐yy=
=
Z
Z0 1 0
(x,y):x<y
1Z y
2e x e 2y dxdy
2e 2y [
Z y
e x dx]dy
=D e-3
dxdy
÷
.
=
0
Z 1 0 ☐
=
Z0 1
e-
2e 2y (1 e y )dy
Z 1
= 2e 2y dy 2e 3y dy
0 0
. 2 1
=1 =
3 3
III c: Joint Distribution and Covariance Jiheng Zhang
s :S :
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Independence
Consider two events {X 2 A} and {Y 2 B}, the following is NOT always true:
Independence
Consider two events {X 2 A} and {Y 2 B}, the following is NOT always true:
In discrete case
p(x, y) = pX (x)pY (y)
In continuous case
f (x, y) = fX (x)fY (y)
Suppose (X, Y) are uniformly distributed on a square, then = ply > as) .
(
1
1 x 1, 1 y 1
±g÷÷µ÷,
f (x, y) = 4
0 otherwise
y f±ix =/ >
-
-
fans ) dy =
¥ dy =
-12
i
- -
-
of
-
-
- -
€10.2 fy- LY ) = - - - - i - -
- - -
-
-
=L
0.6
x
f*Wfy-
"
f- ix. g)
"
all
- l I =
¥ =
Ext = is )
,
for
0 .
-1 < ✗ C /
,
p ,, , , , , , , , ,
P (F)
HE
III c: Joint Distribution and Covariance
TE a
=
÷
Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
y
-10.62=12--79--0.
'
5T¥ 8 f (x, y) =
0 otherwise
yyñ=i zf-xifx-II-I-fx.us
y)dy=S+F" ¥ dy -
E.
=
I
✗ = -11
to .
%
CJ .
-5*(0-6)=1?j%=¥ .
✗ =ab
t.ge
.
0.6 ,
x
% fix .gs#f-*-cx)-fy-cy) .
0.8
-
- - -
fq.co
III c: Joint Distribution and Covariance
.
-_
PCY > as ) -40
Jiheng Zhang
,
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
conditioning 5=0
.
g 1
X
P(X = i, Y = j) = P(X = i, Y = j|N = n)P(N = n) a- 3,5=5 ,
n=lo .
n=1 0
if itj=n
= P(X = i, Y = j|N = i + j)P(N = i + j) = P(X = i|N = i + j)P(N = i + j)
✓ ◆ - I
②②
i+j i 1 P(Binomial city;p)=z ,
= p (1 p)j e i+j
pmf
i (i + j)!
.
pref
(i + j)! i j 1
- pi qj
= pq e pe q i j = e p i e q j
i!j! -(i + j)! -
i! j! -
-
>
III c: Joint Distribution and Covariance
Poisson lip) .
Poisson CXG
Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Independence
Example: Suppose X and Y are independent and have common density function
f (a) = e a , a > 0. Find the density of X/Y. 1¥ - Y ] =
.
¥
x/ya
Z 1 Z ay
= e x e y dxdy
0 0
Z 1
= (1 e ay )e y dy
0
h e (a+1)y i 1 1
y
= e + =1
→'#
The density function is f X/Y (a)
0
= FX/Y (a) =
a+1
1
(1+a)2
0
, a > 0.
a+1
F(a1 , a2 , . . . , an ) = P{X1 a1 , X2 a2 , . . . , Xn an }
p(x1 , x2 , . . . , xn ) = P{X1 = x1 , X2 = x2 , . . . , Xn = xn }
LOTUS – 2D
If (X, Y) is discrete X
E[g(X, Y)] = g(xi , yj )p(xi , yj )
i,j
If X is continuous
Z 1 Z 1
E[g(X, Y)] = g(x, y)f (x, y)dxdy
1 1
Ei×-Y]=E _ t"¥'=±
Example: Suppose X and Y are independent Uniform⇠ [0, 1] random variables.
,
Z 1Z Z 1Z 1
.
1
I
Q
E[|X Y|] = |x y|f (x, y)dxdy = |xy|dxdy
0 0 0 0
ZZ .
Z 1Z 1 Z 1
1 1
(x2 /2
=2 (x y)dxdy = 2 (x
☐ y)dxdy = 2 yx) dy =
3
¥171
0 y 0 .
y
x>y -
3
Solution:
Z 1Z 1 Z 1Z 1
E[|X Y|] = |x y|f (x, y)dxdy = |x y|dxdy 1×-41--2=5-3
0 0 0 0
ZZ Z 1Z 1 Z 1
1 1
=2 (x y)dxdy = 2 (x y)dxdy = 2 (x2 /2 yx) dy =
0 y 0 y 3
x>y
Let M = max(X, Y) and L = min(X, Y). Can you find E[M] and E[L]?
Solution: |X Y| = M L, E[|X Y|] = 00
E[M] E[L] = 1/3.
On the other hand, 0 E[M] +☐ E[L] = 1. So E[M] = 2/3 and E[L] = 1/3.
III c: Joint Distribution and Covariance E- ET Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Conditional Distributions
0 Y = yj is
pX|Y (xi |yj ) =
p(xi , yj )
pY (yj )
.
for all xi
• Formula for0
Conditional Expectation
If (X, Y) is discrete, then the expectation of X given that Y = yj is
X
. = yj ] =
E[X|Y xi pX|Y (xi |yj )
xi
E[X|Y = 1] = 2
E[X|Y = 2] = 3 n
E[X|Y = 3] = 5 + E[X]
-
So
1 1 1
E[X] = E[X|Y = 1] + E[X|Y = 2] + E[X|Y = 3]
3 3 3
Thus, E[X] = 5. =
2×1-3 +
30¥ +
(5+-6*7) §
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
A
1 y 1
1
→
E[Z|Y = y] = |x y|fx (x)dx
☐= (y x)dx + (x y)dx = y2 y+
0 0 y 2
2
.
. .
-
0 0
-
Review of Variance
For any random variable X, the variance Var(X) is defined by
foulX ,
X) =
Varix) = E [(X -
ETD ) ( X -
Et XD ]
Alternatively,
Var(X) = E[X 2 ] (E[X])2
Var(aX + b) = a2 Var(X)
Covariance
Covariance
D EFINITION (C OVARIANCE )
The covariance of X and Y is defined by
Covariance
Cov(X, Y) = E[XY µx Y µy X + µx µy ]
= E[XY] µx E[Y] µy E[X] + µx µy
linearity →
= E[XY] µx µy µy µx + µx µy
= E[XY] µx µy
= E[XY] E[X]E[Y]
Covariance
z-¥
Cov(X, Y) = E[XY µx Y µy X + µx µy ]
= E[XY] µx E[Y] µy E[X] + µx µy
✗+
= E[XY] µx µy µy µx + µx µy
= E[XY] µx µy
¥
= E[XY] E[X]E[Y]
Properties: ✗+ 2-
→
¥Ix
• Cov(X, Y) = Cov(Y, X)
• Cov(X, X) = Var(X)
linear
-41
↳ • Cov(aX, Y) = aCov(X, Y)
• Cov(X + Z, Y) = Cov(X, Y) + Cov(Z, Y)
n
X n
X
• Cov( Xi , Y) = Cov(Xi , Y)
III c: Joint Distribution and Covariance i=1 i=1 Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Covariance
G ENERAL C OVARIANCE F ORMULA
0 1
Xn m
X n X
X m
Cov @ Xi , A
Yj = Cov(Xi , Yj )
i=1 j=1 i=1 j=1
4) I 1 2 34 5
4
÷÷¥¥#¥
5
.
¥¥ tij ,
Covariance
G ENERAL C OVARIANCE F ORMULA
0 1
Xn m
X n X
X m
Cov @ Xi , A
Yj = Cov(Xi , Yj )
i=1 j=1 i=1 j=1
0 1 0 1
Xn m
X n
X m
X
Cov @ Xi , Yj A = Cov @Xi , Yj A
i=1 j=1 i=1 j=1
0 1
n
X m
X
= Cov @ Yj , Xi A
i=1 j=1
n X
X m
= Cov(Xi , Yj )
i=1 j=1
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Covariance
Covariance
VARIANCE OF S UM
n
! n n X
n
X X X
Var Xi = Var(Xi ) + Cov (Xi , Xj )
i=1 i=1 i=1 j=1
j6=i
÷
" "
.
! 0 1
n
X n
X n
X
Var Xi = Cov @ Xi , Xj A
i=1 i=1 j=1
'0 1
Cov(X1 , X1 ), Cov(X2 , X1 ), · · · Cov(Xn , X1 )
B C
BCov(X1 , X2 ), Cov(X2 , X2 ), · · · Cov(Xn , X2 )C
B .. .. .. C
B .. C
@ . . . . A
Cov(X1 , Xn ), Cov(X2 , Xn ), · · · Cov(Xn , Xn )
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
N M
i n i
P{X = i} = N+M
n
pc ,
=
N+MN+M 1 ☐
6= P{Xi = 1}P{Xj = 1}
NM
Cov(Xi , Xj ) =
(N + M)2 (N +M 1)
✓ ◆
nNM n 1
Var(X) = 1
(N + M)2 N+M 1
III c: Joint Distribution and Covariance Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Let-Y-xi.is/CEF7--PCElF)-pCF
Since we have computed
g
1 it Xi=×j=1
} ) P{X = 1|X = 1} =
j i
N 1
N+M 1
y= 0 OW
PlY=D=PlXIXj=I
Cov(Xi , Xj ) = E[Xi Xj ] E[Xi ]E[Xj ] F F-
@☐
-
N(N 1) N N
-
= ,, , .my,
(M + N)(M + N 1) M+NM+N
NM
= 2
(N + M) (N + M 1) =P(Xj=1IXi=D.p=i
for ¥÷
.
i=j
.
any
III c: Joint Distribution and Covariance Jiheng Zhang
?⃝
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Covariance
Council Covlx 4)
( Cook
,
,
,
✗1
,
loud
Covariance
E[XY] = E[X]E[Y]
Covariance
Covariance
Example: Compute the variance of the number of heads resulting from 10 #a
independent tosses of a fair coin. Module
Method 1: Compute the distribution of X and use definition.
9
}
P
Method 2: Let X = 10 j=1 Ij , where
( d
"" ""
"
1 if the jth toss lands head
'
Ij =
0 if the jth toss lands tail
P10
We just need to find Var( j=1 Ij ).
1 1 1
Var(Ij ) = E[Ij2 ] (E[Ij ])2 = =
2 4 4
Thus
10
X 10
X 10
Var( Ij ) = Var(Ij ) =
4
III c: Joint Distribution and Covariance j=1 j=1 Jiheng Zhang
Joint Distribution Independence LOTUS – 2D Conditional Distributions Variance & Covariance
Covariance
f- ÷É④
Example: Compute the variance of the sum of 10 independent rolls of a fair die.
Let Xi be the outcome of the ith roll, we have that
10
! 10
X X
Var Xi = Var(Xi )
i=1 i=1
35 35 35
= + + ··· +
12 12 12
35 175
= 10 ⇥ =
12 6
Correlation
Cov(X, Y) = 0
If Y = X, then
Cov(X, Y) = Cov(X, X) = Var(X) > 0
If Y = X, then
Correlation
-
Cov(X, Y)
Corr(X, Y) = p
Var(X)Var(Y)
Come ax.BY ) =
Corr IX X) ¥1 =*÷E;¥¥
¥va*T-=I
,
=
Correlation
Cov(X, Y)
Corr(X, Y) = p
Var(X)Var(Y)