mgc.ksample: MGC K Sample Testing

Description Usage Arguments Value Author(s) References Examples

View source: R/MGCKSample.R

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

1
mgc.ksample(X, Y, mgc.opts = list(), ...)

Arguments

X

is interpreted as:

a [n x d] data matrix

X is a data matrix with n samples in d dimensions, if flag is.dist.X=FALSE.

a [n x n] distance matrix

X is a distance matrix. Use flag is.dist.X=TRUE.

Y

[n] the labels of the samples with K unique labels.

mgc.opts

Arguments to pass to MGC, as a named list. See mgc.test for details. Do not pass arguments for is.dist.Y, dist.xfm.Y, dist.params.Y, nor dist.return.Y, as they will be ignored.

...

trailing args.

Value

A list containing the following:

p.value

P-value of MGC

stat

is the sample MGC statistic within [-1,1]

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

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

neurodata/r-mgc documentation built on March 12, 2021, 9:45 a.m.