This is an illustration of usage of hyperplane-based portmanteau test of multivariate elliptical strict white noise against multivariate serial dependence, defined in Hudecová and Šiman (2022+). The necessary functions for the computation of interdirections, ranks of specified lift-interdirections and the test statistic are available in the file portmanteau_interdirections.R.

Function port.int.test computes test statistic \(S_P\) from equation (6) and the corresponding p-value computed from the asymptotic \(\chi^2\) distribution. The ranks used in the test statistic can be the ranks of one of the following types of lift-interdirections:

  1. semi-randomized incomplete lift-interdirections,
  2. reflective incomplete lift-interdirections,
  3. randomized incomplete lift-interdirections.

See the paper for exact definitions.

source("portmanteau_interdirections.R")

We illustrate the usage of the test with an example of a simple bivariate (\(p=2\)) VAR(1) sequence \[ Y_t=\rho Y_{t-1}+\varepsilon_t, \] where \(\varepsilon_t\) is generated from the standard bivariate normal distribution \(\mathsf{N}_2(0,I)\). Note that \(\rho=0\) corresponds to the null hypothesis, while \(|\rho| \in (0,1)\) yields a dependent series. In the next example, we set \(\rho=0.5\) and sample size \(n=100\).

library(mvtnorm)
rho=0.5
eps=rmvnorm(n<-100,mean=c(0,0),sigma=diag(2))
YMat=eps
YMat[1,]=eps[1,]
for(i in 2:n) YMat[i,]=rho*YMat[i-1,]+eps[i,]

For this sequence, we compute the test statistic \(S_P\) for threshold \(m=2\) computed from ranks of randomized incomplete lift-interdirections (LIType=3) and Wilcoxon score function \(K_1(x)=K_2(x)=x\):

port.int.test(YMat,M=2,KFUN="wilcox",LIType=3,DesI=5,DesL=5)
## $W
## [1] 29.90623
## 
## $p
## [1] 0.0002195992

The randomized incomplete lift-interdirections use a design set \(\mathcal{Q}_L\) chosen independently with replacement with size \(|\mathcal{Q}_L|=5n\). Similarly, the interdirections are computed using \(|\mathcal{Q}_C|=5n\). Note that complete interdirections would correspond to DesI=0, but their computation may not terminate successfully. Since the sign vectors and design matrices are chosen randomly, different results are obtained if the same code is run with different set.seed.

Note that the function port.int.test allows only choices \(K_1=K_2=K\). This score function can be set as one of the following:

Hence, a test statistic with \(m=1\), van der Waerden score function and semi-randomized incomplete lift-interdirections is obtained by:

port.int.test(YMat,M=1,KFUN="gaussian",LIType=1,DesI=5,DesL=5)
## $W
## [1] 29.50164
## 
## $p
## [1] 6.181646e-06