# USPFunctional: Independence test for functional data In USP: U-Statistic Permutation Tests of Independence for all Data Types

## Description

We implement the permutation independence test described in \insertCiteBKS2020USP 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

 `1` ```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 \insertCiteBKS2020USP, 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.

\insertRef

BKS2020USP

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```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) ```

USP documentation built on Jan. 27, 2021, 5:08 p.m.