USPFunctional {USP}R Documentation

Independence test for functional data

Description

We implement the permutation independence test described in (Berrett et al. 2021) for functional data taking values in L^2([0,1]). The discretised functions are expressed in a series expansion, and an independence test is carried out between the coefficients of the functions, using a Fourier basis to define the test statistic.

Usage

USPFunctional(X, Y, Ntrunc, M, B = 999, ties.method = "standard")

Arguments

X

A matrix of the discretised functional data from the first sample. There are n rows, where n is the sample size, and Ndisc columns, where Ndisc is the grid size such that the values of each function on 1/Ndisc, 2/Ndisc, ..., 1 are given.

Y

A matrix of the discretised functional data from the second sample. The discretisation grid may be different to the grid used for X, if required.

Ntrunc

The number of coefficients to retain from the series expansions of X and Y.

M

The maximum frequency to use in the Fourier basis when testing the independence of the coefficients.

B

The number of permutations used to calibrate the test.

ties.method

If "standard" then calculate the p-value as in (5) of (Berrett et al. 2021), which is slightly conservative. If "random" then break ties randomly. This preserves Type I error control.

Value

A p-value for the test of the independence of X and Y.

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=50; r=0.6; Ndisc=1000; t=1/Ndisc
X=matrix(rep(0,Ndisc*n),nrow=n); Y=matrix(rep(0,Ndisc*n),nrow=n)
for(i in 1:n){
 x = rnorm(Ndisc, mean=0, sd= 1)
 se = sqrt(1 - r^2) #standard deviation of error
 e = rnorm(Ndisc, mean=0, sd=se)
 y = r*x + e
 X[i,] <- cumsum(x*sqrt(t))
 Y[i,] <- cumsum(y*sqrt(t))
}
USPFunctional(X,Y,2,1,999)

[Package USP version 0.1.2 Index]