Changing Distribution in MAXIMIZE function
Changing Distribution in MAXIMIZE function
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
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
Re: Changing Distribution in MAXIMIZE function
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).
Re: Changing Distribution in MAXIMIZE function
Here is my code. Could you please show me how to add % loggeddensity in this code?
Best Regards,
Yukun
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 GENDYukun
Re: Changing Distribution in MAXIMIZE function
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.
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.
Re: Changing Distribution in MAXIMIZE function
Many thanks Tom, I will try this code.
Re: Changing Distribution in MAXIMIZE function
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?
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?
Re: Changing Distribution in MAXIMIZE function
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).