kerTests-package: Generalized Kernel Two-Sample Tests

Description Author(s) References See Also Examples

Description

This package can be used to determine whether two samples are from the same distribution. The Gaussian kernel with the median heuristic, which is the median of all pairwise distances among observations, is used. To obtain the median heuristic, the function med_sigma should be used. The main function is kertests

Author(s)

Hoseung Song and Hao Chen

Maintainer: Hoseung Song (hosong@ucdavis.edu)

References

Song, Hoseung, and Hao Chen (2020). Generalized kernel two-sample tests. arXiv:2011.06127

See Also

kertests, med_sigma

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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

kerTests documentation built on Sept. 16, 2021, 1:06 a.m.