# [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

in Economics for originating the model (without
the "G" for generalized).

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+a*x[i-1]^2+a*x[i-2]^2 + b * 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.0-a-a)))
>for(i in 3:n)  # Generate ARCH(2) process
>{
>  x[i] <- e[i]*sqrt(a+a*x[i-1]^2+a*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
>
>
>
>

```