kertests | R Documentation |
This function provides generalzied kernel-based two-sample tests.
kertests(X, Y, sigma, r1=1.2, r2=0.8, perm=0)
X |
The first samples. |
Y |
The second samples. |
sigma |
The bandwidth of Gaussian kernels. The median heuristic should be used. |
r1 |
The constant in the test statistics |
r2 |
The constant in the test statistics |
perm |
The number of permutations performed to calculate the p-value of the test. The default value is 0, which means the permutation is not performed and only approximated p-value based on the asymptotic theory is provided. Doing permutation could be time consuming, so be cautious if you want to set this value to be larger than 10,000. |
Returns a list teststat
with each test statistic value and a list pval
with p-values of the tests. See below for more details.
GPK |
The value of the test statistic GPK |
ZW1 |
The value of the test statistic |
ZW2 |
The value of the test statistic |
ZD |
The value of the test statistic |
fGPK_appr |
The approximated p-value of fGPK based on asymptotic theory. |
fGPKM_appr |
The approximated p-value of |
fGPK_Simes_appr |
The approximated p-value of fGPK based on asymptotic theory with a Simes procedure. |
fGPKM_Simes_appr |
The approximated p-value of |
GPK_perm |
The permutation p-value of GPK when argument ‘perm’ is positive. |
fGPK_perm |
The permutation p-value of fGPK when argument ‘perm’ is positive. |
fGPKM_perm |
The permutation p-value of |
fGPK_Simes_perm |
The permutation p-value of fGPK with a Simes procedure when argument ‘perm’ is positive. |
fGPKM_Simes_perm |
The permutation p-value of |
kerTests-package
, med_sigma
## Mean difference in Gaussian distribution.
d = 100
mu = 0.2
sam = 100
n = 200
set.seed(500)
X = matrix(rnorm(d*sam), sam)
Y = matrix(rnorm(d*sam,mu), sam)
sigma = med_sigma(X, Y) # median heuristic
a = kertests(X, Y, sigma, r1=1.2, r2=0.8, perm=1000)
# output results based on the permutation and the asymptotic results
# the test statistic values can be found in a$teststat
# p-values can be found in a$pval
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.