Introduction GARCH Modeling with R/Rmetrics · GARCH Modeling with R/Rmetrics Introduction Mean and...

Post on 10-Apr-2018

236 views 6 download

Transcript of Introduction GARCH Modeling with R/Rmetrics · GARCH Modeling with R/Rmetrics Introduction Mean and...

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

GARCH Modeling with R/RmetricsA Case Study presented at the Meielisalp Workshop on

Computational Finance and Financial Engineeringwww.rmetrics.org | itp.phys.ethz.ch

Yohan Chalabi∗, EPFL Lausanne,Diethelm Würtz, ITP ETH Zürich,

Ladislav Luksan, Czech Academy of Science.

∗Work done as part of a Master’s Degree Project, Feb 2006

Switzerland, July 2007

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Mean and variance equation

The mean equation of an univariate time series xt can bedescribed by the process

xt = E(xt |Ft−1) + εt , (1)

where E( · | · ) denotes the conditional expectation operator,Ft−1 the information set at time t − 1, and εt the innovationsof the time series.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

ARMA mean equation

The ARMA(m,n) process of autoregressive order m andmoving average order n can be described as

xt = µ +m∑

i=1

aixt−i +n∑

j=1

bjεt−j + εt , (2)

with mean µ, autoregressive coefficients ai and movingaverage coefficients bi .

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

GARCH variance equation

The mean equation does not take into accountheteroskedastic effects typically observed in financial timeseries. Engle [1982] introduced the AutoregressiveConditional Heteroskedastic model, named ARCH, latergeneralised by Bollerslev [1986], named GARCH.

εt = ztσt ,

zt ∼ Dϑ(0, 1) ,

σ2t = ω +

p∑i=1

αiε2t−i +

q∑j=1

βjσ2t−j , (3)

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

APARCH variance equation

Ding [1993] introduced the APARCH(p,q) variance that canbe expressed as

εt = ztσt ,

zt ∼ Dϑ(0, 1) ,

σδt = ω +

p∑i=1

αi(|εt−i | − γiεt−i)δ +

q∑j=1

βjσδt−j , (4)

where δ > 0 and −1 < γi < 1.This model adds the flexibility of a varying exponent with anasymmetry coefficient γi to take the leverage effect intoaccount and the varying power δ to consider the Tayloreffect.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

An unique GARCH modellingapproach

• garchSpec() - specifies a GARCH model.• garchSim() - simulates an artificial GARCH time series.• garchFit() - fits the parameters to the model using the

maximum log-likelihood estimator.• print, plot, summary, - are S3 methods for an object

returned by the function garchFit().• predict - is a generic function to forecast from an

estimated model.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

How to fit GARCH(1,1) model

In this example we estimate the parameters for aGARCH(1,1) model with normal innovations. The processcan be decomposed in five steps :

• Parameter initialization• Conditional distribution• Log-likelihood function• Parameter estimation• Summary report

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Parameter initialization

we initialize the set of model parameters θ, params, and thecorresponding upper and lower bounds.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Conditional distribution

For the conditional distribution we use the Normaldistribution dnorm().

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Log-likelihood functionThe quasi-maximum likelihood technique applied to aGARCH(1,1) process leads then to the followingoptimisation problem

min LN(θ) =12

∑t

[ln 2π + ln σ2

t +ε2

t

σ2t

]subject to

xt − µ − εt = 0σ2

t − ω − αε2t−1 − βσ2

t−1 = 0−ω ≤ 0−α ≤ 0−β ≤ 0α + β − 1 ≤ 0

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Log-likelihood function

In our example we use a fast and efficient filterrepresentation for the variance equation.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Parameter estimation

We use the constrained solver nlminb() which is available inR and SPlus.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Summary report

The results for the estimated parameters together withstandard errors and t-values are summarized and printed.To compute standard errors and t-values we evaluate theHessian matrix numerically.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Overview of garchFit()

We keep the same steps as described above, but with moreoptions :• A wide range of GARCH models• Different conditional distribution• Recursion initialization• Different solver• Diagnostic plots

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

DEMGBP benchmark

Gabriele Fiorentini, Giorgio Calzolari, and LorenzoPanattoni. 1996.• Fiorentini et al. [1996] (FCP) took the daily percentage

nominal returns for the German mark/British sterlingexchange rate, henceforth (DEMGBP), as published byBollerslev and Ghysels [1996].

• FCP calculated the set of parameters for theGARCH(1,1) process with the help of analyticalderivatives and Hessian of the conditionallog-likelihood.

• The FCP implementation constitutes today a wellaccepted benchmark.

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

DEMGBP benchmarkThe series contains a total of 1975 daily observationssampled during the period from January 2, 1984, toDecember 31, 1991.

log Return

Time

log R

eturn

0 500 1000 1500 2000

!2

!1

01

23

Prices

Time

Pri

ces

0 500 1000 1500 2000

!30

!20

!10

0

Volatility Histogram

series

Den

sity

!2 !1 0 1 2 3

0.0

0.4

0.8

1.2

!3 !2 !1 0 1 2 3

!2

!1

01

23

Normal Q!Q Plot

Theoretical QuantilesSam

ple

Quanti

les

0 5 10 15 20 25 30

0.0

0.2

0.4

0.6

0.8

1.0

Lag

AC

F

ACF of Observations

0 5 10 15 20 25 30

0.0

0.2

0.4

0.6

0.8

1.0

Lag

AC

F

ACF of Squared Observations

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Results and comparison

Rmetrics FCP Finmetrics G@ARCH Shazam TSP

μ -0.006190 -0.006190 -0.006194 -0.006183 -0.006194 -0.006190ω 0.01076 0.01076 0.01076 0.01076 0.01076 0.01076α 0.1531 0.1531 0.1540 0.1531 0.1531 0.1531β 0.8060 0.8060 0.8048 0.8059 0.8060 0.8060

Rmetrics FCP Benchmark G@ARCH OxEstimate StdErrors Estimate StdErrors Estimate StdErrorsdErrors

μ 0.00619040 .00846211 -0.00619041 .00846212 -0.006184 0.008462 ω 0.0107614 .00285270 0.0107614 .00285271 0.010760 0.002851 α 0.153134 0.0265227 0.153134 0.0265228 0.153407 0.026569 β 0.805974 0.0335525 0.805974 0.0335527 0.805879 0.033542

Rmetrics: FCP Benchmark: Ox/Garch: Splus/Finmetrics:Estimate StdError t Value Estimate StdError t Value Estimate StdError t Value Estimate StdError t Value

μ -0.0061904 0.0084621 -0.732 -0.0061904 0.0084621 -0.732 -0.006184 0.008462 -0.731 -0.006053 0.00847 -0.715ω 0.010761 0.0028527 3.77 0.010761 0.0028527 3.77 0.010761 0.0028506 3.77 0.010896 0.0029103 3.74α 0.15313 0.026523 5.77 0.15313 0.026523 5.77 0.15341 0.026569 5.77 0.15421 0.026830 5.75β 0.80597 0.033553 24.0 0.80597 0.033553 24.0 0.80588 0.033542 24.0 0.80445 0.034037 23.6

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Outline

1 IntroductionMean and variance equation

2 fSeries : a R/Rmetrics implementationAn unique GARCH modelling approachHow to fit GARCH(1,1) modelOverview of garchFit() in fSeries package

3 Case studiesGARCH(1,1) model and the DEMGBP benchmarkMA(1)-APARCH(1,1) model and the SP500 benchmark

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

APARCH : Ding et al.The SP500 Index returns as discussed in the paper of Ding,Granger and Engle [1993], DGE.

0 5000 10000 15000

−0.

20.

00.

1

Index

Ret

urns

SP500 Daily Returns

0 5000 10000 15000

05

1015

20

Index

exp(

Cum

ulat

ed R

etur

ns)

SP500 Exponential Cumulated Returns

0 5000 10000 15000

0.00

0.10

0.20

Index

abs(

Ret

urns

)

SP500 Volatilities

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

APARCH : Ding et al.

DGE R Splus OxPaper Rmetrics rescaled Finmetrics rescaled G@RCH rescaled

μ 0.00021 0.02065 0.000207 0.02084 0.000208 0.02038 0.000204a 0.145 0.1447 0.1447 0.1446ω 0.000014 0.009988 0.0000163 0.01003 0.0000159 0.009991 0.0000150α 0.083 0.08380 0.08375 0.08377γ 0.373 0.3731 -0.3710 0.3765β 0.920 0.9194 0.9195 0.9199δ 1.43 1.435 1.429 1.416

GARCHModeling with

R/Rmetrics

IntroductionMean and varianceequation

fSeries : aR/Rmetricsimplementa-tionAn unique GARCHmodelling approach

How to fitGARCH(1,1) model

Overview ofgarchFit() in fSeriespackage

Case studiesGARCH(1,1) modeland the DEMGBPbenchmark

MA(1)-APARCH(1,1)model and theSP500 benchmark

Thank you for your attention