meammd {eummd} | R Documentation |
MEA-MMD: Multivariate Efficient Approximate Maximum Mean Discrepancy
Description
Computes maximum mean discrepancy statistics with Laplacian or Gaussian kernel. Suitable for multivariate data. Naive approach, quadratic in number of observations.
Usage
meammd(
X,
Y,
beta = -0.1,
pval = TRUE,
type = c("proj", "dist"),
numproj = 20,
nmethod = c(2, 1),
distpval = c("Hommel", "Fisher"),
numperm = 200,
seednum = 0,
alternative = c("greater", "two.sided"),
allowzeropval = FALSE
)
Arguments
X |
Matrix (or vector) of observations in first sample. |
Y |
Matrix (or vector) of observations in second sample. |
beta |
kernel parameter. Must be positive; if not, computes
median heuristic in quadratic time for each projection.
Default value
is |
pval |
Boolean for whether to compute p-value or not. |
type |
The type of projection used. Either |
numproj |
Number of projections (only used if |
nmethod |
Norm used for interpoint distances, if |
distpval |
The p-value combination procedure if |
numperm |
Number of permutations. Default is |
seednum |
Seed number for generating permutations. Default is |
alternative |
A character string specifying the alternative hypothesis,
which must be either |
allowzeropval |
A boolean, specifying whether we will allow zero
p-values or not. Default is |
Value
A list with the following elements:
pval
The p-value of the test, if it is computed (
pval=TRUE
). Otherwise, it is set toNA
.stat
The statistic of the test, which is only returned when
type="proj"
, otherwise it is set toNA
.
References
Bodenham, D. A., and Kawahara, Y. (2023) "euMMD: efficiently computing the MMD two-sample test statistic for univariate data." Statistics and Computing 33.5 (2023): 110.
Examples
X <- matrix(c(1:12), ncol=2, byrow=TRUE)
Y <- matrix(c(13:20), ncol=2, byrow=TRUE)
# using the random projections method
mmdList <- meammd(X=X, Y=Y, pval=TRUE, type="proj", numproj=50)
# using the method were distances are computed to the various points
mmdList <- meammd(X=X, Y=Y, pval=TRUE, type="dist")