mgc.ksample {mgc} | R Documentation |
MGC K Sample Testing
Description
MGC K Sample Testing provides a wrapper for MGC Sample testing under the constraint that the Ys here are categorical labels with K possible sample ids. This function uses a 0-1 loss for the Ys (one-hot-encoding)).
Usage
mgc.ksample(X, Y, mgc.opts = list(), ...)
Arguments
X |
is interpreted as:
|
Y |
|
mgc.opts |
Arguments to pass to MGC, as a named list. See |
... |
trailing args. |
Value
A list containing the following:
p.value |
P-value of MGC |
stat |
is the sample MGC statistic within |
pLocalCorr |
P-value of the local correlations by double matrix index |
localCorr |
the local correlations |
optimalScale |
the optimal scale identified by MGC |
Author(s)
Eric Bridgeford
References
Youjin Lee, et al. "Network Dependence Testing via Diffusion Maps and Distance-Based Correlations." ArXiv (2019).
Examples
## Not run:
library(mgc)
library(MASS)
n = 100; d = 2
# simulate 100 samples, where first 50 have mean [0,0] and second 50 have mean [1,1]
Y <- c(replicate(n/2, 0), replicate(n/2, 1))
X <- do.call(rbind, lapply(Y, function(y) {
return(rnorm(d) + y)
}))
# p value is small
mgc.ksample(X, Y, mgc.opts=list(nperm=100))$p.value
## End(Not run)