Description Usage Arguments Value References Examples
Carry out an independence test of the independence of two samples, give two kernel matrices J and K, as described in Section 7.1 of \insertCiteBKS2020USP. We calculate the test statistic and null statistics using the function KernStat, before comparing them to produce a p-value. For the featured examples considered these matrices can be calculated using FourierKernel or InfKern. Alternatively, if a different basis is to be used, then the kernels can be entered separately.
1 |
J |
n \times n kernel matrix corresponding to first sample. |
K |
n \times n kernel matrix corresponding to second sample. |
B |
The number of permutation 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. |
nullstats |
If TRUE, returns a vector of the null statistic values. |
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.
BKS2020USP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | x=runif(100); y=runif(100); M=3
J=FourierKernel(x,M); K=FourierKernel(y,M)
USP(J,K,999)
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))
}
J=InfKern(X,2,1); K=InfKern(Y,2,1)
USP(J,K,999)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.