Learn R Programming

nett (version 1.0.0)

snac_test: SNAC test

Description

The SNAC test to measure the goodness-of-fit of the DCSBM to network data.

The function computes the SNAC+ or SNAC statistics in the paper below. The row label vector of the adjacency matrix could be given through z otherwise will be estimated by cluster_fct. One can specify the ratio of nodes used to estimate column label vector. If plus = TRUE, the column labels will be estimated by spec_clust with (K+1) clusters, i.e. performing SNAC+ test, otherwise with K clusters SNAC test. One can also get multiple test statistics with repeated random subsampling on nodes.

Usage

snac_test(
  A,
  K,
  z = NULL,
  ratio = 0.5,
  fromEachCommunity = TRUE,
  plus = TRUE,
  cluster_fct = spec_clust,
  nrep = 1,
  ...
)

Value

A list of result

stat

SNAC or SNAC+ test statistic.

z

row label vector.

Arguments

A

adjacency matrix.

K

desired number of communities.

z

label vector for rows of adjacency matrix. If not provided, will be estimated by cluster_fct

ratio

ratio of subsampled nodes from the network.

fromEachCommunity

whether subsample from each estimated community or the full network, default is TRUE

plus

whether or not use column label vector with (K+1) communities to compute the statistics, default is TRUE.

cluster_fct

community detection function to estimate label vectors, by default using spec_clust. The first two arguments have to be A and K.

nrep

number of times the statistics are computed.

...

additional arguments for cluster_fct.

References

Adjusted chi-square test for degree-corrected block models, Linfan Zhang, Arash A. Amini, arXiv preprint arXiv:2012.15047, 2020.

See Also

nac_test

Examples

Run this code
A <- sample_dcpp(500, 10, 4, 0.1)$adj
snac_test(A, K = 4, niter = 3)$stat

Run the code above in your browser using DataLab