M. M. Palhoto N. Rodrigues
2003-Nov-27 10:11 UTC
[R] would like to know how to simulated a GARCH(1,2)
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]]
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 > > > >
Adrian Trapletti
2003-Nov-27 12:56 UTC
[R] would like to know how to simulated a GARCH(1,2)
> > >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