# What does the 'ar' parameter in arima.sim represent?

I want to generate a time series that follows an AR(1) process and thus has a certain overall level of autocorrelation.

I'm using the arima.sim function (which is implemented as standard in R).

I thought that for example the following command:

arima.sim(model=list(Ar=-0.5),n=400)


would generate a time series of length 400 and an autocorrelation of -0.5. However, I've noticed that the values you can give to the Ar parameter are not limited to [-1; 1]. For example, you could input 10 000.

Can anyone explain to me what the Ar parameter actually represents? Because it apparently is not a correlation coefficient.

After reading on the internet it seems to me that there's not a lot of information there for people who want to simulate time series data using a model as opposed to people who want to fit data to a model.

The AR parameter is an autoregression parameter, which can certainly be outside the unit interval (yielding rather nonstationary time series).

If you write ar=-0.5 instead of Ar=-0.5 (R is case sensitive!), you will likely get closer to what you are looking for. Try this a couple of times (to account for randomness):

print(acf(arima.sim(model=list(ar=-0.5),n=400)))

• You probably did not mean to have Ar but rather ar in the last line. Commented Oct 21, 2015 at 18:05
• @RichardHardy: duh! Thank you! Wrong copy&paste from my Notepad. Commented Oct 21, 2015 at 21:09

First of all, it should be ar, not Ar. I don't think the values you supplied to Ar are doing anything. It's probably just generating a white noise process.

To answer your question, arima.sim allows you to simulate from an ARMA model, and the inputs are regression coefficients (using ar and ma) corresponding to the model here

https://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model#ARMA_model

You will get an error if the model you specified is not stationary. All of this information is in the help file (type help(arima.sim)).

Generate The Two Time Series Length 999 Fixed random seeds

set.seed(20140625)


Define length of simulation

> N <- 999


Simulate normal random walk

> x <- cumsum(rnorm(N))


Set an initial parameter

> gamma <- 0.7


Get cointegrating series

> y <- gamma * x + rnorm(N)


plot the two series

> plot(x, type='l')
> lines(y,col="green")
> summary(ur.df(x,type="none"))

###############################################
# Augmented Dickey-Fuller Test Unit Root Test #
###############################################

Test regression none

Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
Min      1Q  Median      3Q     Max
-2.9293 -0.6857 -0.0430  0.6568  3.0650

Coefficients:
Estimate Std. Error t value
z.lag.1    -0.002151   0.002995  -0.718
z.diff.lag  0.015978   0.031770   0.503
Pr(>|t|)
z.lag.1       0.473
z.diff.lag    0.615

Residual standard error: 0.9896 on 995 degrees of freedom
Multiple R-squared:  0.0007246, Adjusted R-squared:  -0.001284
F-statistic: 0.3608 on 2 and 995 DF,  p-value: 0.6972

Value of test-statistic is: -0.7182

Critical values for test statistics:
1pct  5pct 10pct
tau1 -2.58 -1.95 -1.62

• It's not clear to me how this addresses the question, which is "Can anyone explain to me what the Ar parameter actually represents?". I understand this may not have been clear from the title, so I have now edited it to reflect that.
– mkt
Commented Jul 31, 2019 at 7:40