USPFourierAdapt {USP} | R Documentation |
Adaptive permutation test of independence for continuous data.
Description
We implement the adaptive version of the independence test for univariate continuous data
using the Fourier basis, as described in Section 4 of (Berrett et al. 2021). This applies
USPFourier with a range of values of , and a properly corrected significance
level.
Usage
USPFourierAdapt(x, y, alpha, B = 999, ties.method = "standard")
Arguments
x |
The vector of data points from the first sample, each entry belonging to |
y |
The vector of data points from the second sample, each entry belonging to |
alpha |
The desired significance level of the test. |
B |
Controls the number of permutations to be used. With a sample size of |
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
Returns an indicator with value 1 if the null hypothesis of independence is rejected and
0 otherwise. If the null hypothesis is rejected, the function also outputs the value of
at the which the null was rejected and the value of the test statistic.
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=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<prob);
Data1=unifdata[accept,]; x=Data1[1:n,1]; y=Data1[1:n,2]
plot(x,y)
USPFourierAdapt(x,y,0.05,999)