Learn R Programming

dCovTS (version 1.0)

UnivTest: Testing for independence in univariate time series

Description

A test of pairwise independence for univariate time series.

Usage

UnivTest(x, type = c("truncated", "bartlett", "daniell", "QS", "parzen"), 
         testType = c("covariance", "correlation"), p, b = 0, parallel = FALSE)

Arguments

x
numeric vector or univariate time series.
type
character string which indicates the smoothing kernel. Possible choices are 'truncated' (the default), 'bartlett', 'daniell', 'QS', 'parzen'.
testType
character string indicating the type of the test to be used. Allowed values are 'covariance' (default) for using the distance covariance function and 'correlation' for using the distance correlation function.
p
bandwidth, whose choice is determined by $p=cn^{\lambda}$ for $c > 0$ and $\lambda \in (0,1)$.
b
the number of bootstrap replicates of the test statistic. It is a positive integer. If b=0 (the default), then no p-value is returned.
parallel
logical value. By default, parallel=FALSE. If parallel=TRUE, bootstrap computation is distributed to multiple cores, which typically is the maximum number of available CPUs and is detecting directly from the function.

Value

  • An object of class htest which is a list containing:
  • methoddescription of test.
  • statisticthe observed value of the test statistic.
  • replicatesbootstrap replicates of the test statistic (if $b=0$ then replicates=NULL).
  • p.valuep-value of the test (if $b=0$ then p.value=NA).
  • data.namedescription of data (the data name, kernel type, type, bandwidth, p, and the number of bootstrap replicates b).

Details

UnivTest performs a test on the null hypothesis of independence in univariate time series. The p-value of the test is obtained via the Independent Wild Bootstrap (Shao, 2010; Leucht and Neumann, 2013), with b replicates. If typeTest = 'covariance' then, the observed statistic is $$\sum_{j=1}^{n-1}{(n-j)k^2(j/p)\hat{V}^2_X(j)},$$ otherwise $$\sum_{j=1}^{n-1}{(n-j)k^2(j/p)\hat{R}^2_X(j)},$$ where $k(\cdot)$ is a kernel function computed by kernelFun and p is a bandwidth or lag order whose choice is further discussed in Fokianos and Pitsillou (2016). Under the null hypothesis of independence and some further assumptions about the kernel function $k(\cdot)$, the standardized version of the test statistic follows $N(0,1)$ asymptotically and it is consistent. More details of the asymptotic properties of the statistic can be found in Fokianos and Pitsillou (2016).

References

Fokianos K. and M. Pitsillou (2016). Consistent testing for pairwise dependence in time series. Technometrics, http://dx.doi.org/10.1080/00401706.2016.1156024. Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis $\textbf{117}$, 257-280, http://dx.doi.org/10.1016/j.jmva.2013.03.003. Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association $\textbf{105}$, 218-235, http://dx.doi.org/10.1198/jasa.2009.tm08744.

See Also

ADCF ADCV

Examples

Run this code
x<-rnorm(500)
n <- length(x)
c <- 1
lambda <- 1/5
p <- ceiling(c*n^lambda)
mT=UnivTest(x,type="bar",testType="covariance",p=p,b=499,parallel=TRUE)
mF=UnivTest(x,type="bar",testType="covariance",p=p,b=499,parallel=FALSE)

data <- tail(ibmSp500[,2],100)
n2 <- length(data)
c2 <- 3
lambda2 <- 0.1
p2 <- ceiling(c2*n2^lambda2)
testCov=UnivTest(data,type="par",testType="covariance",p=p2,b=499,parallel=TRUE)
testCor=UnivTest(data,type="par",testType="correlation",p=p2,b=499,parallel=TRUE)

Run the code above in your browser using DataLab