I'm pretty new to R and I have created the following code which is based on a function that is used to simulate 1100 data points and then removes the first 100 points to get a total of 1000 data points.
My next goal is to be able to repeat this process 250 times so I have 250 simulations each with 1000 data points. I'm thinking that another for statement would work but I am not 100% sure how I would set up the iteration process for a loop within a loop.
I've provided my sample code below that produces 1000 observations.
Thank you for the help.
e<-rnorm(1100, mean=0, sd=0.2) # sd=0.2 is the default used in the paper.
Y_t=c(0,0)
for (i in 3:length(e)){
f1<- 0.138+(0.316+0.982*Y_t[i-1])*exp(-3.89*(Y_t[i-1])^2)
f2<- -0.437-(0.659+1260*Y_t[i-1])*exp(-3.89*(Y_t[i-1])^2)
Y_t[i]<-f1*Y_t[i-1]+f2*Y_t[i-2]+e[i]
}
Y_t<-Y_t[101:1100] # Remove the first 100 observations