# R: ACF/PACF plots contradict Breusch-Godfrey test results

I run a linear regression of y on x and test the residuals for serial correlation. The Breusch-Godfrey test has us conclude that we fail to reject the null hypothesis that each of the autocorrelations of order 1-20 is 0. Or put simply, the residuals are not serially correlated.

    library(lmtest)
library(forecast)
set.seed(5)
par(mfrow=c(1,3))

n=1000
y<-rep((1:10)/10,n/10)+rnorm(n)
x<-runif(n)

#Breusch-Godfrey test
lmtest::bgtest(lm(y~x),order=20,fill=NA)
reg<-lm(y~x)

plot(reg$$residuals,type="l",ylim=c(-10,10)) forecast::Acf(reg$$residuals,type="correlation",
lwd=2,xlab="",main="",lag.max = 20)
forecast::Acf(reg$residuals,type="partial", lwd=2,xlab="",main="",lag.max = 20)  I expect to see the same conclusion visually in some ACF/PACF plot. The ACF/PACF plots I have below each show a bar extend beyond the dashed bands, suggesting that the residuals ARE serially correlated. How do I reconcile the ACF/PACF plots to the results of the Breusch-Godfrey test? What I care about here is: 1) to confirm that the Breusch-Godfrey is giving us the correct conclusion, and 2) to draw ACF/PACF plots that would agree with the Breusch-Godfrey test results. ## 1 Answer Breusch-Godfrey is a portmanteau-type test; it looks at all lags up to 20 (or whatever maximum lag order you choose). Now, the ACF shows that autocorrelation is statistically significant only for one lag among the first 20 (a single bar sticks out from the confidence bound). This is exactly what you would expect under the null hypothesis of no autocorrelation at any lag tested at 5% level; on average, a single bar out of 20 would stick out purely by chance. Hence, there is no contradiction between the ACF and the Breusch-Godfrey test. One could also say that there is an approximate sine pattern in the ACF. If your series were longer and the autocorrelations were estimated with greater precision, you could try out a parsimonious seasonal ARMA model to account for them. But given the estimation precision that you have, there is hardly any need to worry about these autocorrelations. • Thank you, Richard. I am digesting it. Some clarification. If the bands were drawn at 0.05, it looks like 2 (maybe even 3) out of 20 bands would stick out. If all the autocorrelations (up to order 20) were 0, there is a very high probability (0.5057) of observing an LM statistic as extreme as the one in the sample. I am comfortable with that part. I am just not clear given that portmanteau test result, what I'd expect the individual t tests in the ACF plot to look like. Aug 27, 2021 at 18:37 • That we want a portmanteau test is the most important aspect here. And you made that clear. The Ljung-Box p-value is 0.373, bolstering the conclusion of the BG test. Aug 27, 2021 at 19:16 • @ColorStatistics, I am not sure I get your question. I think the result of the BG test and the ACF match nicely. Given the BG result, the ACF looks like you would expect it to look. If$H_0$holds, the size of the bars in the ACF plot relative to the confidence bounds is fairly average ($p\$-value of about 50%). Aug 27, 2021 at 19:28
• I think what I am dancing around is that we wouldn't use the ACF plot alone to decide whether the residuals are correlated as it wouldn't be a clear cut decision given that what we're really interested is to test whether all those coefficients, collectively, equal 0 Aug 27, 2021 at 19:51
• @ColorStatistics, well, I think the ACF plot is more informative than a single test statistic. I think with some experience one may get out more of the former. Aug 28, 2021 at 6:52