Thanks you a lot, however I'm still a little bit confused about hfc equation.
# forecast the variance hfc = a0 + a1 * e(-1)^2 + b1 * hfc(-1)
h_t = omega + alpha (|e_{t-1}| - gamma e_{t-1})^2 + beta h_{t-1}
2012/11/9 Riccardo (Jack) Lucchetti <r.lucchetti@univpm.it>
On Fri, 9 Nov 2012, Marta Szymańska wrote:This should be intended as a reply to Tomasz too.
Hello,
I'm writing a master thesis about volatility forecasting using GARCH and
GJR models (with Normal, stud-t and GED distributions). I need to
prepare out-of-sample forecasting for that models. Thus, I've tried to
prepare scripts using gig package.
Here's a variation on your script that should work as intended:
<hansl>
include gig.gfn
open djclose.gdt
RETURN = ldiff(djclose)series e = model["uhat"]
model = gig_setup(RETURN,1,const)
gig_set_dist(&model, 2)
gig_estimate(&model)
series hfc = model["h"]
matrix coef = model["coeff"]
a0 = coef[2]
a1 = coef[3]
# coef[4] is reserved for the asymmetry coefficient
b1 = coef[5]
# forecast the variance
dataset addobs 50
setobs 5 1980/01/02
series hfc = ok(hfc) ? hfc : a0 + (a1 + b1) * hfc(-1)
smpl 1989/09/1 ;
print hfc --byobs
gnuplot hfc time --time-series --with-lines --output=display
smpl full
</hansl>
A few comments:
* we use djclose in this example so everyone has it.
* gig is an addon, so its "products" are not accessible through "$" variables. Instead, it uses bundles, so you may fetch them by ordinary bundle syntax; see the User's Guide and the gig documentation
* when forecasting the variance, you don't want to use the square of the expectation of e as a predictor of e squared (Jensen's lemma): what you need is a predictor of e^2. If you use the expectation as your predictor, that's precisely what h is. As a consequence, in the simple case of the garch(1,1) model with normal errors, you just forecast h by its past values (for more complicated models, it's not so easy).
--------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
--------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users