nac_test.Rd
The NAC test to measure the goodness-of-fit of the DCSBM to network data.
The function computes the NAC+ or NAC statistics in the paper below. Label vectors, if
not provided, are estimated using spec_clust by default but one can also use any other
community detection algorithms through cluster_fct
. Note that the function has to have
A
and K
as its first two arguments, and additional arguments could be provided through
...
.
nac_test(A, K, z = NULL, y = NULL, plus = T, cluster_fct = spec_clust, ...)
adjacency matrix.
number of communities.
label vector for rows of A
. If not provided, will be estimated from cluster_fct
.
label vector for columns of A
. If not provided, will be estimated from cluster_fct
.
whether or not use column label vector with (K
+1) communities, default is TRUE.
community detection function to get z
and y
, by default using spec_clust.
The first two arguments have to be A
and K
.
additional arguments for cluster_fct
.
A list of result
NAC or NAC+ test statistic.
row label vector.
column 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
nac_test(A, K = 4)$stat
#> [1] 3.561323
nac_test(A, K = 4, cluster_fct = fast_cpl)$stat
#> number of iterations= 3
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 4
#> number of iterations= 5
#> number of iterations= 9
#> number of iterations= 8
#> number of iterations= 9
#> number of iterations= 11
#> number of iterations= 10
#> number of iterations= 11
#> number of iterations= 10
#> number of iterations= 11
#> number of iterations= 10
#> [1] 1.252656