Reputation: 155
I wish to generate an AR(3) model with parameters (3,0,5) for each of the phi's. This is non-stationary and arima.sim gives the error
Error in arima.sim(model = list(ar = c(3, 0, 5)), n = 50) :'ar' part of
model is not stationary
Is there a way this can be done in R?
Upvotes: 1
Views: 2754
Reputation: 613
What process variance (SD) did you want to use? If unspecified, arima.sim()
will use a default of 1 so I'll assume that's also the case you want here.
# empty vector for process
xx <- vector("numeric",50)
# innovations (process errors)
ww <- rnorm(50)
# set first 3 times to innovations
xx[1:3] <- ww[1:3]
# simulate AR(3)
for(t in 4:50) { xx[t] <- 3*xx[t-1] + 5*xx[t-3] + ww[t] }
If you don't want Gaussian errors, replace ww
with some other distribution.
Upvotes: 3