kmmd performs
a non-parametric distribution test."kmmd"(x, y, kernel="rbfdot",kpar="automatic", alpha = 0.05, asymptotic = FALSE, replace = TRUE, ntimes = 150, frac = 1, ...)
"kmmd"(x, y, Kxy, alpha = 0.05, asymptotic = FALSE, replace = TRUE, ntimes = 100, frac = 1, ...)
"kmmd"(x, y, kernel="stringdot", kpar = list(type = "spectrum", length = 4), alpha = 0.05, asymptotic = FALSE, replace = TRUE, ntimes = 150, frac = 1, ...)matrix,
list, or kernelMatrixmatrix,
list, or kernelMatrixkernlMatrix between $x$ and $y$ values (only for the
kernelMatrix interface)kernlab provides the most popular kernel functions
which can be used by setting the kernel parameter to the following
strings:
rbfdot Radial Basis kernel function "Gaussian"
polydot Polynomial kernel function
vanilladot Linear kernel function
tanhdot Hyperbolic tangent kernel function
laplacedot Laplacian kernel function
besseldot Bessel kernel function
anovadot ANOVA RBF kernel function
splinedot Spline kernel
stringdot String kernel
The kernel parameter can also be set to a user defined function of class kernel by passing the function name as an argument.
sigma inverse kernel width for the Radial Basis
kernel function "rbfdot" and the Laplacian kernel "laplacedot".
degree, scale, offset for the Polynomial kernel "polydot"
scale, offset for the Hyperbolic tangent kernel
function "tanhdot"
sigma, order, degree for the Bessel kernel "besseldot".
sigma, degree for the ANOVA kernel "anovadot".
lenght, lambda, normalized for the "stringdot" kernel
where length is the length of the strings considered, lambda the
decay factor and normalized a logical parameter determining if the
kernel evaluations should be normalized.
Hyper-parameters for user defined kernels can be passed
through the kpar parameter as well. In the case of a Radial
Basis kernel function (Gaussian) kpar can also be set to the
string "automatic" which uses the heuristics in 'sigest' to
calculate a good 'sigma' value for the Gaussian RBF or
Laplace kernel, from the data. (default = "automatic").
kmmd containing the
results of whether the H0 hypothesis is rejected or not. H0 being
that the samples $x$ and $y$ come from the same distribution.
The object contains the following slots :
H0AsympH0kernelfmmdstatsRadboundAsymboundkmmd-class for more details.
kmmd calculates the kernel maximum mean discrepancy for
samples from two distributions and conducts a test as to whether the samples are
from different distributions with level alpha.
ksvm# create data
x <- matrix(runif(300),100)
y <- matrix(runif(300)+1,100)
mmdo <- kmmd(x, y)
mmdo
Run the code above in your browser using DataLab