Escolar Documentos
Profissional Documentos
Cultura Documentos
MSCS6020
Department of Mathematics,
Statistics, and Computer Science
Marquette University
MSCS6020
Agenda
6.1 The Multivariate Normal
6.2 Generating a Multivariate Normal
Random Vector
D.B. Rowe
2
Marquette University
MSCS6020
x z .
The PDF of x can be obtained by
f ( x | , 2 ) f ( z( x)) | J ( z x) |
where z(x) is z written in terms of x and J() is the Jacobian
of the transformation.
D.B. Rowe
3
Marquette University
MSCS6020
variables ( x1 , x2 ) depending
upon parameters satisfies
1)
0 f ( x1, x2 | ), ( x1, x2 )
2)
f ( x1 , x2 | )dx1dx2 1 .
x1x2
D.B. Rowe
4
Marquette University
MSCS6020
E ( x2 | ) 2
Marginal variances.
21
cov( x1 , x2 | ) 12 12
var( x1 | )
var( x | )
2
var( x2 | ) 12 2
cov( x1 , x2 | )
22
D.B. Rowe
5
Marquette University
MSCS6020
mean
mean
1
( z 0)(1)1 ( z 0)
1 12 z 2
1/2
f ( z)
e
2 (1)1/2 e 2
variance
2
variance
11
D.B. Rowe
6
Marquette University
MSCS6020
f ( x | , ) f ( z( x)) | J ( z x) |
2
dz ( x)
J ( z x)
dx
The PDF of x is
11
1
f ( x | , )
e
2
2
1 x
f ( x | , ) 2
2
1/2
2 1/2
1
( x )( 2 )1 ( x )
2
D.B. Rowe
7
Marquette University
MSCS6020
z1
them as a 2-dimensional vector z , and this vector
21 z2
vector
f Z ( z | . )
vector
f Z ( z | ) f Z1 ( z1 | 1 ) f Z2 ( z2 | 2 ) .
D.B. Rowe
8
Marquette University
MSCS6020
1 12 ( z12 z22 )
.
e
2
1 12 z ' z
fZ ( z)
e
2
.
D.B. Rowe
9
Marquette University
MSCS6020
1 12 z ' z
e
2
fZ ( z)
(2 )2/2 | I 2 |1/2 e
z1
z
21 z2
mean vector
mean vector
1
( z 0) '( I 2 )1 ( z 0)
2
covariance matrix
covariance matrix
I2
covariance matrix
is 22
Identity matrix
mean vector
Marquette University
MSCS6020
f Z ( z ) (2 )2/2 | I 2 |1/2 e
1
( z 0) '( I 2 )1 ( z 0)
2
E ( z1 ) 1 0
E( z)
E ( z2 ) 2 0
0
z1
z
21 z2
22 Identity matrix
21
cov( z1 , z2 ) 12 12 1 0
var( z1 )
var( z )
2
cov(
z
,
z
)
var(
z
)
0
1
1 2
2
12
2
I2
22
D.B. Rowe
11
Marquette University
MSCS6020
f ( z ) (2 )2/2 | I 2 |1/2 e
1
( z 0) '( I 2 )1 ( z 0)
2
21 22 21 21
D.B. Rowe
12
Marquette University
MSCS6020
mean vector
f ( x | , ) (2 ) p /2 | |1/2 e
mean vector
1
( x ) ' 1 ( x )
2
22
x,
p2
covariance matrix
covariance matrix
mean vector
set of pos
def matrices
covariance matrix
21 22
22
D.B. Rowe
13
Marquette University
MSCS6020
x A z
21 22 21 21
x1 a11 a12 z1 1
x a
2 21 a22 z2 2
x1 a11z1 a12 z2 1
x2 a21z1 a22 z2 2
We can solve for z1 and z2 in terms of x1 and x2.
11
11
11
11
D.B. Rowe
14
Marquette University
MSCS6020
22
a11a22 a12a21 a21 a11
x A z
21
22 21 21
z A1 x
21 22
21
A invertible
z1 b11 b12 x1 1
z b b x
2 21 22 2
2
21
22
b11 b12
B A
22 22
b
b
21 22
1
21
z1 b11 ( x1 1 ) b12 ( x2 2 )
z2 b21 ( x1 1 ) b22 ( x2 2 )
D.B. Rowe
15
Marquette University
MSCS6020
z1 ( x1 , x2 )
x2
b11 b12
z2 ( x1 , x2 ) b21 b22 22
x2
z
, the vector derivative is J B .
x 22
D.B. Rowe
16
Marquette University
MSCS6020
z B x
f X ( x | ) f Z ( z( x)) | J ( z x) |
f ( z ) (2 ) p /2 | I p |1/2 e
1
( z 0) '( I p )1 ( z 0)
2
f X ( x | , ) (2 )2/2 | I p |1/2 e
AA '
21
1
B x 0 '( I p )1 B x 0
| || A || A ' || A |2 | |1/2 | A |
f X ( x | , ) (2 ) p /2 | |1/2 e
z
J
B
x 22
1
x ' 1 x
2
B A1 | |1/2 | B |
x, p
0
D.B. Rowe
17
Marquette University
MSCS6020
f X ( x1 , x2 | 1 , 2 , , )
2
1
2
2
1
2 1 2 1
1
Q
2
2
2
x1 1
x1 1 x2 2 x2 2
1
Q
2
2
(1 ) 1
1 2 2
1 0, 2 0, 1 1
12 / (1 2 )
12 cov( x1, x2 )
D.B. Rowe
18
Marquette University
MSCS6020
E ( x | , )
think of p=2
p1
var( x | , )
pp
and rp
A full column rank (A: rp, rp), then
rp pp pr
D.B. Rowe
19
Marquette University
MSCS6020
z2
1
atan .
and u2 ( z1 , z2 )
2
z1
u1 ( z1, z2 ), u2 ( z1, z2 ) | | J (u1, u2 z1, z2 ) |
1
( z12 z22 )
2
1 12 z12 1 12 z22
f Z1 ,Z2 ( z1 , z2 )
e
e
2
2
This means z1 ~ N (0,1) , z2 ~ N (0,1), z1 and z2 are independent.
D.B. Rowe
20
Marquette University
MSCS6020
Bivariate Normal
Marquette University
MSCS6020
y Az
21 22 21 21
3. 5
Bivariate Normal
3 2
21 22 2 4
added .
0.58
21
Cholesky 1.7321
0
A
22 1.1547 1.6330
x 10
Marginal
Normal
2. 5
1. 5
0. 5
-5
10
y
3. 5
x 10
y1
Marginal
Normal
2. 5
1. 5
0. 5
0
-5
5
y
10
D.B. Rowe
cross
section
y2
15
A=chol(Sigma)
22
Marquette University
MSCS6020
Homework 5:
Chapter 6: # 4, 5, 6.
* Assume Marquette Undergrads heights have
h=67 in and h=2 in while their weights have
w=150 lbs and w=4 lbs with =.75.
a) Present an algorithm for generating random height &
weights using both Cholesky and Eigen factorizations.
b) Generate 10,000 using both factorizations.
Compute summary means, variances, covariance and
correlation. Make 2D & 3D histograms.
D.B. Rowe
23
Marquette University
MSCS6020
Rowe, 2003
D.B. Rowe
24
Marquette University
MSCS6020
2
.75 2 4
4
.75 2 4
a11 2 1.4142
.75 2 4
a21
1.5
2
2
a22 4 a21
1.3229
0
1.4142
A
1.5000
1.3229
Sigma=[2,sqrt(2)*sqrt(4)*.75;sqrt(2)*sqrt(4)*.75,4];
a11=sqrt(2)
a21=.75*sqrt(2*4)/sqrt(2)
a22=sqrt(4-a21^2)
A=[a11,0;a21,a22]
D.B. Rowe
25