Learn R Programming

TSA (version 0.99)

LB.test: Portmanteau Tests for Fitted ARIMA models

Description

This function modifies the Box.test function in the stats package, and it computes the Ljung-Box or Box-Pierce tests checking whether or not the residuals appear to be white noise.

Usage

LB.test(model, lag = 12, type = c("Ljung-Box", "Box-Pierce"), no.error = FALSE,
 omit.initial = TRUE)

Arguments

model
model fit from the arima function
lag
number of lags of the autocorrelation of the residuals to be included in the test statistic. (default=12)
type
either Ljung-Box or Box-Pierce
no.error
a system variable; normally it is not changed
omit.initial
if true, (d+Ds) initial residuals are omitted from the test

Value

  • a list:
  • statisticstest statistic
  • p.valuep-value
  • parameterd.f. of the Chi-square test
  • lagno of lags

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, 15091526. Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time series models. Biometrika 65, 553564.

Examples

Run this code
data(color)
m1.color=arima(color,order=c(1,0,0))
LB.test(m1.color)

Run the code above in your browser using DataLab