Box.test

0th

Percentile

Box-Pierce and Ljung-Box Tests

Compute the Box--Pierce or Ljung--Box test statistic for examining the null hypothesis of independence in a given time series. These are sometimes known as portmanteau tests.

Keywords
ts
Usage
Box.test(x, lag = 1, type = c("Box-Pierce", "Ljung-Box"), fitdf = 0)
Arguments
x
a numeric vector or univariate time series.
lag
the statistic will be based on lag autocorrelation coefficients.
type
test to be performed: partial matching is used.
fitdf
number of degrees of freedom to be subtracted if x is a series of residuals.
Details

These tests are sometimes applied to the residuals from an 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.

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the test statistic.
  • parameterthe degrees of freedom of the approximate chi-squared distribution of the test statistic (taking fitdf into account.
  • p.valuethe p-value of the test.
  • methoda character string indicating which type of test was performed.
  • data.namea character string giving the name of the data.

Note

Missing values are not handled.

concept

portmanteau

References

Box, G. E. P. and Pierce, D. A. (1970), Distribution of residual correlations in autoregressive-integrated moving average time series models. Journal of the American Statistical Association, 65, 1509--1526.

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.44, 45.

Aliases
  • Box.test
Examples
library(stats) x <- rnorm (100) Box.test (x, lag = 1) Box.test (x, lag = 1, type = "Ljung")
Documentation reproduced from package stats, version 3.3, License: Part of R 3.3

Community examples

Looks like there are no examples yet.