Multivariate Normal Distribution

Time series model

  • a specification of the joint distribution of {z𝑡}

Gaussian time series model

p(z1,z2,,zT)=N(μ,Σ).
  • probability density:

p(z;μ,Σ)=(2π)(T2)det(Σ)12exp(.5(zμ)Σ1(zμ))
  • where μ=Ez is the mean of the random vector z

  • and Σ=E(zμ)(zμ)=cov(z) is the covariance matrix of z

Building Gaussian time series models

  • Gaussian innovations {ε𝑡}:

p(ε1,ε2,,εT)=p(ε)=N(0,σ2I).
  • affine transformation εz

z=μ+AεN(μ,Σ)

where

Σ=σ2AA

General result

zN(μ,Σ)
  • affine transformation zy

y=d+BzN(d+Bμ,BΣB)

The joint, marginal and conditional distributions

Joint

p(z1,z2,,zkz1,zk+1,zk+2,,zTz2)=p(z1,z2)N(μ,Σ).

with:

μ=[μ1μ2]andΣ=[Σ11Σ12Σ21Σ22], whereΣ21=Σ12

Marginal

p(z1)=z2p(z1,z2)dz2=N(μ1,Σ11)p(z2)=z1p(z1,z2)dz1=N(μ2,Σ22)

Conditional

p(z1|z2)=N(μ1+Σ12Σ221(z2μ2)E(z1|z2),Σ11Σ12Σ221Σ21cov(z1|z2))

Let

Q=Σ1=[Q11Q12Q21Q22]

Then

E(z1|z2)=μ1+Q111Q12(z2μ2)cov(z1|z2)=Q111

Q is called the precision matrix.

Independence

ifΣ12=0p(z1|z2)=N(μ1,Σ11)=p(z1)

If z1N(μ1,Σ11) and z2N(μ2,Σ22) are independent then

z1+z2N(μ1+μ2,Σ11+Σ22)

and

p(z1,Az1+Bz2)N(μ,Σ).

with:

μ=[μ1Aμ1+Bμ2]andΣ=[Σ11Σ11AAΣ11AΣ11A+BΣ22B]

Information

cov(z1|z2)=Σ11Σ12Σ221Σ210
  • stronger correlation => more information from z1 about z2 (and from z2 about z1)

Bivariate Normal

p(z1,z2)N(μ,Σ).

where:

μ=[μ1μ2]andΣ=[σ12ρσ1σ2ρσ1σ2σ22]
p(z1|z2)=N(μ1+ρσ1σ2σ22(z2μ2),σ12(ρσ1σ2)2σ22)=N(μ1+ρσ1σ2(z2μ2),(1ρ2)σ12)

Example: σ1=σ2=1, μ1=μ2=0

case 1 ρ=.9

p(z1)=N(0,1)
rho=.9
sigma1 = 1
sigma2 = 1
mu1=0

mu2=0

y2 = 1

(
mu1 + (y2 - mu2)*(rho*sigma1*sigma2)/(sigma2**2), 
1 - (rho*sigma1*sigma2)**2/(sigma2**2)
)
(0.9, 0.18999999999999995)

If z2=1

p(z1|z2=1)=N(0.9,0.19)

Information about z1 from observing z2

var(z1)var(z1|z2)=10.19=0.81

Reduction of the uncertainty about z1 by 81%

case 2 ρ=.1, σ1=σ2=1, μ1=μ2=0

p(z1)=N(0,1)
rho=.1
sigma1 = 1
sigma2 = 1
mu1=0
mu2=0

y2 = 1

(
mu1 + (y2 - mu2)*(rho*sigma1*sigma2)/(sigma2**2), 
1-(rho*sigma1*sigma2)**2/(sigma2**2)
)
(0.1, 0.99)

If z2=1

p(z1|z2=1)=N(0.1,0.99)

Reduction of the uncertainty about z1 by 1%

Let z be jointly Gaussian, and partitioned as (z1 is a scalar)

z=[z1,z2]
μ=[μ1μ2]andΣ=[Σ11Σ12Σ21Σ22]

Then

p(z1|z2)=N(μ1Σ12Σ221μ2β0+Σ12Σ221β1z2,Σ11Σ12Σ221Σ21σ2)

therefore,

z1=β0+β1z2+εwhere εN(0,σ2)

Conditional (in)dependence

Two random variables z1 and z2 are conditionally independent given z3 if

(1)p(z1,z2|z3)=p(z1|z3)p(z2|z3)

If z1, z2 and z3 are jointly Gaussian, then (1) is true iff

{Σ1}1,2=Q1,2=0

More generally, zi and zj are conditionally independent given the remaining elements of z (denote them with zij) iff

Qi,j=0

And the conditional correlation between zi and zj is

corr(zi,zj|zij)=Qi,jQi,iQjj

also known as partial correlation between zi and zj

Example 1

Q=[10.400.41.160.400.41]

then

Σ=[1.190476190.476190480.190476190.476190481.190476190.476190480.190476190.476190481.19047619]

therefore, z1 and z3 are unconditionally dependent, but conditionally (given z2) independent

Example 2

Σ=[1.090.30.0.31.090.300.31.09]

then

Q=[1.0.30.080.31.080.30.080.31]

therefore, z1 and z3 are unconditionally independent, but conditionally (given z2) dependent

from statsmodels.tsa.arima_process import arma_acovf
from scipy.linalg import toeplitz
import numpy as np

acov1 = arma_acovf(ar=[1, -.4], ma=[1], nobs=10, sigma2=1)
Sigma1 = toeplitz(acov1)
acov2 = arma_acovf(ar=[1,], ma=[1, .3], nobs=10, sigma2=1)
Sigma2 = toeplitz(acov2)


print(np.linalg.inv(Sigma1[:3][:,:3]).round(4))
print(np.linalg.inv(Sigma2[:3][:,:3]).round(4))
[[ 1.   -0.4   0.  ]
 [-0.4   1.16 -0.4 ]
 [ 0.   -0.4   1.  ]]
[[ 0.9993 -0.2976  0.0819]
 [-0.2976  1.0812 -0.2976]
 [ 0.0819 -0.2976  0.9993]]

Missing values

  • Suppose we have a Gaussian model for z

zN(μ,Σ)
  • but some elements of z are not observed, i.e. we observe a vector z1

  • for example

z=[z1z2zk1zkzk+1zT2zT1zT],z1=[z2zk1zk+1zT2]

Some examples

  • mixed frequency

    • (univariate) GDP at annual, GDP at quarterly

    • (multivariate) GDP at annual, inflation at monthly

    • etc.

  • forecasting

  • backcasting

  • unobserved (latent) variables

    • state of the economy

    • natural rates (interest, unemployment)

    • economic shocks

observed elements z1, unobserved elements z2

  • z1, z2 - jointly Gaussian

  • marginal distribution of z1

p(z1)N(μ1,Σ1)

example:

z=[z1z2z3],z1=[z1z3],z2=[z2]
z1=[100001][z1z2z3]=B1z
z2=[010][z1z2z3]=B2z
  • conditional distribution of z2 given z1

p(z2|z1)=N(μ2+Σ21Σ111(z1μ1)E(z2|z1),Σ22Σ21Σ111Σ12cov(z2|z1))

if z1 is the past and z2 is the future,

  • E(z2|z1) - optimal forecast of z2 given z1

  • cov(z2|z1) - variance of the optimal forecast

where optimality is in the sense of minimizing the MSE

in general, E(z2|z1) is our best guess of z2 given z1, and cov(z2|z1) is the associated uncertainty