Learn R Programming

portes (version 1.08)

gvtest: Generalized Variance Portmanteau Test

Description

New generalized variance portmanteau test based on the determinant of the Hosking's autocorrelation block Toeplitz matrix with order $m+1$ given in the function ToeplitzBlock, where $m$ represents the order of the block matrix.

Usage

gvtest(obj,lags=seq(5,30,5),order=0,SquaredQ=FALSE)

Arguments

obj
a univariate or multivariate series with class "numeric", "matrix", "ts", or ("mts" "ts"). It can be also an object of fitted time-series model with class "ar",
lags
vector of lag auto-cross correlation coefficients used for gvtest test.
order
this is used for degrees of freedom of asymptotic gamma distribution. If obj is a fitted time-series model with class "ar", "arima0", "Arima", "varest", "
SquaredQ
if TRUE then apply the test on the squared values. This checks for Autoregressive Conditional Heteroscedastic, ARCH, effects. When SquaredQ = FALSE, then apply the test on the usual resi

Value

  • The generalized variance portmanteau test statistic and its associated p-values for different lags based on asymptotic gamma distribution as suggested by Pena and Rodriguez (2002, 2006) in the univariate time series and generalized to the multivariate time series by Mahdi and McLeod (2011).

References

Mahdi, E. and McLeod, A.I. (2011). "Improved multivariate portmanteau diagnostic test". Submitted. Pena, D. and Rodriguez, J. (2002). "A Powerful Portmanteau Test of Lack of Test for Time Series". Journal of American Statistical Association, 97, 601-610. Pena, D. and Rodriguez, J. (2006). "The log of the determinant of the autocorrelation matrix for testing goodness of fit in time series". Journal of Statistical Planning and Inference, 136, 2706-2718.

See Also

acf, Box.test, BoxPierce, LjungBox, Hosking, LiMcLeod, portest, ToeplitzBlock, GetResiduals

Examples

Run this code
x <- rnorm(100)
gvtest(x)            
##############################################################
## Measurements of the annual flow of the river Nile at Aswan 
## from the years 1871 to 1970:
##############################################################
fit <- arima(Nile, c(1, 0, 1))
lags <- c(5, 10, 20, 30)
## Apply the univariate test statistic on the fitted model 
gvtest(fit, lags)               ## True 
gvtest(fit, lags, order = 2)    ## True 
## Apply the test statistic on the residuals and set order = 2 
res <- resid(fit)
gvtest(res, lags)               ## Not True  
gvtest(res, lags, order = 2)    ## True 
##############################################################
## Quarterly, west German investment, income, and consumption 
## from first quarter of 1960 to fourth quarter of 1982: 
##############################################################
data(WestGerman)
DiffData <- matrix(numeric(3 * 91), ncol = 3)
  for (i in 1:3) 
    DiffData[, i] <- diff(log(WestGerman[, i]), lag = 1)
fit <- ar.ols(DiffData, intercept = TRUE, order.max = 2)
lags <- seq(5,30,5)
## Apply the test statistic on the fitted model 
gvtest(fit,lags)                ## True 
## Apply the test statistic on the residuals where order = 2
res <- ts((fit$resid)[-(1:2), ])
gvtest(res,lags)                ## Not True 
gvtest(res,lags,order = 2)      ## True 
##############################################################
## Monthly log stock returns of Intel corporation data
## Test for ARCH Effects 
##############################################################
monthintel <- as.ts(monthintel)
gvtest(monthintel)                ## Usual test
gvtest(monthintel,SquaredQ=TRUE)  ## Test for ARCH effects

Run the code above in your browser using DataLab