snac_test.Rd
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.
snac_test(
A,
K,
z = NULL,
ratio = 0.5,
fromEachCommunity = TRUE,
plus = TRUE,
cluster_fct = spec_clust,
nrep = 1,
...
)
adjacency matrix.
desired number of communities.
label vector for rows of adjacency matrix. If not provided, will be estimated by
cluster_fct
ratio of subsampled nodes from the network.
whether subsample from each estimated community or the full network, default is TRUE
whether or not use column label vector with (K
+1) communities to compute the statistics, default is TRUE.
community detection function to estimate label vectors, by default using spec_clust.
The first two arguments have to be A
and K
.
number of times the statistics are computed.
additional arguments for cluster_fct
.
A list of result
SNAC or SNAC+ test statistic.
row label vector.
Adjusted chi-square test for degree-corrected block models, Linfan Zhang, Arash A. Amini, arXiv preprint arXiv:2012.15047, 2020.
A <- sample_dcpp(500, 10, 4, 0.1)$adj
snac_test(A, K = 4, niter = 3)$stat
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> Warning: did not converge in 3 iterations
#> [1] 0.2268875