# Understanding the blue dotted lines in an ACF from R

I'm having a bit of trouble understanding the blue dotted lines in the following picture of autocorrelation function: Could someone give me a simple explanation, what they are telling me?

The lines give the values beyond which the autocorrelations are (statistically) significantly different from zero. Your ACF seems to indicate seasonality. I recommend Forecasting: Principles and Practice by Hyndman & Athanasopoulos, which is freely available online. (You can also buy a paper version.)

This section, in particular, gives details on the blue lines:

For white noise series, we expect each autocorrelation to be close to zero. Of course, they will not be exactly equal to zero as there is some random variation. For a white noise series, we expect 95% of the spikes in the ACF to lie within ±2/√T where T is the length of the time series. It is common to plot these bounds on a graph of the ACF (the blue dashed lines above). If one or more large spikes are outside these bounds, or if substantially more than 5% of spikes are outside these bounds, then the series is probably not white noise.

• @pidosaurus: good point, I should have noted the actual title of the book. I have edited my answer to include it. The entire otexts.com website seems to be down. Please just check back later - the book was online just a day ago, and I know the authors are working on the 2nd edition, so I'm sure it will come back - and the book is truly highly recommended. May 23, 2017 at 18:09
• @pidosaurus: thanks for catching & editing that! Seems like I made an error in typing in the URL. (Makes me wonder how I got six upvotes before someone noticed...) May 23, 2017 at 20:59
• See this question for details on how the confidence band is actually calculated. Nov 17, 2017 at 21:33

It looks like seasonality (of length 18 periods) and a longer cyclical term of about 6 seasonal intervals.

It might also be caused by an actual periodic function

What does the PACF or IACF look like?

Edit: The plot looks to be one generated in R; the blue dashed lines represent an approximate confidence interval for what is produced by white noise, by default a 95% interval

• I took the picture from a book and there isn't PACF given...but I'm only interested on the blue dotted line :) Thank you Feb 8, 2013 at 11:43
• You can get (a little) more information from the help for the function plot.acf under the entries for things with ci in their name under Arguments, as well as the whole of the Note section - find that help page here Feb 8, 2013 at 22:41

They are telling you whether the correlation at that lag is significant. Imagine if you have your samples all independent in the time series (which is the null hypothesis), the correlation at that lag will be calculated as

$$var( Corr(x, y) ) = var( \frac{Cov(x, y)}{\sigma_x * \sigma_y} ) = var( \frac{\mu_{xy}- \mu_x * \mu_y}{\sigma_x * \sigma_y} ) = var( \frac{\mu_{xy}}{\sigma_x * \sigma_y} ) = \frac{ (\mu_x^2 + \sigma_x^2)*(\mu_y^2 + \sigma_y^2) - \mu_x^2 * \mu_y^2}{n * \sigma_x^2 * \sigma_y^2}$$

When $$x$$ and $$y$$ are with mean 0, you get $$var( Corr(x, y) ) = 1/n$$.

Thus, if you are looking for the 95% confidence interval, you have $$[ -1.96/\sqrt{n}, +1.96/\sqrt{n} ]$$.

I agree with all the other answers here, but there's one additional thing that I think is important to keep in mind when looking at these plots: lack of significance is not necessarily very strong evidence of no autocorrelation structure. In other words, just because none of the vertical bars cross the blue lines doesn't make it certain that you are looking at a white noise series.

This is always true in hypothesis testing: if you fail to reject the null (in this case, that the series is white noise), you are not justified in taking that as evidence for the null. The blue bars show values that are compatible with the null, but they could also be compatible with many alternative hypotheses.

You can convince yourself of this with simple simulations: here we simulate from a known MA(1) model. We know that the true model has an ACF value of 0.6 at lag = 1. However, in a small-ish sample, the sample estimate may be off by quite a bit.

The plot below shows that the ACF value at lag = 1 is not significant. However, we should not take this as definitive evidence against an MA structure. In this case, we know that that is the true model.

library(forecast)

set.seed(2021)

series_length <- 25
ma_coefficient <- .6

# Simulate from a known MA(1) model.
# We know that the true model would have an ACF value of ma_coefficient
#   at lag = 1
y <- arima.sim(series_length,
model = list(ma = ma_coefficient))

# See plot below. ACF value at lag = 1 is not significant.
# However, we should not take this as definitive evidence against
# an MA structure. In this case, we *know* that that is the true model.
acf(y) 