I get an inconsistent result for the Ljung-Box test: in fact when I run it using the Box.test function it doesn't make me reject the null hypothesis of residuals being white noise, but when I plot the result they're clearly not white noise. The lag used is 72 because I was told to use a quarter of the total number of observations. I'm doing it with AR(6) because from the PACF there's a clear cutoff after lag 6.
> pacf(ts(gdplogdiff),main="PACF of GDP time series")
> acf(ts(gdplogdiff),main="ACF of GDP time series")
> plot(diff(loggpdtimeseries),ylab="Differentiated log")
> ar6=arima(gdplogdiff,order=c(6,0,0))
> Box.test(ar6$residuals,lag=72,type="Ljung-Box",fitdf = 6)
Box-Ljung test
data: ar6$residuals
X-squared = 75.512, df = 66, p-value = 0.1981
And this is the plot of the following code
acf(ar6$residuals)