Kernel Consistent Serial Dependence Test for Univariate Nonlinear Processes
np.sdeptest.Rdnpsdeptest 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, Bandwidth Inputs And Formula Interface
These arguments identify the data series, lag count, and statistic variant.
- data
a vector containing the variable that can be of type
numericorts.- 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
integrationorsummation(see below for details). Defaults tointegration.
- boot.num
an integer value specifying the number of bootstrap replications to use. Defaults to
399.- 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 toTRUE.- random.seed
an integer used to seed R's random number generator. This is to ensure replicability. Defaults to 42.
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
datamarginal density at lagnum.lag- bw.y.lag
the numeric vector of bandwidths for lagged
datamarginal density at lagnum.lag- bw.joint
the numeric matrix of bandwidths for
dataand laggeddatajoint density at lagnum.lag
summary supports object of type deptest.
Book And Method Pointers
npsdeptest applies the dependence-test idea to a time series by
comparing the joint law of current and lagged values with the product
of their marginal laws. The lag and bootstrap choices determine the
serial-dependence alternatives being probed and the null calibration.
For book-length background, see Li and Racine (2007), Chapter 13 Nonsmoothing Tests, especially Sections 13.4 and 13.5, and Chapter 12 Model Specification Tests for related distributional tests. For entropy and density context, see Racine (2019), Chapter 2.
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.
Author
Tristen Hayfield tristen.hayfield@gmail.com, Jeffrey S. Racine racinej@mcmaster.ca
Details
Documentation guide: see np.kernels for kernels, np.options for global options, and plot for plotting options.
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.
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.
Examples
if (FALSE) { # \dontrun{
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")
if (interactive()) 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")
if (interactive()) Sys.sleep(5)
## Stationary independent time-series
yt <- ar.series(0.0,rnorm(n))
npsdeptest(yt,lag.num=2,boot.num=99,method="integration")
} # }