| LBTest {PRTest} | R Documentation |
This is an object oriented version which can be used to test an time series for randomness or to test the goodness-of-fit of a fitted time series model.
LBTest(obj, lags = seq(5, 40, 5), SquaredQ = FALSE, BoxPierceQ=FALSE)
obj |
|
lags |
lags to be tested |
NREP |
number of bootstrap replications |
SquaredQ |
use squared residuals |
BoxPierceQ |
if TRUE, the Box-Pierce form of the portmanteau statistic is used |
As shown by Ljung and Box (1978) the statistic
Q_m = n (n+2) sum_{k=1}^m frac{r^2_k}{n-k}
where r_k is the autocorrelation at lag k and n is the length of the time series.
the p-values at the corresponding lags
The parametric bootstrap version of this test is implemented in
our function PRTest.
A.I. McLeod
Box, G.E.P. and Pierce, D.A. (1970). JASA.
Ljung, G.M. and Box, G.E.P. (1979). The Likelihood Function of Stationary Autoregressive-Moving Average Models. Biometrika 66, 265-270.
The use of squared residuals for detecting nonlinearity and ARCH-like effects is discussed in Li (2004).