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

## Description

Performs a permutation test of independence between two univariate continuous random variables, using the Fourier basis to construct the test statistic, as described in \insertCiteBKS2020USP.

## Usage

 `1` ```USPFourier(x, y, M, B = 999, ties.method = "standard", nullstats = FALSE) ```

## Arguments

 `x` A vector containing the first sample, with each entry in [0,1]. `y` A vector containing the second sample, with each entry in [0,1]. `M` The maximum frequency to use in the Fourier basis. `B` The number of permutation to use when calibrating 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. `nullstats` If TRUE, returns a vector of the null statistic values.

## Value

Returns the p-value for this independence test and the value of the test statistic, D_n, as defined in \insertCiteBKS2020USP. If nullstats=TRUE is used, then the function also returns a vector of the null statistics.

\insertRef

BKS2020USP

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```x=runif(10); y=x^2 USPFourier(x,y,1,999) n=100; w=2; x=integer(n); y=integer(n); m=300 unifdata=matrix(runif(2*m,min=0,max=1),ncol=2); x1=unifdata[,1]; y1=unifdata[,2] unif=runif(m); prob=0.5*(1+sin(2*pi*w*x1)*sin(2*pi*w*y1)); accept=(unif

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