Re: [R] garch prediction

From: Spencer Graves <>
Date: Mon, 31 Mar 2008 18:47:20 -0700

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


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

spec = garchSpec()
x = garchSim(model = spec_at_model, n = 500) fit = garchFit(~garch(1, 1), data = x)

    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. 

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??
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 Apr 2008 - 01:56:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Apr 2008 - 08:30:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive