Hi all,<br><br>I got the daily stock return data from 2005 - 2008, calculated from HF minute data. (Thanks to Jeff and Josh).<br><br>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.<br>
<br>So I use the return data observations from 1:760 (yr 05-07) to estimate the volatility on 2nd-Jan-08 (the position 761), <br>then use the return data from 1:761 to estimate the vol on 3rd-Jan-08...<br>1:762...<br>1:763....<br>
...<br>...<br>and so on...<br><br>My codes are as follow:<br><br>start=length(AA.day.rn['2005-01::2007-12'])<br>end = length(AA.day.rn)<br><br>AA.day.forecast.data = array(0, dim=(end-start))<br><br>for (i in start:end) {<br>
<br> garch.fit <- garchFit(formula = ~arma(1,1)+garch(1,1), data = AA.day.rn[1:i])<br> garch.pred <- predict(garch.fit, n.ahead=1)<br> AA.day.forecast.data = garch.pred[,1]<br><br>}<br><br><br>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).....<br>
Also, I am not too sure that after the loop function of garch.fit, will garch.pred catch the right estimation result?<br><br>Many thanks.<br>Mam<br><br>P.S Sample data AA.day.rn is attached with this email.<br>