Box.test(x, lag = 1, type = c("Box-Pierce", "Ljung-Box"), fitdf = 0)lag autocorrelation
coefficients.x
is a series of residuals."htest" containing the following components:fitdf into account.ARMA(p, q) fit, in which case the references suggest a better
approximation to the null-hypothesis distribution is obtained by
setting fitdf = p+q, provided of course that lag > fitdf.Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time series models. Biometrika 65, 297--303.
Harvey, A. C. (1993)
Time Series Models.
2nd Edition, Harvester Wheatsheaf, NY, pp.
x <- rnorm (100)
Box.test (x, lag = 1)
Box.test (x, lag = 1, type = "Ljung")Run the code above in your browser using DataLab