[R] AR(1) with an error term arima.sim parameter question

Michael Selevan mselevan at gmail.com
Wed Dec 10 08:21:57 CET 2014


Hello,

I am attempting to plot an AR(1) model with a standard deviation and I am a
little confused as how to do that. I have been looking through the
interwebs and some documentation and I see that there is potentially a few
different ways to do this.

First, simply using the documentation I came up with the command

arima.sim(n=10, list(ar=0.8), innov=rnorm(10, sd=0.2))

which would give me the standard deviation I want. Or I believe that to be
the case. However, after some more searching and googling, I saw an example
where someone used this as a means of adding the AR error term

error.model=function(n){rnorm(n, sd=0.2)}

y = arima.sim(n=10, list(ar=0.8), innov=rnorm(10, sd=0.2), rand.gen=
error.model)
Now, I am a little confused by this. Would having the error term in the
innov parameter as well as the rand.gen be redundant? What would be the
expected differences between the two? Should only 1 be used?

Just looking for some clarification. Been searching and havent found too
many examples that explicitly state how to add the error term to an AR(1)
model.

Thanks in advance!


-- 
J. Michael Selevan

	[[alternative HTML version deleted]]



More information about the R-help mailing list