Type: | Package |
Title: | Weighted Portmanteau Tests for Time Series Goodness-of-Fit |
Version: | 1.1 |
Date: | 2023-05-23 |
Description: | An implementation of the Weighted Portmanteau Tests described in "New Weighted Portmanteau Statistics for Time Series Goodness-of-Fit Testing" published by the Journal of the American Statistical Association, Volume 107, Issue 498, pages 777-787, 2012. |
License: | GPL (≥ 3) |
LazyLoad: | yes |
NeedsCompilation: | no |
Packaged: | 2023-05-24 02:16:32 UTC; fishert4 |
Author: | Thomas J. Fisher |
Maintainer: | Thomas J. Fisher <fishert4@miamioh.edu> |
Repository: | CRAN |
Date/Publication: | 2023-05-24 07:10:02 UTC |
Weighted Portmanteau Test procedures for Time Series Goodness-of-fit
Description
Two functions that implement the Weighted Portmanteau Statistics from Fisher and Gallagher (2012). The first is essentially a weighted Ljung-Box type test that can be used for fitted ARMA processes or detecting non-linear effects. The second function can be utilized to check the adequacy of a fitted ARCH process. Both are written for backward compatibility.
Details
Package: | WeightedPortTest |
Type: | Package |
Version: | 1.1 |
Date: | 2023-05-23 |
License: | GPL (>=3) |
LazyLoad: | yes |
The two functions, Weighted.Box.test()
and Weighted.LM.test()
, can be used in a similiar to the Box.test()
function.
Author(s)
Thomas J. Fisher and Colin M. Gallagher
Maintainer: Thomas J. Fisher <fishert4@miamioh.edu>
Weighted Portmanteau Test
Description
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.
Usage
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)
Arguments
x |
a numeric vector or univariate time series, or residuals of a fitted time series |
lag |
the statistic will be based on |
type |
test to be performed, partial matching is used. "Box-Pierce" by default |
fitdf |
number of degrees of freedom to be subtracted if |
sqrd.res |
A flag, should the series/residuals be squared to detect for nonlinear effects?, FALSE by default |
log.sqrd.res |
A flag, should a log of the squared series/residuals be used to detect for nonlinear effects? FALSE by default |
abs.res |
A flag, should the absolute series or residuals be used to detect for nonlinear effects? FALSE by default |
weighted |
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 |
Details
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).
Value
A list with class "htest
" containing the following components:
statistic |
the value of the test statistic |
parameter |
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. |
p.value |
The p-value of the test |
method |
a character string indicating which type of test was performed. |
data.name |
a character string giving the name of the data |
Note
Like the Box.test()
function, missing values are not handled
Author(s)
Thomas J. Fisher
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, 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.
Examples
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);
Weighted Portmanteau Test for Fitted ARCH process
Description
A weighted portmanteau test for testing the null hypothesis of adequately fitted ARCH process. This is essentially a weighted version of the statistic proposed by Li and Mak (1994)
Usage
Weighted.LM.test(x, h.t, lag = 1,
type = c("correlation", "partial"),
fitdf = 1, weighted = TRUE)
Arguments
x |
a numeric vector or univariate time series, or residuals of a fitted time series |
h.t |
a numeric vector of the conditional variances |
lag |
the statistic will be based on |
type |
type of test to be performed, either based on the autocorrelations or partial-autocorrelations. |
fitdf |
the number of ARCH parameters fit to the model, default=1 since at least some ARCH model must be fit to find h.t |
weighted |
A flag determining if the weighting scheme should be utilized. TRUE by default, if FALSE, it performs the test from Li and Mak (1994) |
Details
These test can be performed after fitting an ARCH process to a time series. The theoretical work was originally developed in Li and Mak (1994) and has recently been extended in Fisher and Gallagher (2012).
Value
A list with class "htest
" containing the following components:
statistic |
the value of the test statistic |
parameter |
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. |
p.value |
The p-value of the test |
method |
a character string indicating which type of test was performed. |
data.name |
a character string giving the name of the data |
Note
Similiar to the Box.test()
and Weighted.Box.test()
functions
Author(s)
Thomas J. Fisher
References
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.
Li, W. K. and Mak, T. K. (1994), On the squared residual autocorrelations in non-linear time series with conditional heteroskedasticity. Journal of Time Series Analysis 15(6), 627-636.