Weighted portmanteau tests for testing the null hypothesis of adequate ARMA fit and/or for detecting nonlinear processes. Written in the style of Box.test() and is capable of performing the traditional Box Pierce (1970), Ljung Box (1978) or Monti (1994) tests.
Weighted.Box.test(x, lag = 1,
type = c("Box-Pierce", "Ljung-Box", "Monti"),
fitdf = 0, sqrd.res = FALSE,
log.sqrd.res = FALSE, abs.res = FALSE,
weighted = TRUE)A list with class "htest" containing the following components:
the value of the test statistic
The approximate shape and scale parameters for the weighted statistic or degrees of freedom of the chi-squared distribution if the weighted flag is set to false.
The p-value of the test
a character string indicating which type of test was performed.
a character string giving the name of the data
a numeric vector or univariate time series, or residuals of a fitted time series
the statistic will be based on lag autocorrelation coefficients. lag=1 by default
test to be performed, partial matching is used. "Box-Pierce" by default
number of degrees of freedom to be subtracted if x is a series of residuals, set at 0 by default
A flag, should the series/residuals be squared to detect for nonlinear effects?, FALSE by default
A flag, should a log of the squared series/residuals be used to detect for nonlinear effects? FALSE by default
A flag, should the absolute series or residuals be used to detect for nonlinear effects? FALSE by default
A flag determining if the weighting scheme should be utilized. TRUE by default. If set to FALSE, the traditional test is performed with no weights
Thomas J. Fisher
These test are traditionally applied to a time series for detecting autocorrelation, or to the residuals of an ARMA(p,q) fit to check the adequacy of that fit or to detect nonlinear (i.e. GARCH) effects in the time/residual series. The weighting scheme utilized here is asymptotically similar to the results found in Pena and Rodriguez (2002) and Mahdi and McLeod (2012) (i.e. the portes package).
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.
Fisher, T. J. and Gallagher, C. M. (2012), New Weighted Portmanteau Statistics for Time Series Goodness-of-Fit Testing. Journal of the American Statistical Association, 107(498), 777-787.
Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time series models. Biometrika 65, 297-303.
Mahdi, E. and McLeod, A. I. (2012), Improved multivariate portmanteau test. Journal of Time Series Analysis 65(2), 297-303.
Monti, A. C. (1994), A proposal for a residual autocorrelation test in linear models. Biometrika 81(4), 776-780.
Pena, D. and Rodriguez, J. (2002) A powerful portmanteau test of lack of fit for time series. Journal of the American Statistical Association 97(458), 601-610.
set.seed(1)
x <- rnorm(100);
Weighted.Box.test(x, lag=10, type="Ljung");
Weighted.Box.test(x, lag=10, type="Ljung", sqrd.res=TRUE);
Run the code above in your browser using DataLab