InfKern {USP} | R Documentation |
Kernel for infinite-dimensional example
Description
Function to produce the kernel matrices in the infinite dimensional example described in Section 7.4 of (Berrett et al. 2021). Here, a random function is converted to a sequence of coefficients and we use the Fourier basis on these coefficients. This function is an essential part of USPFunctional.
Usage
InfKern(X, Ntrunc, M)
Arguments
X |
Matrix giving one of the samples to be tested. Each row corresponds to a discretised function, with each column giving the values of the functions at the corresponding grid point. |
Ntrunc |
The total number of coefficients to look at in the basis expansion of the functional data. |
M |
The maximum frequency to look at in the Fourier basis. |
Value
The kernel matrix for the sample X
.
References
Berrett TB, Kontoyiannis I, Samworth RJ (2021). “Optimal rates for independence testing via U-statistic permutation tests.” Annals of Statistics, to appear.
Examples
n=10 #number of observations
Ndisc=1000; t=1/Ndisc #functions represented at grid points 1/Ndisc, 2/Ndisc,...,1
X=matrix(rep(0,Ndisc*n),nrow=n)
for(i in 1:n){
x=rnorm(Ndisc,mean=0,sd=1)
X[i,]=cumsum(x*sqrt(t))
}
InfKern(X,2,2)