Hi all,
I got the daily stock return data from 2005 - 2008, calculated from HF
minute data. (Thanks to Jeff and Josh).
Now, I set 05 - 07yr as the carlibration period for estimating the
parameters of ARMA(1,1)-GARCH(1,1) model, aqnd leave 08 for backtesting.
So I use the return data observations from 1:760 (yr 05-07) to
estimate the volatility on 2nd-Jan-08 (the position 761),
then use the return data from 1:761 to estimate the vol on 3rd-Jan-08...
1:762...
1:763....
...
...
and so on...
My codes are as follow:
start=length(AA.day.rn['2005-01::2007-12'])
end = length(AA.day.rn)
AA.day.forecast.data = array(0, dim=(end-start))
for (i in start:end) {
garch.fit <- garchFit(formula = ~arma(1,1)+garch(1,1), data =
AA.day.rn[1:i])
garch.pred <- predict(garch.fit, n.ahead=1)
AA.day.forecast.data = garch.pred[,1]
}
Following my design, there should be 193 forecast data, however, when
I checked the object "AA.day.forecast.data", it gives the whole length
of the original data( 953 observations).....
Also, I am not too sure that after the loop function of garch.fit,
will garch.pred catch the right estimation result?
Many thanks.
Mam
P.S Sample data AA.day.rn is attached with this email.
------------------------------------------------------------------------