USPFourierAdapt: Adaptive permutation test of independence for continuous...

Description Usage Arguments Value References Examples

View source: R/USPFourierAdapt.R

Description

We implement the adaptive version of the independence test for univariate continuous data using the Fourier basis, as described in Section 4 of \insertCiteBKS2020USP. This applies USPFourier with a range of values of M, and a properly corrected significance level.

Usage

1
USPFourierAdapt(x, y, alpha, B = 999, ties.method = "standard")

Arguments

x

The vector of data points from the first sample, each entry belonging to [0,1].

y

The vector of data points from the second sample, each entry belonging to [0,1].

alpha

The desired significance level of the test.

B

Controls the number of permutations to be used. With a sample size of n each test uses B \log_2 n permutations. If B+1 < 1/α then it is not possible to reject the null hypothesis.

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

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 M at the which the null was rejected and the value of the test statistic.

References

\insertRef

BKS2020USP

Examples

1
2
3
4
5
6
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)

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

Related to USPFourierAdapt in USP...