The stochastic block model is a popular tool for studying community structures in network data. We develop a goodness-of-fit test for the stochastic block model. The test statistic is based on the largest singular value of a residual matrix obtained by subtracting the estimated block mean effect from the adjacency matrix. Asymptotic null distribution is obtained using recent advances in random matrix theory. The test is proved to have full power against alternative models with finer structures. These results naturally lead to a consistent sequential testing estimate of the number of communities.
Jing Lei. "A goodness-of-fit test for stochastic block models." Ann. Statist. 44 (1) 401 - 424, February 2016. https://doi.org/10.1214/15-AOS1370