Chan & Maheu, JBES 2002 (Jump GARCH model)

Use this forum for posting example programs or short bits of sample code.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

These are replication files for Chan and Maheu(2002), "Conditional Jump Dynamics in Stock Market Returns", Journal of Business and Economic Statistics, vol 20, no. 3, 377-389. This estimates GARCH models with added Poisson jump processes with either fixed or "ARJI" Poisson probabilities. The ARJI-GARCH model was introduced in this paper to allow the jump probabilities to be time-varying using an ARMA-like model.

Zip file with programs data

Detailed description
alberta123
Posts: 2
Joined: Sun Nov 24, 2013 2:33 am

Jump GARCH model

Unread post by alberta123 »

Hi Tom,

Can you modify the program of Chan and Maheu (2002 JBES) to Maheu and McCurdy (2004 Journal of Finance "News Arrival, Jump Dynamics, and Volatility Components for Individual Stock Returns" Vol. 59, pp.755-793.

Ray

Thanks.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Jump GARCH model

Unread post by TomDoan »

Hi Tom,

Can you modify the program of Chan and Maheu (2002 JBES) to Maheu and McCurdy (2004 Journal of Finance "News Arrival, Jump Dynamics, and Volatility Components for Individual Stock Returns" Vol. 59, pp.755-793.

Ray

Thanks.
The only new part of the calculation is that it requires the expected number of jumps given the data. In the calculation below, JP is the unconditional probability of K jumps (without the integrating constant), and %density((u-k*theta)/jsd)/jsd is the P[observed U|K jumps] so the sum of JP * %density(...) across K gives P[data]. The /wt is to allow for the fact that the truncation of the sum at KMAX means that the standard integrating constant (exp(-lambda)) on the Poisson isn't correct. The expected value of k given the data will be the sum of k x P(k|data) which will be the sum of k x P(data|k) x P(k) / P(data).

Code: Select all

function jumpgarchx u h lambda deltasq theta ek
type real jumpgarchx u h lambda deltasq theta *ek
*
local   integer k
local   real    jsd wt jp
*
compute wt=0.0
compute ek=0.0
compute jumpgarchx=0.0
do k=0,kmax
   compute jsd=sqrt(h+k*deltasq)
   compute jp =exp(k*log(lambda)-%lngamma(k+1))
   compute wt =wt+jp
   compute jpu=jp*%density((u-k*theta)/jsd)/jsd
   compute jumpgarchx=jumpgarchx+jpu
   compute ek=ek+k*jpu
end do k
compute ek=ek*jumpgarchx
compute jumpgarchx=log(jumpgarchx/wt)
end jumpgarchx
You would have to save the value of EK into a series and use that in the coefficient on the lag squared residual.
Michelle
Posts: 13
Joined: Sun Oct 25, 2015 10:03 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by Michelle »

Dear Tom,

I would like to do some research using Chan&Maheu, JBES2002(Jump GARCH model) and I would like to do the out-of-sample analysis but don't know how to write the code. Could you please give me some advice.
Thanks a lot.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

In this calculation:

set ustdsq = (u-lambda*theta)^2/(h+lambda*(theta^2+delta^2))

the one-step forecast of the series is lambda*theta and the one step forecast of the variance is the h+lambda*(theta^2+delta^2).
Michelle
Posts: 13
Joined: Sun Oct 25, 2015 10:03 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by Michelle »

Dear Tom,

Thanks for your reply. I was wondering if it is possible to use the command "forecast(model=ARJI,...)" to do the one-step-ahead forecast of the Jump GARCH model.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

No. It has a very specialized formula.
bb_poimot
Posts: 4
Joined: Mon Aug 15, 2016 12:15 am

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by bb_poimot »

Hi, Tom, I noticed that the differences between Chan and Maheau (2002) and Matheu&Mccurdy (2004, JF) also lie in the function g(.), the feedback coefficient from the past return innovations. In the 2004, JF paper, it allows the asymmetric effect from the past news(bad or good). Then how could we realize it in the coding? thanks.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

There's an earlier post that shows how to compute the expected number of jumps:

https://estima.com/forum/viewtopic.php?p=7979#p7979

The change to the GARCH formula is relatively simple given that.
bb_poimot
Posts: 4
Joined: Mon Aug 15, 2016 12:15 am

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by bb_poimot »

TomDoan wrote:There's an earlier post that shows how to compute the expected number of jumps:

https://estima.com/forum/viewtopic.php?p=7979#p7979

The change to the GARCH formula is relatively simple given that.
Hi, Tom, thanks for your reply. I am new to RATs. I can change the GARCH function but I am still not quite clear about how to put the value obtained from one user-defined function into the whole estimation process (particularly the frml hf=omega+alpha*u{1}^2+beta*h{1})? Should I save the jumpgarchx into one separate src or just insert it into the arjigarch.rpf ?

Do you have some link or reference from which I can learn how to use the user-defined function value in frml? Great thanks in advance.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

The use of the source file is to simplify the use of that function, which is needed in both of those programs. If you're just doing a single program, you may not need to strip that out.

The trickiest part about using a function inside a FRML is that, in most cases, it somehow depends upon time "T" information. If possible, it's usually simplest to make the time T references in the FRML rather than the function. For instance, in this:

frml logl = u=uf,h=hf,lambda_t=lambda0,deltasq_t=zeta0^2,theta_t=eta0,$
arjigarch(u,h,lambda_t,deltasq_t,theta_t,xi_t)

all six arguments actually refer to something that depends upon the entry number (U is the current residual, H the current GARCH process variance, etc.) which is what everything on that first line is computing. As long as you're still in the FRML definition, U (if U is a series) means U(T), and same for the other. Thus ARJIGARCH and JUMPGARCH and JUMPGARCHX don't actually need to know what time period they're computing.
Max Resende
Posts: 10
Joined: Wed Mar 13, 2019 1:51 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by Max Resende »

arjigarch_3_RBFin_TESTE.RPF
(11.38 KiB) Downloaded 2200 times
spot_1.txt
Data file
(33.35 KiB) Downloaded 2154 times
To all RATS users,

For quite a while i have been trying to replicate Chan & Maheu, JBES 2002 (ARJI-GARCH model) in order to lear more about extreme events and volatility.

I was able to replicate the model, but now I have been trying to expand it. I am trying to plot jump intensity (lambda_t) and its probability to all the 4 models to analyze then. But i am facing some mistakes that I don't how to corect it. So could you guys help me to graph theses two things for each model.

Thank you all.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

First of all, because you have version 10, you can considerably simplify this by using mapped dates. This is out of a (modernized) version of the Chan-Maheu programs:

*
* The data are daily with holiday skips. This maps the year, month,
* day information to provide the dates.
*
cal(julian=%julianfromymd(year,month,day))
*
set r = 100.0*logret
*
* year:p gives entry <<p>> in the indicated year, so 1930:1 is the
* start of 1930, while 1985:1 is the first in 1985, so subtracting
* one from that gives the last entry in 1984.
*
compute start1930=1930:1,end1984=1985:1-1

For a specific date (rather than the above, which are for the first date and last date in a year), you can just use 2012:6:18 rather than having to find the entry with year(t)=2012..and.month(t)==6.and.day(t)==18.

If you are trying to graph the lambda_t from several different models, you'll have to copy the information to a unique series name for each after you're done with the estimation of it such as

set lambda_simple = lambda_t

after estimating the simple ARJI model.

You have a problem with this, as you are saying vfields=3, but you are including four graphs, so your first pane will be overwritten.

spgraph(vfields=3,footer="Figure 4")
scatter(header="(a) In Sample R",style=lines)
# codeddate r 4 end2014
scatter(header="(b) Lambda",style=lines)
# codeddate lambda_t 4 end2014
scatter(header="(c) Theta",style=lines)
# codeddate theta_t 4 end2014
scatter(header="(c) Delta",style=lines)
# codeddate deltasq_t 4 end2014
* set onestep = sqrt(h+lambda_t*(theta_t^2+deltasq_t))
* scatter(header="(c) One-step-ahead standard deviation",style=lines)
* # codeddate onestep 4 end2014
spgraph(done)

Use GRAPH rather than SCATTER with those (all the way through). The mapped dates will give you the year numbers on the axis.
Max Resende
Posts: 10
Joined: Wed Mar 13, 2019 1:51 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by Max Resende »

Thak you Tom....I was able to imporve my code.....

But i got another issue regardless of my Model ARJI-GARCH: Seems like my estimation has failed.
ARJI-R{1}^2 GARCH - Estimation by BFGS
NO CONVERGENCE IN 9 ITERATIONS. FINAL NORMED GRADIENT 4.22395
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY DIFFERENT SETTING FOR EXACTLINE, DERIVES OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES/PMETHOD OPTION MIGHT ALSO WORK
So, my estimation routine has failed to converge upon an optimum so the parameter estimates and their standard errors may be unreliable.

To solve that issue I tried changing my inicial non-linear parameters values, and that's what I got on my best model.

When I did that,my best results gave me this:
ARJI-GARCH - Estimation by BFGS
Convergence in 5 Iterations. Final criterion was 0.0000000 <= 0.0000100
LOW ITERATION COUNT ON BFGS MAY LEAD TO POOR ESTIMATES FOR STANDARD ERRORS
Then I used different algorithms (BHHH) , but none of that worked so far.

Could you guide me to solve that?

Thank you once again!!!

Max
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Chan & Maheu, JBES 2002 (Jump GARCH model)

Unread post by TomDoan »

Your estimates for the ARJI model are bumping into the time-varying lambda being zero (at which point the likelihood isn't computable). See the analysis in the paper around their equation (11). If you add their sufficient condition for forced positivity (rho>=gamma), it appears to work:

nonlin(parmset=poissonparms) lambda0 rho gamma rho>=gamma
Post Reply