Learn R Programming

DEGraph (version 1.24.0)

graph.T2.test: Performs the Hotelling T2 test in Fourier space

Description

Performs the Hotelling T2 test in Fourier space.

Usage

graph.T2.test(X1, X2, G=NULL, lfA=NULL, ..., k=ncol(X1))

Arguments

X1
A n1 x p numeric matrix, observed data for class 1: p variables, n1 observations.
X2
A n2 x p numeric matrix, observed data for class 2: p variables, n2 observations.
G
An object of class graphAM or graphNEL, the graph to be used in the two-sample test.
lfA
A list returned by laplacianFromA(), containing the Laplacian eigen vectors and eigen values
...
Further arguments to be passed to laplacianFromA().
k
A numeric value, number of Fourier components retained for the test.

Value

A list with class "htest", as returned by T2.test.

See Also

T2.test graphAM

Examples

Run this code
library("rrcov")

## Some parameters
n1 <- n2 <- 20
nnodes <- nedges <- 20
k <- 3
ncp <- 0.5
sigma <- diag(nnodes)/sqrt(nnodes)


## Build graph, decompose laplacian
G <- randomWAMGraph(nnodes=nnodes,nedges=nedges)
A <- G@adjMat
lfA <- laplacianFromA(A,ltype="unnormalized")
U <- lfA$U
l <- lfA$l

## Build two samples with smooth mean shift
X <- twoSampleFromGraph(n1,n2,shiftM2=ncp,sigma,U=U,k=k)

## Do hypothesis testing
t <- T2.test(X$X1,X$X2) # Raw T-square
print(t$p.value)
tu <- graph.T2.test(X$X1,X$X2,lfA=lfA,k=k) # Filtered T-squares
print(tu$p.value)

Run the code above in your browser using DataLab