[R] garch prediction

Spencer Graves spencer.graves at pdf.com
Tue Apr 1 03:47:20 CEST 2008


Hi, Yohan:  Please correct any misstatements I make in the the 
following.  Thanks. 


Fernandito: 

      I find it easier to consider a self-contained example, such as the 
following extension of the examples in ?garchFit and ?predict.fGARCH: 

library(fGarch)
spec = garchSpec()
x = garchSim(model = spec at model, n = 500)
fit = garchFit(~garch(1, 1), data = x)
predict(fit)
    meanForecast   meanError standardDeviation
1  -1.267306e-05 0.003268294       0.003116506
2  -1.267306e-05 0.003268294       0.003135122

      I believe that 'meanForecast' is the predicted value for 1, 2, 
etc., time periods in the future, and 'standardDeviation' is the 
predicted standard deviation of residuals from that 'meanForecast'.  
Thus, a 95% confidence (or prediction) interval for future observations 
is given by meanForecast +/- 2*standardDeviation. 

      To check this, I suggest you do two things: 

      (1) Modify the above code so fit = garchFit(~garch(1, 1), data = 
x[1:490]), then compute pred10 = predict(fit) and sRes = (x[491:500] - 
pred10[, 1])/pred10[, 3].  Do this, say, 100 times to produce 1,000 
values for sRes.  The results should be roughly normal with mean 0 and 
standard deviation 1.  If you do this, please report the results to this 
list. 

      (2) Type "predict.fGARCH" at a command prompt to get the code.  If 
you are unsure of what each step does, copy it into a script file, then 
request "debug(predict.fGARCH)", then predict(fit), and work through the 
code line by line until you understand what each line does.  This should 
also tell you what "meanError" is. 

      Hope this helps. 
      Spencer

fernandito wrote:
> Hello
> I want to predict the future values of time series with Garch
> When I specified my model like this:
> library(fGarch)
> ret <- diff(log(x))*100
> fit = garchFit(~arma(1,0,0)+garch(1, 1), data =ret)
> predict(fit, n.ahead = 10)
>
>  meanForecast  meanError standardDeviation
> 1    0.01371299 0.03086350        0.03305819
> 2    0.01211893 0.03094519        0.03350248
> ....................................................................................
>
> I know that if I use fit = garchFit(~garch(1, 1), data =ret) I  got constant
> mean, so trherefore I include amra term to move with mean
>
> Iam not sure what values are hiding in this output.
> 1. Does menForecast hold my future predicted values?
> 2.Or I am able to just compute the confidence intervals for my prediction
> like meanForecast +-2*standardDeviation  ??
> 3Or I need to compute the future values like
> yt=meanForecast+meanError*sqrt(standardDeviation)  ???
> My return looks like standard return series with plus and minus values,
> [748,]  0.008184311  
> [749,]  0.024548914  
> [750,] -0.008182302
>
> so I hope I would get similar prediction to this return, not just a postive
> mean constant.
>
> thanks??
>



More information about the R-help mailing list