I'm going through the book 'Introductory Time Series with R' by Cowpertwait and Metcalfe. On page 36 Its says the lines are at: $-1/n \pm 2/\sqrt{n}$. I've read here R forum that the lines are at $\pm 1.96/\sqrt{n}$.
I ran the following code :
b = c(3,1,4,1) acf(b) and I see that the lines look to appear to be at $\pm 1.96/\sqrt{4}$. So, obviously the book is wrong? Or, Am I misreading what has been written? Are the authors talking about something slightly different?
*Note, I'm not interested in the 1.96 vs 2 minor detail discrepancy. I assume this was just the author using the rule of thumb of 2 sd's versus the actual 1.96 sd.
Edit: I ran this simulation:
acf1 = 0 acf2 = 0 acf3 = 0 for(i in 1:5000){ resids= runif(1000) residsacf = c(acf(resids,plot= FALSE)) acf1[i] = residsacf$acf[2,,1] acf2[i] = residsacf$acf[3,,1] acf3[i] = residsacf$acf[4,,1] } meanacf1 = mean(acf1) meanacf2 = mean(acf2) meanacf3 = mean(acf3) meanacf1 meanacf2 meanacf3 I always seem to get values near $1/n$ for all 3.
Further edit : I'm seeing a trend of $1/n-(k-1)/n^2$