Changing Distribution in MAXIMIZE function

Discussions of ARCH, GARCH, and related models

Changing Distribution in MAXIMIZE function

Postby yukun » Wed Oct 05, 2011 12:57 pm

Dear Tom,

I am trying to use Maximize function to estimate some sepecial forms of GARCH models. I would like to change the distribution from Normal to t distribution or GED, do you know how to change distrubtions in Maximize function? Thank you very much in advance!

Best Regards,

Yukun
yukun
 
Posts: 3
Joined: Wed Oct 05, 2011 11:12 am

Re: Changing Distribution in MAXIMIZE function

Postby TomDoan » Wed Oct 05, 2011 4:08 pm

Use %logtdensity or %loggeddensity rather than %logdensity in the likelihood formula. Both of those have a "shape" parameter. The best idea for estimating that is to initialize that to a value that fattens the tails a bit (10-20 for the t, 2 for the GED).
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Changing Distribution in MAXIMIZE function

Postby yukun » Thu Oct 06, 2011 6:30 am

Here is my code. Could you please show me how to add % loggeddensity in this code?

Code: Select all
OPEN DATA "V:\Chapter2\futures.xls"
DATA(FORMAT=XLS,ORG=COLUMNS) 1 1687 futures Rf

set Y = Rf

COMPUTE GSTART=4, GEND=1687
DECLARE SERIES U   ;* Residuals
DECLARE SERIES H   ;* Variances

set U = 0.0 ;
set H = 1.0  ;


nonlin VC VA VB VD B1 B2 B3 B4     

FRML HF = exp(VC + VA*log(H{1}) + VB*U{1}/sqrt(H{1}) + VD*abs(U{1})/sqrt(H{1}))
FRML RESID = Y - B1 - B2*Y{1}- B3*H - B4*H*Y{1}
FRML LOGL = (H(T)=HF(T)),(U(T)=RESID(T)),-0.5*(LOG(H(T))+U(T)*U(T)/H(T))
LINREG Y 4 1687
# Y{1} H

COMPUTE B1=%BETA(1)
COMPUTE B2=%BETA(2)
Compute B3=0
compute B4=0
compute VC=log(%SEESQ),VA=0.012,VB=0.0801,VD=0.0
nlpar (subiter=500)
maximize(method=simplex, recursive, iterations=50,noprint) LOGL GSTART GEND
maximize(method=BFGS,robust,recursive,iter=500,cvcirt=0.00000000001) LOGL GSTART GEND


Best Regards,

Yukun
yukun
 
Posts: 3
Joined: Wed Oct 05, 2011 11:12 am

Re: Changing Distribution in MAXIMIZE function

Postby TomDoan » Thu Oct 06, 2011 8:15 am

That's really old GARCH code. A more modern way to write:

FRML LOGL = (H(T)=HF(T)),(U(T)=RESID(T)),-0.5*(LOG(H(T))+U(T)*U(T)/H(T))

is

frml logl = h=hf(t),u=resid(t),%logdensity(h,u)

It's the %logdensity that you need to change to %loggeddensity(u,shape,h)

where you want to add SHAPE to your parameter set.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Changing Distribution in MAXIMIZE function

Postby yukun » Thu Oct 06, 2011 10:23 am

Many thanks Tom, I will try this code.
yukun
 
Posts: 3
Joined: Wed Oct 05, 2011 11:12 am

Re: Changing Distribution in MAXIMIZE function

Postby AndresT » Thu Dec 15, 2011 4:48 am

Let's say I would like to evaluate some a bit exotic likelihood functions. Like in this paper:

Volatility Feedback and Risk Premium in GARCH Models with Generalized Hyperbolic Distributions (2011)
at: http://www.bepress.com/snde/vol15/iss3/art6/

Actually I would like to replicate that paper using RATS. (Any insights would be greatly appreciated)

The author provides some code in R, but deals with the likelihood functions by calling them in R from a .dll in fortran.

Would a procedure like that make sense in RATS? such as calling a procedure from a lower level language? Is it possible for an end user?
AndresT
 
Posts: 5
Joined: Fri Apr 01, 2011 1:37 pm

Re: Changing Distribution in MAXIMIZE function

Postby TomDoan » Mon Dec 19, 2011 6:05 pm

The integrating constant on that requires a Bessel function of the 3rd kind, which we haven't yet done in RATS. (We have Bessel functions of the 1st kind).
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm


Return to ARCH and GARCH Models

Who is online

Users browsing this forum: No registered users and 2 guests