Learn R Programming

caschrono (version 2.4)

Box.test.2: Portemanteau tests

Description

Box.test.2 computes at different lags, a Portemanteau statistic for testing that a time series is a white noise.

Usage

Box.test.2(x, nlag, type = c("Box-Pierce", "Ljung-Box"), fitdf = 0, decim = 8)

Value

It returns a matrix of size nlag x 2 with the statistics and the p-value

Arguments

x

a time series object

nlag

a vector of integers: the lags where the statistic are computed

type

test to be performed

fitdf

number of degrees of freedom to be subtracted if x is a series of residuals

decim

an integer, the precision of the results

Author

Yves Aragon

Details

This function uses the Box.test.

Examples

Run this code
set.seed(123)
y1 <- arima.sim(n = 100, list(ar = -.7), sd = sqrt(4))
a1 <- Box.test.2(y1, nlag = c(3, 6, 9, 12), type = "Ljung-Box", decim = 4)

Run the code above in your browser using DataLab