Download as pdf or txt
Download as pdf or txt
You are on page 1of 87

Chapter 3.

Vectors of Random Variables

Nguyễn Văn Hạnh


Department of Applied Mathematics
School of Applied Mathematics and Informatics

First semester, 2023-2024

NV HANH Probability and statistics First semester, 2023-2024 1 / 39


Contents

1 Joint probability distrubutions

2 Marginal probability distribution

3 Conditional probability distribution

4 Independence

5 Examples

6 Covariance matrix and correlation

7 Examples

NV HANH Probability and statistics First semester, 2023-2024 2 / 39


Joint probability distrubutions

Introduction

In practice, it is often necessary to consider some different variables at


the same time that are related and lead to the concept of a vector of
random variables.

NV HANH Probability and statistics First semester, 2023-2024 3 / 39


Joint probability distrubutions

Introduction

In practice, it is often necessary to consider some different variables at


the same time that are related and lead to the concept of a vector of
random variables.
Studying each variable separately may give incomplete information.

NV HANH Probability and statistics First semester, 2023-2024 3 / 39


Joint probability distrubutions

Introduction

In practice, it is often necessary to consider some different variables at


the same time that are related and lead to the concept of a vector of
random variables.
Studying each variable separately may give incomplete information.
For example: when we observed the characteristics of a machine, we
are interested in some different variables at the same time, such as
the weight, size, quality, material, . . .

NV HANH Probability and statistics First semester, 2023-2024 3 / 39


Joint probability distrubutions

Introduction

For simplicity, we study two-dimensional random variables (X , Y ),


where X and Y are one-dimensional variables.

NV HANH Probability and statistics First semester, 2023-2024 4 / 39


Joint probability distrubutions

Introduction

For simplicity, we study two-dimensional random variables (X , Y ),


where X and Y are one-dimensional variables.
Most results can be extended easily to n-dimensional variables.

NV HANH Probability and statistics First semester, 2023-2024 4 / 39


Joint probability distrubutions

Introduction

For simplicity, we study two-dimensional random variables (X , Y ),


where X and Y are one-dimensional variables.
Most results can be extended easily to n-dimensional variables.
This chapter analyzes experiments that produce two random
variables, X and Y.

NV HANH Probability and statistics First semester, 2023-2024 4 / 39


Joint probability distrubutions

Introduction

For simplicity, we study two-dimensional random variables (X , Y ),


where X and Y are one-dimensional variables.
Most results can be extended easily to n-dimensional variables.
This chapter analyzes experiments that produce two random
variables, X and Y.
If X and Y are discrete, we have a discrete two-dimensional random
variable; if they are continuous, we have a continuous
two-dimensional variable.

NV HANH Probability and statistics First semester, 2023-2024 4 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.1:
Let X and Y be two discrete random variables, where the range of X is
SX = {x1 , x2 , .., xn } and the range of Y is SY = {y1 , y2 , .., ym }.

NV HANH Probability and statistics First semester, 2023-2024 5 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.1:
Let X and Y be two discrete random variables, where the range of X is
SX = {x1 , x2 , .., xn } and the range of Y is SY = {y1 , y2 , .., ym }.
The range of two-dimensional random variable (X , Y ) is
SX ,Y = {(xi , yj ) : i = 1, ..., n; j = 1, ..., m}.

NV HANH Probability and statistics First semester, 2023-2024 5 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.1:
Let X and Y be two discrete random variables, where the range of X is
SX = {x1 , x2 , .., xn } and the range of Y is SY = {y1 , y2 , .., ym }.
The range of two-dimensional random variable (X , Y ) is
SX ,Y = {(xi , yj ) : i = 1, ..., n; j = 1, ..., m}.
The joint probability distrubution of (X , Y ) is defined by the joint
probability mass function (pmf):
(
pij if x = xi , y = yj ,
f (x, y ) = P(X = x, Y = y ) =
0 otherwise
Pn Pm
such that pij ≥ 0∀i, j and i=1 j=1 pij = 1.

NV HANH Probability and statistics First semester, 2023-2024 5 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.1:
The joint probability distrubution of two-dimensional discrete random
variable (X , Y ) is also given by the following table:
y1 y2 ... yj ... ym
x1 p11 p12 ... p1j ... p1m
x2 p21 p22 ... p2j ... p2m
. . . ... . ... .
. . . ... . ... .
. . . ... . ... .
xi pi1 pi2 ... pij ... pim
. . . ... . ... .
. . . ... . ... .
. . . ... . ... .
xn pn1 pn2 ... pnj ... pnm

NV HANH Probability and statistics First semester, 2023-2024 6 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.2:
Let X and Y be two continuous random variables. The joint probability
distrubution of (X , Y ) is defined by the joint probability density function
(pdf) f (x, y ) that satisfies the following requirements:

NV HANH Probability and statistics First semester, 2023-2024 7 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.2:
Let X and Y be two continuous random variables. The joint probability
distrubution of (X , Y ) is defined by the joint probability density function
(pdf) f (x, y ) that satisfies the following requirements:
For all (x, y ) ∈ R 2 : f (x, y ) ≥ 0.

NV HANH Probability and statistics First semester, 2023-2024 7 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.2:
Let X and Y be two continuous random variables. The joint probability
distrubution of (X , Y ) is defined by the joint probability density function
(pdf) f (x, y ) that satisfies the following requirements:
For all (x, y ) ∈ R 2 : f (x, y ) ≥ 0.
R +∞ R +∞
−∞ −∞ f (x, y )dxdy = 1.

NV HANH Probability and statistics First semester, 2023-2024 7 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.2:
Let X and Y be two continuous random variables. The joint probability
distrubution of (X , Y ) is defined by the joint probability density function
(pdf) f (x, y ) that satisfies the following requirements:
For all (x, y ) ∈ R 2 : f (x, y ) ≥ 0.
R +∞ R +∞
−∞ −∞ f (x, y )dxdy = 1.
For D ⊂ R 2 : P[(X , Y ) ∈ D] =
RR
D f (x, y )dxdy .

NV HANH Probability and statistics First semester, 2023-2024 7 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.3:
Let (X , Y ) be a two-dimensional random variable. The joint cumulative
distribution function (cdf) of (X , Y ) is defined by:

F (x, y ) = P(X < x, Y < y ), ∀(x, y ) ∈ R 2 .

NV HANH Probability and statistics First semester, 2023-2024 8 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.3:
Let (X , Y ) be a two-dimensional random variable. The joint cumulative
distribution function (cdf) of (X , Y ) is defined by:

F (x, y ) = P(X < x, Y < y ), ∀(x, y ) ∈ R 2 .

P P
If (X , Y ) is discrete then F (x, y ) = xi <x yj <y P(X = xi , Y = yj ).

NV HANH Probability and statistics First semester, 2023-2024 8 / 39


Joint probability distrubutions

Joint probability distrubutions

Definitions 4.3:
Let (X , Y ) be a two-dimensional random variable. The joint cumulative
distribution function (cdf) of (X , Y ) is defined by:

F (x, y ) = P(X < x, Y < y ), ∀(x, y ) ∈ R 2 .

P P
If (X , Y ) is discrete then F (x, y ) = xi <x yj <y P(X = xi , Y = yj ).
Rx Ry
If (X , Y ) is continuous then F (x, y ) = −∞ −∞ f (u, v )dudv .

NV HANH Probability and statistics First semester, 2023-2024 8 / 39


Marginal probability distribution

Marginal probability distribution


Definitions 4.4:
Let (X , Y ) be a two-dimensional discrete random variable with the joint
pmf (
pij if (x, y ) = (xi , yj ),
f (x, y ) = P(X = x, Y = y ) =
0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 9 / 39


Marginal probability distribution

Marginal probability distribution


Definitions 4.4:
Let (X , Y ) be a two-dimensional discrete random variable with the joint
pmf (
pij if (x, y ) = (xi , yj ),
f (x, y ) = P(X = x, Y = y ) =
0 otherwise

The marginal probability distribution of X is the defined by:


X x1 x2 ... xi ... xn
P p1· p2· ... pi· ... pn·
Pm
where pi· = j=1 pij , i = 1, .., n.

NV HANH Probability and statistics First semester, 2023-2024 9 / 39


Marginal probability distribution

Marginal probability distribution


Definitions 4.4:
Let (X , Y ) be a two-dimensional discrete random variable with the joint
pmf (
pij if (x, y ) = (xi , yj ),
f (x, y ) = P(X = x, Y = y ) =
0 otherwise

The marginal probability distribution of X is the defined by:


X x1 x2 ... xi ... xn
P p1· p2· ... pi· ... pn·
Pm
where pi· = j=1 pij , i = 1, .., n.
The marginal probability distribution of Y is the defined by:
Y y1 y2 ... yj ... ym
P p·1 p·2 ... p·j ... p·m
Pn
where p·j = i=1 pij , j = 1, .., m.
NV HANH Probability and statistics First semester, 2023-2024 9 / 39
Marginal probability distribution

Marginal probability distrubutions

Definitions 4.4:
The marginal probability distrubution of X and of Y :
y1 y2 ... yj ... ym P(xi )
x1 p11 p12 ... p1j ... p1m p1·
x2 p21 p22 ... p2j ... p2m p2·
. . . ... . ... . .
. . . ... . ... . .
. . . ... . ... . .
xi pi1 pi2 ... pij ... pim pi·
. . . ... . ... . .
. . . ... . ... . .
. . . ... . ... . .
xn pn1 pn2 ... pnj ... pnm pn·
P(yj ) p·1 p·2 ... p·j ... p·m 1

NV HANH Probability and statistics First semester, 2023-2024 10 / 39


Marginal probability distribution

Marginal probability distribution

Definitions 4.5:
Let (X , Y ) be a two-dimensional continuous random variable with the
joint pdf f (x, y ).
The marginal probability distribution of X is the defined by the
marginal pdf: Z +∞
fX (x) = f (x, y )dy .
−∞

NV HANH Probability and statistics First semester, 2023-2024 11 / 39


Marginal probability distribution

Marginal probability distribution

Definitions 4.5:
Let (X , Y ) be a two-dimensional continuous random variable with the
joint pdf f (x, y ).
The marginal probability distribution of X is the defined by the
marginal pdf: Z +∞
fX (x) = f (x, y )dy .
−∞

The marginal probability distribution of Y is the defined by the


marginal pdf: Z +∞
fY (y ) = f (x, y )dx.
−∞

NV HANH Probability and statistics First semester, 2023-2024 11 / 39


Conditional probability distribution

Conditional probability distribution


Definitions 4.6:
Let (X , Y ) be a two-dimensional discrete random variable with the joint
pmf (
pij if (x, y ) = (xi , yj ),
f (x, y ) = P(X = x, Y = y ) =
0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 12 / 39


Conditional probability distribution

Conditional probability distribution


Definitions 4.6:
Let (X , Y ) be a two-dimensional discrete random variable with the joint
pmf (
pij if (x, y ) = (xi , yj ),
f (x, y ) = P(X = x, Y = y ) =
0 otherwise

The conditional probability distribution of X given that Y = yj is


defined by:
X |Y = yj x1 x2 ... xi ... xn
P p1j /p·j p2j /p·j ... pij /p·j ... pnj /p·j
since
P(X = xi , Y = yj ) pij
P(X = xi |Y = yj ) = = , i = 1, .., n
P(Y = yj ) p·j
.
NV HANH Probability and statistics First semester, 2023-2024 12 / 39
Conditional probability distribution

Conditional probability distribution


Definitions 4.7:
Let (X , Y ) be a two-dimensional discrete random variable with the joint
pmf (
pij if (x, y ) = (xi , yj ),
f (x, y ) = P(X = x, Y = y ) =
0 otherwise

The conditional probability distribution of Y given that X = xi is


defined by:
Y |X = xi y1 y2 ... yj ... ym
P pi1 /pi· pi2 /pi· ... pij /pi· ... pim /pi·
since
P(X = xi , Y = yj ) pij
P(Y = yj |X = xi ) = = , j = 1, .., m
P(X = xi ) pi·
.
NV HANH Probability and statistics First semester, 2023-2024 13 / 39
Conditional probability distribution

Conditional probability distribution

Definitions 4.7:
Let (X , Y ) be a two-dimensional continuous random variable with the
joint pdf f (x, y ).
The conditional probability distribution of X givent that Y = y is
defined by conditional pdf:

f (x, y )
fX |Y =y (x) = .
fY (y )

NV HANH Probability and statistics First semester, 2023-2024 14 / 39


Conditional probability distribution

Conditional probability distribution

Definitions 4.7:
Let (X , Y ) be a two-dimensional continuous random variable with the
joint pdf f (x, y ).
The conditional probability distribution of X givent that Y = y is
defined by conditional pdf:

f (x, y )
fX |Y =y (x) = .
fY (y )

The conditional probability distribution of Y givent that X = x is


defined by conditional pdf:

f (x, y )
fY |X =x (y ) = .
fX (x)

NV HANH Probability and statistics First semester, 2023-2024 14 / 39


Independence

Independence

Definitions 4.8:
Let (X , Y ) be a two-dimensional discrete random variable with the
joint pmf f (x, y ). X and Y are called independent if and only if:

P(X = xi , Y = yj ) = P(X = xi )P(Y = yj )

for all i = 1, .., n; j = 1, ..., m.

NV HANH Probability and statistics First semester, 2023-2024 15 / 39


Independence

Independence

Definitions 4.8:
Let (X , Y ) be a two-dimensional discrete random variable with the
joint pmf f (x, y ). X and Y are called independent if and only if:

P(X = xi , Y = yj ) = P(X = xi )P(Y = yj )

for all i = 1, .., n; j = 1, ..., m.


Let (X , Y ) be a two-dimensional continuous random variable with the
joint pdf f (x, y ). X and Y are called independent if and only if:

f (x, y ) = fX (x)fY (y )

for all (x, y ) ∈ R 2 .

NV HANH Probability and statistics First semester, 2023-2024 15 / 39


Examples

Examples

Example 4.1:
Let X be the number of accidents per day and Y be the number of injured
or dead people per day at a small town. We observed X and Y during a
period of 100 days and obtained the following data:
X \Y 0 1 2 3
0 8 0 0 0
1 22 9 1 0
2 20 10 3 1
3 8 5 2 1
4 4 3 2 1

NV HANH Probability and statistics First semester, 2023-2024 16 / 39


Examples

Examples

Example 4.1:
Let X be the number of accidents per day and Y be the number of injured
or dead people per day at a small town.
Find the joint probability distribution of (X , Y ).
Find the marginal probability distribution of X and of Y .
Find the conditional probability distribution of X given that Y = 2.
Find the conditional probability distribution of Y given that X = 2.
Are X and Y independent?

NV HANH Probability and statistics First semester, 2023-2024 17 / 39


Examples

Examples

Solution of Example 4.1:


The joint probability distribution of (X , Y ) is the following table:
X \Y 0 1 2 3
0 0.08 0 0 0
1 0.22 0.09 0.01 0
2 0.2 0.1 0.03 0.01
3 0.08 0.05 0.02 0.01
4 0.04 0.03 0.02 0.01

NV HANH Probability and statistics First semester, 2023-2024 18 / 39


Examples

Examples

Solution of Example 4.1:


To find the marginal probability distributions of X and of Y , we add the
probabilities by rows and by columns:
X \Y 0 1 2 3 P(xi )
0 0.08 0 0 0 0.08
1 0.22 0.09 0.01 0 0.32
2 0.2 0.1 0.03 0.01 0.34
3 0.08 0.05 0.02 0.01 0.16
4 0.04 0.03 0.02 0.01 0.1
P(yj ) 0.62 0.27 0.08 0.03 1

NV HANH Probability and statistics First semester, 2023-2024 19 / 39


Examples

Examples

Solution of Example 4.1:


The marginal probability distribution of X is the following table:
X 0 1 2 3 4
P 0.08 0.32 0.34 0.16 0.1

NV HANH Probability and statistics First semester, 2023-2024 20 / 39


Examples

Examples

Solution of Example 4.1:


The marginal probability distribution of X is the following table:
X 0 1 2 3 4
P 0.08 0.32 0.34 0.16 0.1
The marginal probability distribution of Y is the following table:
X 0 1 2 3
P 0.62 0.27 0.08 0.03

NV HANH Probability and statistics First semester, 2023-2024 20 / 39


Examples

Examples

Solution of Example 4.1:


The conditional probability distribution of X given that Y = 2 is the
following table:
X |Y = 2 0 1 2 3 4
P 0 1/8 3/8 2/8 2/8

NV HANH Probability and statistics First semester, 2023-2024 21 / 39


Examples

Examples

Solution of Example 4.1:


The conditional probability distribution of X given that Y = 2 is the
following table:
X |Y = 2 0 1 2 3 4
P 0 1/8 3/8 2/8 2/8
The conditional probability distribution of Y given that X = 2 is the
following table:
Y |X = 2 0 1 2 3
P 20/34 10/34 3/34 1/34

NV HANH Probability and statistics First semester, 2023-2024 21 / 39


Examples

Examples

Solution of Example 4.1:


The conditional probability distribution of X given that Y = 2 is the
following table:
X |Y = 2 0 1 2 3 4
P 0 1/8 3/8 2/8 2/8
The conditional probability distribution of Y given that X = 2 is the
following table:
Y |X = 2 0 1 2 3
P 20/34 10/34 3/34 1/34
Since 0.08 = P(X = 0, Y = 0) 6= P(X = 0)P(Y = 0) =
0.08 ∗ 0.62 = 0.0496 then X and Y are not independent.

NV HANH Probability and statistics First semester, 2023-2024 21 / 39


Examples

Examples

Example 4.2:
Suppose that the two-dimensional continuous random variable (X , Y ) has
the following joint pdf:
(
Cxy if 0 ≤ x ≤ 4; 1 ≤ y ≤ 5,
f (x, y ) =
0 otherwise

Find the normalizing constant C .


Find the marginal probability distribution of X and of Y .
Find the conditional probability distribution of X given that Y = 2.
Find the conditional probability distribution of Y given that X = 2.
Are X and Y independent?

NV HANH Probability and statistics First semester, 2023-2024 22 / 39


Examples

Examples

Solution of Example 4.2:


Find the normalizing constant C .
Since f (x, y ) is a joint pdf then f (x, y ) ≥ 0, ∀(x, y ) ∈ R 2 ⇔ C ≥ 0.

NV HANH Probability and statistics First semester, 2023-2024 23 / 39


Examples

Examples

Solution of Example 4.2:


Find the normalizing constant C .
Since f (x, y ) is a joint pdf then f (x, y ) ≥ 0, ∀(x, y ) ∈ R 2 ⇔ C ≥ 0.
RR R4R5 R4 R5 
And R 2 f (x, y )dxdy = 0 1 Cxydxdy = C 0 x 1 ydy dx =
96C = 1, so C = 1/96.

NV HANH Probability and statistics First semester, 2023-2024 23 / 39


Examples

Examples

Solution of Example 4.2:


Find the normalizing constant C .
Since f (x, y ) is a joint pdf then f (x, y ) ≥ 0, ∀(x, y ) ∈ R 2 ⇔ C ≥ 0.
RR R4R5 R4 R5 
And R 2 f (x, y )dxdy = 0 1 Cxydxdy = C 0 x 1 ydy dx =
96C = 1, so C = 1/96.
Then (
1
if 0 ≤ x ≤ 4; 1 ≤ y ≤ 5,
96 xy
f (x, y ) =
0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 23 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of X .
R +∞
The marginal pdf of X is fX (x) = −∞ f (x, y )dy .

NV HANH Probability and statistics First semester, 2023-2024 24 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of X .
R +∞
The marginal pdf of X is fX (x) = −∞ f (x, y )dy .
R +∞
If x ∈
/ [0, 4] then fX (x) = −∞ 0dy = 0.

NV HANH Probability and statistics First semester, 2023-2024 24 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of X .
R +∞
The marginal pdf of X is fX (x) = −∞ f (x, y )dy .
R +∞
If x ∈
/ [0, 4] then fX (x) = −∞ 0dy = 0.
R1 R5 1 R +∞
If x ∈ [0, 4] then fX (x) = −∞ 0dy + 1 96 xydy + 5 0dy = 18 x.

NV HANH Probability and statistics First semester, 2023-2024 24 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of X .
R +∞
The marginal pdf of X is fX (x) = −∞ f (x, y )dy .
R +∞
If x ∈
/ [0, 4] then fX (x) = −∞ 0dy = 0.
R1 R5 1 R +∞
If x ∈ [0, 4] then fX (x) = −∞ 0dy + 1 96 xydy + 5 0dy = 18 x.
Then (
1
8xif 0 ≤ x ≤ 4,
fX (x) =
0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 24 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of Y .
R +∞
The marginal pdf of Y is fY (y ) = −∞ f (x, y )dx.

NV HANH Probability and statistics First semester, 2023-2024 25 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of Y .
R +∞
The marginal pdf of Y is fY (y ) = −∞ f (x, y )dx.
R +∞
If y ∈
/ [1, 5] then fY (y ) = −∞ 0dx = 0.

NV HANH Probability and statistics First semester, 2023-2024 25 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of Y .
R +∞
The marginal pdf of Y is fY (y ) = −∞ f (x, y )dx.
R +∞
If y ∈
/ [1, 5] then fY (y ) = −∞ 0dx = 0.
R0 R4 1 R +∞ 1
If y ∈ [1, 5] then fY (y ) = −∞ 0dx + 0 96 xydx + 4 0dx = 12 y .

NV HANH Probability and statistics First semester, 2023-2024 25 / 39


Examples

Examples

Solution of Example 4.2:


Find the marginal probability distribution of Y .
R +∞
The marginal pdf of Y is fY (y ) = −∞ f (x, y )dx.
R +∞
If y ∈
/ [1, 5] then fY (y ) = −∞ 0dx = 0.
R0 R4 1 R +∞ 1
If y ∈ [1, 5] then fY (y ) = −∞ 0dx + 0 96 xydx + 4 0dx = 12 y .
Then (
1
if 1 ≤ y ≤ 5,
12 y
fY (y ) =
0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 25 / 39


Examples

Examples

Solution of Example 4.2:


Find the conditional probability distribution of X given that Y = 2.
The conditional pdf of X given that Y = 2 is
( (1/96)x.2
f (x, 2) 2/12 = 81 x if 0 ≤ x ≤ 4,
fX |Y =2 (x) = = 0
fY (2) 2/12 = 0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 26 / 39


Examples

Examples

Solution of Example 4.2:


Find the conditional probability distribution of Y given that X = 2.
The conditional pdf of Y given that X = 2 is
( (1/96)2y
1
f (2, y ) 2/8 = 12 y if 1 ≤ y ≤ 5,
fY |X =2 (y ) = = 0
fX (2) 2/8 = 0 otherwise

NV HANH Probability and statistics First semester, 2023-2024 27 / 39


Examples

Examples

Solution of Example 4.2:


Find the conditional probability distribution of Y given that X = 2.
The conditional pdf of Y given that X = 2 is
( (1/96)2y
1
f (2, y ) 2/8 = 12 y if 1 ≤ y ≤ 5,
fY |X =2 (y ) = = 0
fX (2) 2/8 = 0 otherwise

Are X and Y independent?


Since f (x, y ) = fX (x)fY (y ), ∀(x, y ) ∈ R 2 then X and Y are
independent.

NV HANH Probability and statistics First semester, 2023-2024 27 / 39


Covariance matrix and correlation

Functions of random vectors

Let (X , Y ) be a two-dimensional random variable and g : R 2 → R be a


function. The random variable Z is defined by Z = g (X , Y ). Then
E (Z ) = E [g (X , Y )] = ni=1 m
P P
j=1 g (xi , yj )pij if (X , Y ) is discrete.

NV HANH Probability and statistics First semester, 2023-2024 28 / 39


Covariance matrix and correlation

Functions of random vectors

Let (X , Y ) be a two-dimensional random variable and g : R 2 → R be a


function. The random variable Z is defined by Z = g (X , Y ). Then
E (Z ) = E [g (X , Y )] = ni=1 m
P P
j=1 g (xi , yj )pij if (X , Y ) is discrete.
R +∞ R +∞
and E (Z ) = E [g (X , Y )] = −∞ −∞ g (x, y )f (x, y )dxdy if (X , Y ) is
continuous.

NV HANH Probability and statistics First semester, 2023-2024 28 / 39


Covariance matrix and correlation

Covariance

Definitions 4.9:
Let (X , Y ) be a two-dimensional random variable. The covariance of
(X , Y ) is defined by:

cov (X , Y ) = E (XY ) − E (X )E (Y )

NV HANH Probability and statistics First semester, 2023-2024 29 / 39


Covariance matrix and correlation

Covariance

Definitions 4.9:
Let (X , Y ) be a two-dimensional random variable. The covariance of
(X , Y ) is defined by:

cov (X , Y ) = E (XY ) − E (X )E (Y )

where
Pn Pn Pm
E (X ) = i=1 xi pi· = j=1 xi pij ,
Pm Pi=1n Pm
E (Y ) = j=1 yj p·j = i=1 j=1 yj pij ,
E (XY ) = ni=1 m
P P
j=1 xi yj pij ,
if (X , Y ) is discrete.

NV HANH Probability and statistics First semester, 2023-2024 29 / 39


Covariance matrix and correlation

Covariance

Definitions 4.9:
Let (X , Y ) be a two-dimensional random variable. The covariance of
(X , Y ) is defined by:

cov (X , Y ) = E (XY ) − E (X )E (Y )

NV HANH Probability and statistics First semester, 2023-2024 30 / 39


Covariance matrix and correlation

Covariance

Definitions 4.9:
Let (X , Y ) be a two-dimensional random variable. The covariance of
(X , Y ) is defined by:

cov (X , Y ) = E (XY ) − E (X )E (Y )

where
R +∞ R +∞ R +∞
E (X ) = −∞ xfX (x)dx = −∞ −∞ xf (x, y )dxdy ,
R +∞ R +∞ R +∞
E (Y ) = −∞ yfY (y )dy = −∞ −∞ yf (x, y )dxdy ,
R +∞ R +∞
E (XY ) = −∞ −∞ xyf (x, y )dxdy ,
if (X , Y ) is continuous.

NV HANH Probability and statistics First semester, 2023-2024 30 / 39


Covariance matrix and correlation

Covariance

Properties:
If X and Y are independent then cov (X , Y ) = 0, but the opposite is
not always true.

NV HANH Probability and statistics First semester, 2023-2024 31 / 39


Covariance matrix and correlation

Covariance

Properties:
If X and Y are independent then cov (X , Y ) = 0, but the opposite is
not always true.
If cov (X , Y ) 6= 0 then X and Y are called to be related and if
cov (X , Y ) = 0 then X and Y are not related.

NV HANH Probability and statistics First semester, 2023-2024 31 / 39


Covariance matrix and correlation

Covariance matrix

Definitions 4.10:
Let (X , Y ) be a two-dimensional random variable. The covariance matrix
of (X , Y ) is defined by:
 
V (X ) cov (X , Y )
Γ(X , Y ) =
cov (Y , X ) V (Y )

where cov (Y , X ) = cov (X , Y ).

NV HANH Probability and statistics First semester, 2023-2024 32 / 39


Covariance matrix and correlation

Coefficient of correlation
Definitions 4.11:
Let (X , Y ) be a two-dimensional random variable. The coefficient of
correlation between X and Y is defined by:

cov (X , Y )
ρ(X , Y ) = p .
V (X )V (Y )

NV HANH Probability and statistics First semester, 2023-2024 33 / 39


Covariance matrix and correlation

Coefficient of correlation
Definitions 4.11:
Let (X , Y ) be a two-dimensional random variable. The coefficient of
correlation between X and Y is defined by:

cov (X , Y )
ρ(X , Y ) = p .
V (X )V (Y )

Properties:
If X and Y are independent then ρ(X , Y ) = 0, but the opposite is
not always true.

NV HANH Probability and statistics First semester, 2023-2024 33 / 39


Covariance matrix and correlation

Coefficient of correlation
Definitions 4.11:
Let (X , Y ) be a two-dimensional random variable. The coefficient of
correlation between X and Y is defined by:

cov (X , Y )
ρ(X , Y ) = p .
V (X )V (Y )

Properties:
If X and Y are independent then ρ(X , Y ) = 0, but the opposite is
not always true.
If ρ(X , Y ) 6= 0 then X and Y are related and if ρ(X , Y ) = 0 then X
and Y are not related.

NV HANH Probability and statistics First semester, 2023-2024 33 / 39


Covariance matrix and correlation

Coefficient of correlation
Definitions 4.11:
Let (X , Y ) be a two-dimensional random variable. The coefficient of
correlation between X and Y is defined by:

cov (X , Y )
ρ(X , Y ) = p .
V (X )V (Y )

Properties:
If X and Y are independent then ρ(X , Y ) = 0, but the opposite is
not always true.
If ρ(X , Y ) 6= 0 then X and Y are related and if ρ(X , Y ) = 0 then X
and Y are not related.
The range of ρ(X , Y ) is [−1, 1]: −1 ≤ ρ(X , Y ) ≤ 1.

NV HANH Probability and statistics First semester, 2023-2024 33 / 39


Covariance matrix and correlation

Coefficient of correlation
Definitions 4.11:
Let (X , Y ) be a two-dimensional random variable. The coefficient of
correlation between X and Y is defined by:

cov (X , Y )
ρ(X , Y ) = p .
V (X )V (Y )

Properties:
If X and Y are independent then ρ(X , Y ) = 0, but the opposite is
not always true.
If ρ(X , Y ) 6= 0 then X and Y are related and if ρ(X , Y ) = 0 then X
and Y are not related.
The range of ρ(X , Y ) is [−1, 1]: −1 ≤ ρ(X , Y ) ≤ 1.
If Y = a + bX with b > 0 then ρ(X , Y ) = 1 and if Y = a + bX with
b < 0 then ρ(X , Y ) = −1.
NV HANH Probability and statistics First semester, 2023-2024 33 / 39
Examples

Examples

Example 4.3:
Let X be the number of accidents per day and Y be the number of injured
or dead people per day at a small town. We observed X and Y during a
period of 100 days and obtained the following data:
X \Y 0 1 2 3
0 8 0 0 0
1 22 9 1 0
2 20 10 3 1
3 8 5 2 1
4 4 3 2 1
Find the covariance matrix of (X , Y ).
Find the coefficient of correlation between X and Y .
Are X and Y related?

NV HANH Probability and statistics First semester, 2023-2024 34 / 39


Examples

Examples

Solution of Example 4.3:


Find the covariance matrix of (X , Y ).
E (XY ) = 0 ∗ 0 ∗ 0.08 + 1 ∗ 0 ∗ 0.22 + ... + 4 ∗ 3 ∗ 0.01 = 1.25

NV HANH Probability and statistics First semester, 2023-2024 35 / 39


Examples

Examples

Solution of Example 4.3:


Find the covariance matrix of (X , Y ).
E (XY ) = 0 ∗ 0 ∗ 0.08 + 1 ∗ 0 ∗ 0.22 + ... + 4 ∗ 3 ∗ 0.01 = 1.25
Then
The covariance of (X , Y ) is
cov (X , Y ) = E (XY ) − E (X )E (Y ) = 0.2724

NV HANH Probability and statistics First semester, 2023-2024 35 / 39


Examples

Examples

Solution of Example 4.3:


Find the covariance matrix of (X , Y ).
E (XY ) = 0 ∗ 0 ∗ 0.08 + 1 ∗ 0 ∗ 0.22 + ... + 4 ∗ 3 ∗ 0.01 = 1.25
Then
The covariance of (X , Y ) is
cov (X , Y ) = E (XY ) − E (X )E (Y ) = 0.2724
The covariance matrix of (X , Y ) is
   
V (X ) cov (X , Y ) 1.1856 0.2724
Γ(X , Y ) = =
cov (Y , X ) V (Y ) 0.2724 0.5896

NV HANH Probability and statistics First semester, 2023-2024 35 / 39


Examples

Examples

Solution of Example 4.3:


Find the coefficient of correlation between X and Y .
The coefficient of correlation between X and Y is
cov (X , Y ) 0.2724
ρ(X , Y ) = p =√ = 0.823
V (X )V (Y ) 1.1856 ∗ 0.5896

NV HANH Probability and statistics First semester, 2023-2024 36 / 39


Examples

Examples

Solution of Example 4.3:


Find the coefficient of correlation between X and Y .
The coefficient of correlation between X and Y is
cov (X , Y ) 0.2724
ρ(X , Y ) = p =√ = 0.823
V (X )V (Y ) 1.1856 ∗ 0.5896

Are X and Y related?


Since ρ(X , Y ) = 0.823 6= 0 then X and Y are related and since
ρ(X , Y ) = 0.823 is close to 1, then X and Y have a strong positive
linear relationship.

NV HANH Probability and statistics First semester, 2023-2024 36 / 39


Examples

Examples

Example 4.4:
Suppose that the two-dimensional continuous random variable (X , Y ) has
the following joint pdf:
(
1
xy if 0 ≤ x ≤ 4; 1 ≤ y ≤ 5,
f (x, y ) = 96
0 otherwise

Find the covariance matrix of (X , Y ).


Find the coefficient of correlation between X and Y .
Are X and Y related?

NV HANH Probability and statistics First semester, 2023-2024 37 / 39


Examples

Examples

Solution of Example 4.4:


We have
R +∞ R4 1 2 8
µX = E (X ) = −∞ xfX (x)dx = 0 8 x dx = 3

NV HANH Probability and statistics First semester, 2023-2024 38 / 39


Examples

Examples

Solution of Example 4.4:


We have
R +∞ R4
µX = E (X ) = −∞ xfX (x)dx = 0 18 x 2 dx = 38
R +∞ R4
V (X ) = −∞ x 2 fX (x)dx − µ2X = 0 18 x 3 dx − (8/3)2 = 8
9

NV HANH Probability and statistics First semester, 2023-2024 38 / 39


Examples

Examples

Solution of Example 4.4:


We have
R +∞ R4
µX = E (X ) = −∞ xfX (x)dx = 0 18 x 2 dx = 38
R +∞ R4
V (X ) = −∞ x 2 fX (x)dx − µ2X = 0 18 x 3 dx − (8/3)2 = 8
9
R +∞ R5 1 2
µY = E (Y ) = −∞ yfY (y )dy = 1 12 y dy = 31 9 .

NV HANH Probability and statistics First semester, 2023-2024 38 / 39


Examples

Examples

Solution of Example 4.4:


We have
R +∞ R4
µX = E (X ) = −∞ xfX (x)dx = 0 18 x 2 dx = 38
R +∞ R4
V (X ) = −∞ x 2 fX (x)dx − µ2X = 0 18 x 3 dx − (8/3)2 = 98
R +∞ R5 1 2
µY = E (Y ) = −∞ yfY (y )dy = 1 12 y dy = 31 9 .
R +∞ 2 5 1 3 92
V (Y ) = −∞ y fY (y )dy − µ2Y = 1 12 y dy − (31/9)2 =
R
81 .

NV HANH Probability and statistics First semester, 2023-2024 38 / 39


Examples

Examples

Solution of Example 4.4:


We have
R +∞ R4
µX = E (X ) = −∞ xfX (x)dx = 0 18 x 2 dx = 38
R +∞ R4
V (X ) = −∞ x 2 fX (x)dx − µ2X = 0 18 x 3 dx − (8/3)2 = 98
R +∞ R5 1 2
µY = E (Y ) = −∞ yfY (y )dy = 1 12 y dy = 31 9 .
R +∞ 2 5 1 3
V (Y ) = −∞ y fY (y )dy − µ2Y = 1 12 y dy − (31/9)2 = 92
R
81 .
R +∞ R +∞ 1
R 4 5 2 2
R 248
E (XY ) = −∞ −∞ xyf (x, y )dxdy = 96 0 1 x y dxdy = 27

NV HANH Probability and statistics First semester, 2023-2024 38 / 39


Examples

Examples

Solution of Example 4.4:


Then
The covariance of (X , Y ) is
248 8 31
cov (X , Y ) = E (XY ) − E (X )E (Y ) = 27 − 3 9 = 0.

NV HANH Probability and statistics First semester, 2023-2024 39 / 39


Examples

Examples

Solution of Example 4.4:


Then
The covariance of (X , Y ) is
248 8 31
cov (X , Y ) = E (XY ) − E (X )E (Y ) = 27 − 3 9 = 0.
The covariance matrix of (X , Y ) is
  8 
V (X ) cov (X , Y ) 0
Γ(X , Y ) = = 9 92
cov (Y , X ) V (Y ) 0 81

NV HANH Probability and statistics First semester, 2023-2024 39 / 39


Examples

Examples

Solution of Example 4.4:


The coefficient of correlation between X and Y is
cov (X , Y ) 0
ρ(X , Y ) = p =p =0
V (X )V (Y ) (8/9)(92/81)

NV HANH Probability and statistics First semester, 2023-2024 40 / 39


Examples

Examples

Solution of Example 4.4:


The coefficient of correlation between X and Y is
cov (X , Y ) 0
ρ(X , Y ) = p =p =0
V (X )V (Y ) (8/9)(92/81)

Are X and Y related?


Since ρ = 0 then X and Y are not related.

NV HANH Probability and statistics First semester, 2023-2024 40 / 39

You might also like