1
$\begingroup$

I am trying to get my head around simple time series analysis. I think this R code shows my confusion.

### simulating lag1 autoregressive process
library(dplyr)
library(ggplot2)
library(GGally)
set.seed(12345)
n <- 1000
divisor <- 2 # how much less variance to give the lag1 variance contribution to tmp3
tmp1 <- rnorm(n)  # base data
tmp2 <- dplyr::lag(tmp1, n = 1) # lag1 component
tmp <- tmp1 + tmp2/divisor
tmp <- na.omit(tmp)
tmpDF <- as.data.frame(cbind(tmp,
                             dplyr::lag(tmp, n = 1),
                             dplyr::lag(tmp, n = 2),
                             dplyr::lag(tmp, n = 3),
                             dplyr::lag(tmp, n = 4)))
colnames(tmpDF) <- c("tmp","lag1","lag2","lag3","lag4")
ggpairs(tmpDF)
acf(tmp, lag.max = 10)
pacf(tmp, lag.max = 10)

That generates this ACF plot:

ACF plot

Which is pretty much what I'd expect. However it gives this PACF:

PACF plot

Thinking about that ACF plot made me realise that what I had there wasn't a typical autocorrelation process but the simple addition of a lag1 component to data, not the same thing! Oops. OK. I think this, though probably clumsy is a true lag1 autocorrelation process:

tmpDF <- as.data.frame(cbind(tmp,
                             dplyr::lag(tmp, n = 1),
                             dplyr::lag(tmp, n = 2),
                             dplyr::lag(tmp, n = 3),
                             dplyr::lag(tmp, n = 4)))
colnames(tmpDF) <- c("tmp","lag1","lag2","lag3","lag4")
ggpairs(tmpDF)
acf(tmp, lag.max = 10)
pacf(tmp, lag.max = 10)

And that generates this ACF plot with the decreasing later correlations I had expected.

ACF plot of true lag1 autocorrelation

and this PACF plot.

enter image description here

OK, that's what I expected so I've answered part of my own question but can anyone explain to me why I get those sequential and "significant" partial autocorrelations in the first example?

TIA,

Chris

$\endgroup$
1
  • $\begingroup$ If you've found the answer by Matthew helpful, please don't to forget to upvote and accept it - it seems a lot of effort went into it. $\endgroup$ May 29, 2019 at 12:40

1 Answer 1

4
$\begingroup$

One way to interpret what's going on here is the equivalence of an MA(1) to an AR($\infty$). Reflecting the MA representation, the ACF goes to 0 after 1 lag. Reflecting the AR representation, PACF (speaking loosely) has non-zero terms out to $\infty$.

Moving average order 1 is equivalent to an auto-regressive order $\infty$

You have created an MA(1) model which is equivalent to an AR($\infty$) model. Your model is:

$$y_t = \epsilon_t + \frac{1}{2} \epsilon_{t-1} $$

Using the lag operator, you can write this as:

$$ y_t = \left( 1 + \frac{1}{2} L \right) \epsilon_t $$

You can show this is invertible since $\left|\frac{1}{2}\right| < 1$ hence:

$$ \left(1 + \frac{1}{2} L \right)^{-1} y_t = \epsilon_t $$

As I discuss in this answer, this gives you $\sum_{j=0}^\infty \left(-\frac{1}{2} \right)^j y_{t-j} = \epsilon_t $.

\begin{align*} y_t - \frac{1}{2} y_{t-1} + \frac{1}{4} y_{t-2} - \frac{1}{8} y_{t-3} + \ldots &= \epsilon_t \end{align*}

From the MA representation, you can easily compute the autocorrelation function:

$$ \rho(k) = \left\{ \begin{array}{rr} 1 & \text{ for }k = 0 \\ \frac{1}{2} & \text{ for } k = 1 \\ 0 & \text{otherwise}\end{array}\right. $$

The the slowly tailing off partial autocorrelation reflects the infinite order AR representation. Based on answers here and here, you'll find the PACF for $k\geq 1$ is:

$$ \alpha(k) = \frac{\left( \frac{1}{2}\right)^k(-1)^{k+1}}{\sum_{j=0}^k \left(\frac{1}{2}\right)^{2j}} $$

$\endgroup$
1
  • $\begingroup$ Many thanks. You are brilliantly underlining that if I am to understand this properly then I have to do some serious revising of my algebra and maths (last taught to me 44 years ago!) You have certainly given me that and all the links so I have a great launch platform. Huge gratitude and kudos for this. $\endgroup$
    – cpsyctc
    May 25, 2019 at 9:27

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.