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

Adrian Trapletti a.trapletti at bluewin.ch
Thu Nov 27 13:56:08 CET 2003


>
>
>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) ?
>
>  
>
GARCH(1,1) something like

n <- 1100
a <- c(0.1, 0.2, 0.7)

e <- rnorm(n) 
x <- double(n)
v <- double(n)

v[1] <- a[1]/(1.0-a[2]-a[3])
x[1] <- rnorm(1, sd = sqrt(v[1]))

for(i in 2:n) {
    v[i] <- a[1]+a[2]*x[i-1]^2+a[3]*v[i-1]
    x[i] <- e[i]*sqrt(v[i])
}

x <- ts(x[101:1100])
x.garch <- garch(x, order = c(1,1))
summary(x.garch)

and accordingly the GARCH(1,2)

best
Adrian

-- 
Dr. Adrian Trapletti
Trapletti Statistical Computing
Wildsbergstrasse 31, 8610 Uster
Switzerland
Phone & Fax : +41 (0) 1 994 5631
Mobile : +41 (0) 76 370 5631
Email : mailto:a.trapletti at bluewin.ch
WWW : http://trapletti.homelinux.com




More information about the R-help mailing list