I am really confused when reading PACF and ACF plots on a small example dataset I created. I created a vector containing a linear trend (1:100) and added normally distributed numbers to it to include some jitter:
set.seed(12345)
random_component = rnorm(100)
trend = 1:100 + random_component
plot(trend)
I then created the ACF and PACF Functions for the normal data and the data after differenciating. The ACF function for the regular data is slowly decreasing and the PACF function is showing a peak at lag 1 – not surprising this indicates a trend.
par(mfrow=c(2,2))
acf(trend)
pacf(trend)
acf(diff(trend))
pacf(diff(trend))
But here's what I don't understanding: After differenciating the data I assume that I should have removed the trend component and should get PACF and ACF functions with no significant peaks. But both the ACF and PACF function of diff(trend) show multiple significant peaks.
Can anyone give me a hint on this?
Best regards and thanks for your help.
Best Answer
Differencing not only removed the trend but also created a pattern of integrated moving average of order one, MA(1). Your data was generated as
$$ x_t = t + \varepsilon_t $$
where $\varepsilon_t \overset{iid}\sim N(0,1)$.
After differencing that becomes
$$ \Delta x_t = (t+\varepsilon_t)-(t-1+\varepsilon_{t-1}) = 1 + \varepsilon_t-\varepsilon_{t-1}. $$
As @ChristophHanck correctly notes,