Dear Users,

I follow Andreas idea to simulate an ar(1) model with a new kind of innovation 
process.
The new argument rand.gen, for the arima.sim function, I'm trying to generate 
as:

tGarchGen <- function(a, b, c) {
    # must return a vector of random deviates (eta(t))
  for (t in 1:100){
  z(t) <- c+a*(eta(t)^2)+b*z(t-1)
  eta(t) <-rt(100, 5)*sqrt(z(t))  #rt is the R random t-Student generator 
function rt(n,df)
  }
}

arModel <- list(ar=0, ma = 0, order = c(0, 1, 0))
arima.sim(arModel, n = 100, rand.gen = tGarchGen)

But, since I'm a newbie in R, course the loop doesn't work.
Finally, how I do to declare the parameters (a,b,c,n,df), including the loop's 
length in a way I can change it at the beginning of the program?
Any help, please?

Thanks in advance,

Rick
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to