tseries (version 0.1-2)

box.test: Box-Pierce and Box-Ljung Test

Description

If pierce is TRUE, then the Box-Pierce test for examining the null of independence in the time series x is computed. Else the Box-Ljung statistic is computed. Uses lag autocorrelation coefficients for the statistic. Missing values are not handled.

Usage

box.test (x, lag = 1, pierce = TRUE)

Arguments

x
a numeric vector or time series.
lag
a scalar lag parameter.
pierce
a logical indicating whether the Box-Pierce or the Box-Ljung test is computed.

Value

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

References

A. C. Harvey (1993): Time Series Models, 2nd Edition, Harvester Wheatsheaf, NY, pp. 44, 45.

Examples

Run this code
x <- rnorm (100)
box.test (x, lag = 1, pierce = TRUE)

Run the code above in your browser using DataLab