Solved – Variance of a smoothed AR(1) process

autoregressivesmoothingvariance

The query I have relates to calculating the variance of AR(1) processes that are smoothed with a simple moving average. So:

In an AR(1) process of the form:

$$ X_t=c+\varphi X_{t-1}+\varepsilon_t, $$

the variance can be calculated as:

$$ \text{var}(X_t)=E(X^2_t)-\mu^2=\frac{\sigma^2_{\varepsilon}}{1-\varphi^2}, $$

where $\sigma$ is the standard deviation of $\varepsilon$ (a white noise), and $\varphi$ is the variable defining the autocorrelation properties of the AR(1) process.

I would like to be able to calculate the variance of the AR(1) process after smoothing by a simple unweighted moving average for various window sizes. I have thus far looked at the problem analytically with data, and as the window size of the moving average increases the variance obviously falls, and the way in which it falls (i.e. rate and shape) is dependent on $\varphi$. Clearly, when the moving average window is equal to $N$ (the size of the dataset analysed) then the variance is 0.

Ultimately therefore, is there a way of determining the expected variance of the AR(1) in terms of $\varphi$, $N$, and the size of the moving average window?

Best Answer

Let us rewrite $x_t, x_{t-1}, \dots, x_{t-K+1}$ in terms of $x_{t-K}$

$$x_t=c\left(1+\varphi+\dots+\varphi^{K-1}\right)+\varepsilon_t+\varphi\varepsilon_{t-1}+\dots+\varphi^{K-1}\varepsilon_{t-K+1}+\varphi^Kx_{t-K}$$

$$x_{t-1}=c\left(1+\varphi+\dots+\varphi^{K-2}\right)+\varepsilon_{t-1}+\varphi\varepsilon_{t-2}+\dots+\varphi^{K-2}\varepsilon_{t-K+1}+\varphi^{K-1}x_{t-K}$$ $$\dots$$ $$x_{t-K+1}=c+\varphi x_{t-K}+\varepsilon_{t-K+1}$$

Then we denote a moving average process of $x_t$ of window $K$ as $\tilde{x}_{t}^K$ and have the following

$$\tilde{x}_t^K=\frac{1}{K}\left[\sum_{i=0}^{K-1}\left(c(K-i)\varphi^i+\varepsilon_{t-i}\sum_{j=0}^i\varphi^j\right)+x_{t-K}\sum_{i=1}^K\varphi^i\right]$$

$$\begin{align} \operatorname{\mathbb{V}ar}\left(\tilde{x}^K_t\right) &= \frac{1}{K^2}\left[\operatorname{\mathbb{V}ar}\left(\sum_{i=0}^{K-1}\varepsilon_{t-i}\sum_{j=0}^i\varphi^j\right)+\operatorname{\mathbb{V}ar}\left(x_{t-K}\sum_{i=1}^K\varphi^i\right)\right]\\ &= \frac{1}{K^2}\left[\sigma^2_{\varepsilon}\sum^{K-1}_{i=0}\left(\frac{\varphi^{i+1}-1}{\varphi-1}\right)^2+\frac{\sigma^2_{\varepsilon}}{1-\varphi^2}\left(\frac{\varphi^{K+1}-\varphi}{\varphi-1}\right)^2\right]\\ &=\frac{\sigma^2_{\varepsilon}}{K^2}\left[\frac{1}{(\varphi-1)^2}\sum^{K-1}_{i=0}\left(\varphi^{i+1}-1\right)^2+\frac{\varphi^2(\varphi^K-1)^2}{(1-\varphi)^2(1-\varphi^2)}\right] \end{align}$$

and some more algebra leads to..

$$\operatorname{\mathbb{V}ar}\left(\tilde{x}^K_t\right)=\frac{\sigma^2_{\varepsilon}\left(\varphi^2(K\varphi-K+2)-2\varphi^{1+K}(\varphi-1)+K-\varphi(K+2)\right)}{(1+\varphi)(1-\varphi)^4K^2}$$

sigma <- 2.5
phi <- 0.6
K <- 3
const <- 2

set.seed(321)
eps <- rnorm(1e5, sd = sigma)
x <- filter(c(0, const + eps), filter = phi, method = "recursive")

MAvar <- function(phi, sigma, K)
  sigma^2 / (K^2 * (phi + 1) * (1 - phi)^4) * 
  (phi^2 * (K * phi - K + 2) - 2 * phi^(1 + K) * (phi - 1) + K - phi * (K + 2))

library(zoo)
ma <- rollmean(x, K)

var(ma)
# [1] 6.67111
MAvar(phi, sigma, K)
# [1] 6.640625