50
Financial Time Series Analysis of SV Model by Hybrid Monte Carlo Tetsuya Takaishi Hiroshima University of Economics Shanghai, 2008.09.18

Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Financial Time Series Analysis of SV

Model by Hybrid Monte Carlo

Tetsuya Takaishi

Hiroshima University of Economics

Shanghai, 2008.09.18

Page 2: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Outline

Motivation

Stylized facts of financial data

Stochastic Volatility model

Bayesian inference

Markov Chain Monte Carlo

Hybrid Monte Carlo

Numerical simulations

Empirical results

Summary

Page 3: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Motivation

Financial time series (Stock price, Exchange rate etc.)

Model parameter estimations

•GARCH model

•Stochastic Volatility (SV) model

Maximum likelihood method

Markov Chain Monte Carlo (MCMC) method

MCMC method

•Metropolis method

•Hybrid Monte Carlo method

Global algorithm

(Bayesian inference)

efficiency?

correlation?

analyze the data with financial models

Page 4: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

•Stylized facts for price returns

))(ln())(ln()( ttptptr

•price return

• fat tailed distribution

• volatility clustering

• absence of autocorrelations in return

• long time correlation in absolute return

• etc

Many empirical studies show some properties which can not be obtained from Gaussian noise

Stylized facts of financial data

Page 5: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Oct. 19 1987

Gopikrishnan et al.,cond-mat/9905305

price return

volatility

clustering

Page 6: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Fat-tailed distribution

Page 7: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Financial modeling

To analyze the financial data we use some models

which capture some of stylized facts.

•GARCH model

•Stochastic Volatility (SV) model

Volatility clustering

Fat-tailed distribution

estimate model parameters

popular model

Page 8: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Stochastic Volatility model

,ttty )1,0(~ Nt

),0(~ Nt

Volatility varies in time stochastically.

Thus it is not deterministic.

The volatility at t+1 is not determined from that at t.

ttt hh )( 1 )log(2

tth

time series ty

Volatility variable

How to find ,,

Taylor(1986)

? Bayesian inference by Markov Chain Monte Carlo

Page 9: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Bayesian inference

)()|()|( yfy

Bayes’ theorem)(

)()|()|(

yf

yfy

)|( y :posterior distribution

)|( yf :likelihood function

)( :prior distribution

Probability distribution of θ

)(

)()|()( yfdyf

If there is some information on theta, then we use it for

.)( const

Bayes’ theorem tells us the probability distribution of theta

,,

Page 10: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

dyZ

)|(1

Markov Chain Monte Carlo

n

i

in 1

1

)|( y

The value of the parameter is evaluated as an expectation value.

First, generate theta with probability distribution :

We obtain a set of theta ),,,,( 321 n

The generation of theta is performed by MCMC.

probability distribution

of theta

Numerical estimation by MCMC

Page 11: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Metropolis method

))(exp()|( fy

)5.0( d

Local update

uniform random number in [0,1]

)()( ffdh

))exp(,1min( dh

)()()()( PPPP

detailed balance condition

We want to generate theta with

•calculate

•accept with

•draw

Page 12: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Hybrid Monte Carlo

•Molecular dynamics simulations

•Metropolis accept/reject step

HMC is a global algorithm that can update all variables at once.

S. Duane , A.D. Kennedy , B.J. Pendleton, D. Roweth (1987)

HMC consists of two steps:

HMC may de-correlate fast variables updated in MCMC.

Page 13: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

dgZ

))(exp(1

)exp(

))(2

1exp( 2

Hdpd

gpdpdZ

)(2

1 2 gpH

Partition function

we introduce momenta p conjugate to θ.

define

Hamiltonian

Hybrid Monte Carlo

This partition function does not change the value of <θ>.

Momenta have no dynamics.

This does not change the results.

))(exp()|( gy

dpdgpZ

))(2

1exp(

1 2

Page 14: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

•Solve the Hamilton‘s equations of motion (Molecular dynamics

simulation) for all variables simultaneously.

),(),( pHpH

HHdH

•Metropolis accept/reject step

)1),min(exp( dH

In general, dh is not zero in

the numerical integration.

Hybrid Monte Carlo

Hamiltonian is conserved.

p

H

Hp

pp

Accept new theta with

This can be small.

Page 15: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

22

2

2

1

2

1

2

1

22 );|()|()|( ntt

n

t

tt dddfyfyf

Zddddfyf ntt

n

t

tt /)();|()|( 22

2

2

1

2

1

2

1

22

Ex. The expectation value of phi is given by

Note that the number of integrals is n+3.

Hybrid Monte Carlo

Likelihood function of SV model

increases with n

Hybrid Monte Carlo

)()|()|( yfy posterior distribution

We have to integrate

volatilities

multiple integral

Page 16: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Numerical simulations

,ttty

ttt hh )( 1

)1,0(~ Nt

)1,(~ Nt

Generate artificial date (2000data) with the following parameters.

1.0,98.0,0.1

)log(2

tth

Page 17: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

fat-tail

Page 18: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Metropolis

HMC

)log(2

1010 h

Page 19: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Metropolis

HMC

Page 20: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Metropolis

HMC

Page 21: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Metropolis

HMC

Page 22: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Autocorrelation function h10

small correlation

Page 23: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 24: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 25: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 26: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

True

σ_

0.1

φ

0.98

μ

-1.0

h10

MCMC 0.1070(42) 0.9772(11) -1.064(64)

τ 300(60) 100(13) 1.2(1) 6.6(2)

The average values of the parameters are estimated from 20 independent

time series.

Numerical Simulations

1

)(2

1

t

tACFAutocorrelation time

τ 460(70) 130(16) 6.5(6) 150(15)

Metropolis

Page 27: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Empirical results

US$/MARK exchange rate 2 Jan 1980 to 31 May 1990

100]))(ln())1([ln()( riytyir

return

σ_ φ μ h10

0.0438(16) 0.9560(13) -.95197(78)

1400(500) 980(300) 5(1.3) 30(11)

MCMC results

Page 28: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

US/MARK 2JAN1980 to 31MAY 1990

return

Page 29: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

2

10h

Page 30: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Summary

•Hybrid Monte Carlo method is applied for MCMC of the

stochastic volatility model.

•HMC de-correlates volatility variables fast enough.

•On the other hand, the correlations of the parameters are not

well improved.

•HMC method improves the efficiency of MCMC partially.

•HMC method is an alternative method to perform MCMC simulations of SV model.

Page 31: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 32: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 33: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 34: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

,ttty

,1

2

1

22

n

j

jtj

m

i

itit y

GARCH(m,n) model

)1,0(~ Nt

Likelihood function:

2

2

21 2exp

2

1),,|(

t

t

t

n

t

yyf

n

t t

tn

t

t

nyf

12

2

1

2

2

1ln

2

1)2ln(

2)|(ln

GARCH model

Maximize this function by a certain method.

Volatility varies in time

tytime series

volatility

Generalized Autoregressive

Conditional Heteroscedasticity

Page 35: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Bayesian inference

Ex. Gaussian time series , tty

)(2

)(exp

2

1)|(

2

2

21

tn

t

yy

2

0

2

0

2

02

)(exp

2

1)(

Assume sigma is known.

Take the following prior density

2

0

2

0

2

0

2

2

21 2

)(exp

2

1

2

)(exp

2

1)|(

t

n

t

yy

Then we obtain the posterior density,

Page 36: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Bayesian inference

2

2

2

0

2

0

2

0

2

2

21

2

)(exp

2

)(exp

2

1

2

)(exp

2

1)|(

k

yy t

n

t

2

0

2

2

0

0

2

11

n

n

x

k

2

0

2

2

1

1

nk

n

t

tyx1

Page 37: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Bayesian inference

When is given, how can we infer the value of μ?)|( y

dk

Z

dyZ

2

2

2

)(exp

1

)|(1

The value of μ is given as the expectation value of it.

2

0

2

2

0

0

2

11

n

n

x

k

x

In the limit of n

Page 38: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Maximum likelihood estimation

(MLE)

, tty

Ex:Gaussian time series

)1,0(~ Nt

Likelihood function:

2

2

21 2

)(exp

2

1),|(

t

n

t

yyf

n

t

tynn

yf1

2

2

2 )(2

1ln

2)2ln(

2)|(ln

The values of the parameters are given by maximizing the likelihood function.

n

t

tyn 1

22 )(1

Suppose we have n data and infer parameters of the model from n data.

variance

Gaussian noise with mean 0 and variance 1

This maximization is easy,

n

t

tyn 1

1 average

maximize

Page 39: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Markov Chain Monte Carlo

),,(

333222111

4321

The generation of theta is done in the Markov chain.

Typical algorithm to perform MCMC

Metropolis algorithm

When we have multi-parameter

Each parameter is updated sequentially.

Disadvantage of MCMC: data are correlated

Page 40: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

1. chose a new value as candidate for theta

2. calculate

3. accept the new one with the probability

unless keep the old one.

4. return to 1.

Metropolis method

))(exp()|( fy )5.0( d

Local update

uniform random number in [0,1])()( ffdh

))exp(,1min( dh

)()()()( PPPP

detailed balance condition

generate theta with

Page 41: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Metropolis method

),,,( ),,,(

In the case of multi-parameter

)()( ffdh

All parameters could be updated at once…

))exp(,1min( dh

but in this case, the difference dh could be large,

This is large.acceptance ratio becomes small

Page 42: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

22

2

2

1

2

1

2

1

22 );|()|()|( ntt

n

t

tt dddfyfyf

2

2

2

22

2exp

2

1)|(

t

t

t

tt

yyf

2

22

1

2

22

2

1

2

2

}]){ln()[ln(exp

2

1);|(

tt

t

ttf

multiple integral# of integrations is # of data

Likelihood function of SV model

Bayesian inference by Markov Chain Monte Carlo

Maximum likelihood method is not applicable.

,,

Page 43: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Hgg , , Poisson bracket

HggHL ,)(

)())(exp()( tgHtLttg

VT

xfLpLHL

))((2/)( 2

)()2/exp()exp()2/exp())(exp( 3ttTtVtTHtL

Leapfrog integrator

In general, we cannot solve this.

operator

g is x or p.

Simplectic integrator

Hamilton's equations of motion

Page 44: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

2/)()2/()( :3

)2/()()( :2

2/)()()2/( :1

tttptttt

tttH

tpttp

ttpttt

θ

p

2/t

t

Δt is chosen such that the acceptance ratio takes 60~70%.

elementary step

repeat this step

Leapfrog integrator

t

t

optimal acceptance

Page 45: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

0:initialize parameters

1:update φ、sigma_eta、μ

2:update volatilities h

3:return to 1Hybrid Monte Carlo

Numerical simulations

Gibbs samplerMetropolis method

Use artificial data with known parameters

•accumulate data

•evaluate parameters parameters of artificial data

Page 46: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

Simulations

2

1222

exp)|(

C

yPT

T

t

tt hhhC2

2

1

2

1

2 )())(1(2

1where

Gamma distribution

Sigma_eta update

phi and mu are also easily updated.

Gaussian distribution

Page 47: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 48: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial

distribution of phi

Page 49: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial
Page 50: Financial Time Series Analysis of SV Model by Hybrid Monte Carlo › prfssr › tt-taka › ICIC2008takaishi.pdf · Shanghai, 2008.09.18. Outline Motivation Stylized facts of financial