Thank you Mat.

That works. I also double-checked manually with different estimation period.

Cheers
Michael

On 14 May 2010 07:50, Matthieu Stigler <matthieu.stigler@gmail.com> wrote:

> Should "AA.day.forecast.data" contain the series oh one step ahead
> forecasts? If yes, you need to index it also!
>
> AA.day.forecast.data[i-start+1] <- garch.pred[,1]
>
> Btw, if you are doing it with a loop, you might have a look on package
> foreach, which is likely to make your loop contruction easier, and
> especially can run it easily on parallel cores...
>
> Mat
>
> PS: try when posting to give a code fully reproducible!
>
> mam3xs a écrit :
>
>> 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.
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> R-SIG-Finance@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>
>

	[[alternative HTML version deleted]]

