This post joins two things that I like: Highcharts and time series. So I had a lot of fun making this minipost to show how an autoregressive process works. Well, let’s remember the structure of an autoregressive process. \(y_t = \varphi\,y_{t-1}+\epsilon_t\), where \(\epsilon_t\) is white noise, i.e., \(\operatorname{cov}(\epsilon_j, \epsilon_i) = 0\) if \(i \neq j\), \(\operatorname{Var}(\epsilon_t) = \sigma^2_\epsilon\), and \(\varphi\) is a real parameter.
Now, let’s see first how white noise looks. The next chart shows the process \(y_t = \epsilon_t\), so if we watch the chart for a moment we’ll notice the process looks like an independent random sequence. There’s no structure of dependence.
The two charts below show autoregressive processes for two distinct values of \(\varphi\). It’s easy to see the difference. In the first process the next value of the series tends to have the same sign as the previous value. In the other process the opposite occurs. That’s the effect of the sign of the parameter.
It’s interesting to note: the two processes are different but they have the same mean and variance. In fact, for a stationary \(AR(1)\) process, \(|\varphi| < 1\),
\[\operatorname{Var}(y_t) = \frac{\sigma_\epsilon^2}{1-\varphi^2}.\]
A later exploration: Simulating and watching autoregressive processes.
References
- Highsoft, 2012. Highcharts 2.3.0 — the charting version used for this reconstruction.
- Kunst, J., 2012. Original simulation code — independent state is retained for each process in this restored version.