# Intuition for auto-correlation for mean reverting process

How should my auto-correlation plot look like for a mean reverting process? From what I have recently learned, auto-correlation should be low and should decay fast enough. But when I run the following command in R

acf(sin(1:100)) #mean reverting process


I see that auto-correlation is very different from zero and intuitively makes a lot of sense, when values are high it becomes negative and when values are low it becomes positive. So I'm confused which one is correct: zero auto-correlation or similar profile as above.

First, $y(t) = sin(t)$ is not a mean reverting process. It appears as mean reverting process at discrete sampling $t_i=i$, but it is not. Think of this $E[y(t)]=sin(t)$, i.e. your mean is not reverting anywhere it is exactly $sin(t)$ and it's time varying.

You get mean reversion when there are random shocks, and something pulls your process back to the mean.

For instance, consider this process: $$y(t)=y(t-\Delta t)+\theta\cdot\left(sin(t)-y(t-\Delta t)\right)+\varepsilon(t)$$ When $y(t-\Delta t)$ was below its time varying mean $sin(t)$ something pushes it upwards at speed $\theta$. In other words, $y(t)$ is reverting to its mean.

Secondly, mean reverting processes are often modeled as ARMA(p,q) processes. AR(p) process will shows exponential decay in modulus of ACF. One could interpret your ACF as such, where the decay is very slow (in absolute value of lag coefficients). The partial ACF or PACF is cut off at lag p for AR(p) process.

MA(q) process is exactly the opposite: PACF exponentially decays, while ACF cuts of at q lags.

ARMA(p,q) has ACF and PACF oscillating. You ACF looks not unlike such.

What you have probably learned is that the autocorrelation function (ACF) of a stationary autoregressive (AR) process decays relatively fast towards zero. But this does not mean that the ACF of any stationary process takes this shape. For example, the ACF of a moving-average process of order $q$ is truncated at lag $q$.

You found another stationary process for which the ACF does not follow a fast decaying pattern. The sine wave that represents your process is stationary because the joint probability distribution does not change over time (i.e., if we take blocks of length, say, 10 observations at different points of the sample, the mean, variance and other moments remain constant across these blocks).

Interestingly, the sine wave can be approximated by a stationary AR process of order 2. For example, an AR(2) process with coefficients 1 and -0.9 generates a cycle of period 6 observations with damping factor $\sqrt 0.9 = 0.95$, i.e., relatively persistent. The theoretical ACF of this process is shown below. The ACF exhibits a periodic pattern. Observe that this AR process is stationary since all the roots lie outside the unit circle.

R code that reproduces the figure above:

arcoefs <- c(1, -0.9)
acf <- c(arcoefs[1]/(1-arcoefs[2]), arcoefs[1]^2/(1-arcoefs[2])+arcoefs[2])
for (i in seq_len(20))
acf <- c(acf, arcoefs[1]*acf[1+i] + arcoefs[2]*acf[i])
acf <- c(1, acf)
plot(c(seq(0, length(acf)-1)), acf, type="h", xlab = "Lag", ylab = "acf",
main = "Theoretical ACF of the AR(2) process")
abline(h = 0, lty = 3)
min(Mod(polyroot(c(1, -arcoefs))))
Mod(polyroot(c(1, -arcoefs))) # roots outside the unit circle
#[1] 1.054093 1.054093
# ACF for simulated data (instead of the theoretical ACF)
acf(arima.sim(n=200, model=list(ar=arcoefs)))