np.sdeptest: Kernel Consistent Serial Dependence Test for Univariate...

npsdeptestR Documentation

Kernel Consistent Serial Dependence Test for Univariate Nonlinear Processes

Description

npsdeptest implements the consistent metric entropy test of nonlinear serial dependence as described in Granger, Maasoumi and Racine (2004).

Usage


npsdeptest(data = NULL,
           lag.num = 1,
           method = c("integration","summation"),
           bootstrap = TRUE,
           boot.num = 399,
           random.seed = 42)

Arguments

data

a vector containing the variable that can be of type numeric or ts.

lag.num

an integer value specifying the maximum number of lags to use. Defaults to 1.

method

a character string used to specify whether to compute the integral version or the summation version of the statistic. Can be set as integration or summation (see below for details). Defaults to integration.

bootstrap

a logical value which specifies whether to conduct the bootstrap test or not. If set to FALSE, only the statistic will be computed. Defaults to TRUE.

boot.num

an integer value specifying the number of bootstrap replications to use. Defaults to 399.

random.seed

an integer used to seed R's random number generator. This is to ensure replicability. Defaults to 42.

Details

npsdeptest computes the nonparametric metric entropy (normalized Hellinger of Granger, Maasoumi and Racine (2004)) for testing for nonlinear serial dependence, D[f(y_t, \hat y_{t-k}), f(y_t)\times f(\hat y_{t-k})]. Default bandwidths are of the Kullback-Leibler variety obtained via likelihood cross-validation.

The test may be applied to a raw data series or to residuals of user estimated models.

The summation version of this statistic may be numerically unstable when data is sparse (the summation version involves division of densities while the integration version involves differences). Warning messages are produced should this occur (‘integration recommended’) and should be heeded.

Value

npsdeptest returns an object of type deptest with the following components

Srho

the statistic vector Srho

Srho.cumulant

the cumulant statistic vector Srho.cumulant

Srho.bootstrap.mat

contains the bootstrap replications of Srho

Srho.cumulant.bootstrap.mat

contains the bootstrap replications of Srho.cumulant

P

the P-value vector of the Srho statistic vector

P.cumulant

the P-value vector of the cumulant Srho statistic vector

bootstrap

a logical value indicating whether bootstrapping was performed

boot.num

number of bootstrap replications

lag.num

the number of lags

bw.y

the numeric vector of bandwidths for data marginal density at lag num.lag

bw.y.lag

the numeric vector of bandwidths for lagged data marginal density at lag num.lag

bw.joint

the numeric matrix of bandwidths for data and lagged data joint density at lag num.lag

summary supports object of type deptest.

Usage Issues

The integration version of the statistic uses multidimensional numerical methods from the cubature package. See adaptIntegrate for details. The integration version of the statistic will be substantially slower than the summation version, however, it will likely be both more accurate and powerful.

Author(s)

Tristen Hayfield tristen.hayfield@gmail.com, Jeffrey S. Racine racinej@mcmaster.ca

References

Granger, C.W. and E. Maasoumi and J.S. Racine (2004), “A dependence metric for possibly nonlinear processes”, Journal of Time Series Analysis, 25, 649-669.

See Also

npdeptest,npdeneqtest,npsymtest,npunitest

Examples

## Not run: 
set.seed(1234)

## A function to create a time series

ar.series <- function(phi,epsilon) {
  n <- length(epsilon)
  series <- numeric(n)
  series[1] <- epsilon[1]/(1-phi)
  for(i in 2:n) {
    series[i] <- phi*series[i-1] + epsilon[i]
  }
  return(series)
}

n <- 100

## Stationary persistent time-series

yt <- ar.series(0.95,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="summation")

Sys.sleep(5)

## Stationary independent time-series

yt <- ar.series(0.0,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="summation")

## Stationary persistent time-series

yt <- ar.series(0.95,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="integration")

Sys.sleep(5)

## Stationary independent time-series

yt <- ar.series(0.0,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="integration")


## End(Not run) 


np documentation built on March 31, 2023, 9:41 p.m.