[R] would like to know how to simulated a GARCH(1,2)

Patrick Burns pburns at pburns.seanet.com
Thu Nov 27 12:19:46 CET 2003


Prelude for those not in the know:

GARCH models the variance of a times series
conditional on past information (often only the
series itself).  It is a reasonably good model of
the variance of the returns of market-priced
assets, which display big jumps upwards in
variance followed by gradual decays.

Rob Engle is just about to receive the Nobel Prize
in Economics for originating the model (without
the "G" for generalized).

The Answer:

You need to create a vector of conditional variances,
traditionally called "h".  So at the start you will have an
extra line:

h <- double(n)

in the for loop you will have:

h[i] <- a[1]+a[2]*x[i-1]^2+a[3]*x[i-2]^2 + b[1] * h[i-1]
x[i] <- e[i] * sqrt(h[i])

This leaves just one (I think) detail:

What is the initial value of h? This will depend on what you
are doing.  If you are simulating into the future, then you
want to use the (conditional) variance for the present.
Other choices can be the observed unconditional variance
and a random selection from the estimated conditional
variances that are observed.

Patrick Burns

Burns Statistics
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

M. M. Palhoto N. Rodrigues wrote:

>Follow the example in tseries, we can simulated a GARCH(0,2),  
>n <- 1100
>a <- c(0.1, 0.5, 0.2)  # ARCH(2) coefficients
>e <- rnorm(n)  
>x <- double(n)
>x[1:2] <- rnorm(2, sd = sqrt(a[1]/(1.0-a[2]-a[3]))) 
>for(i in 3:n)  # Generate ARCH(2) process
>{
>  x[i] <- e[i]*sqrt(a[1]+a[2]*x[i-1]^2+a[3]*x[i-2]^2)
>}
>x <- ts(x[101:1100])
>and x is a GARCH(0,2).
>But, I would like to know how to simulated a GARCH(1,2) ?
>
>
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>
>  
>




More information about the R-help mailing list