LP.struct.test: Detection of structures in an ordered-network.

Description Usage Arguments Value Author(s) References Examples

View source: R/LP.struct.test.R

Description

Given adjacency matrix W, this function perform a graph based test to determine whether there are different communities present in a graph of ordered vertices.

Usage

1
LP.struct.test(W, m = NULL, n.iter = 50)

Arguments

W

A n-by-n weighted-adjacency matrix.

m

Number of LP-nonparametric basis used for generating the test statistic, set to NULL to use original Laplacian.

n.iter

Iterations used for small sample correction, default is 50.

Value

A list containing the following items:

stat

The test statistic, which asymptotically follows a normal distribution with mean and variance mentioned in the reference.

pval

P-value for the test, small p-value means different communities may be present.

Author(s)

Mukhopadhyay, S. and Wang, K.

References

Mukhopadhyay, S. and Wang, K. (2018), "Graph Spectral Compression via Smoothing".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
   ##1.example: null case
   ##simulate a normal data with mean 0 and variance 1:
    X  <-matrix(rnorm(500,mean=0,sd=1),20,25)
   ## Generate adjacency matrix:
    dmat<-dist(X)
    W   <-exp(-as.matrix(dmat)^2/(2*quantile(dmat,.5)^2))
   ## test of structure:
    h0.test<-LP.struct.test(W, m = 4 , n.iter = 50)
   ###extract p-value:
    h0.test$pval

   ##2.example: two sample location alternative
   ##simulate a two sample locational difference normal data:
    X1<-matrix(rnorm(250,mean=0,sd=1),10,25)
    X2<-matrix(rnorm(250,mean=0.5,sd=1),10,25)
    X<-rbind(X1,X2)
   ## Generate adjacency matrix:
    dmat<-dist(X)
    W   <-exp(-as.matrix(dmat)^2/(2*quantile(dmat,.5)^2))
   ## test of structure:
    h1.test<-LP.struct.test(W, m = 4 , n.iter = 50)
   ###extract p-value:
    h1.test$pval

LPGraph documentation built on Jan. 31, 2020, 1:06 a.m.