I am new to R. I wanted to create an ARIMA(1,0,0) model which simulates data with the coefficient been 0.1. I used the following code:

## list description for AR(1) model with small coef
AR.sm <- list(order=c(1,0,0), ar=0.1, sd=0.0001)

## simulate AR(1)
AR1.sm <- arima.sim(n=50, model=AR.sm)

## setup plot region
## get y-limits for common plots
ylm <- c(min(AR1.sm), max(AR1.sm))

## plot the ts
plot.ts(AR1.sm, ylim=ylm,
        main=expression(paste(phi," = 0.1")))


The std and mean of the data is:

[1] "Mean: 0.202367015812633"
[1] "Std: 1.03631583857173"

The problem is, no matter what I assign to the sd parameter (0.1, 1, 10), the standard deviation that is computed in the last line is about 1.
Why is it like this?


1 Answer 1


It looks like sd is not part of model but needs to be specified separately. The following does what you want:

AR.sm <- list(order=c(1,0,0), ar=0.1)
AR1.sm <- arima.sim(n=50, model=AR.sm, sd=0.0001)

I got this idea from the examples in the help file of arima.sim:

arima.sim(n = 63, list(ar = c(0.8897, -0.4858), ma = c(-0.2279, 0.2488)), sd = sqrt(0.1796))

As you can see, sd is outside of the parenthesis of the model part.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.