# Difference between functions filter() and arima.sim()

I want to simulate this AR process $$X_t=0.7X_{t-1}+\varepsilon_t$$

What is the difference between functions filter() and arima.sim()?

For example this code:

set.seed(154)
w = rnorm(500,0,1)
x=filter(w, filter=c(.7), method="recursive")


and this code

set.seed(154)
xarima=arima.sim(n=500, list(ar=c(0.7)), sd=1)

• arma.sim is not part of base R. What package is it in? What does its manual page say that it does? – whuber Mar 11 '16 at 16:04
• @whuber I think that's a typo, the code block shows use of arima.sim() and the arguments are what i would expect for that function. – Gavin Simpson Mar 11 '16 at 16:31
• it is in the stats package – user44677 Mar 11 '16 at 17:10